@plitzi/plitzi-builder 0.32.9 → 0.32.11

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.
@@ -4,7 +4,7 @@ return P(ro,{value:n,children:t})},oo=({ref:e,children:t,tag:n="div",className:r
4
4
  /* webpackIgnore: true */
5
5
  URL.createObjectURL(n))}else{let t={default:void 0,ComponentProvider:Ste,ComponentContext:co,usePlitziServiceContext:io,RootElement:oo},n={__WEBPACK_EXTERNAL_MODULE_react__:e,__WEBPACK_EXTERNAL_MODULE_react_dom__:I,__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__:A,__WEBPACK_EXTERNAL_MODULE__plitzi_plitzi_sdk__:t},a=ne(window,`plitziPlugins.${r}`);if(!a||"function"!=typeof a)return;i=await a(t,void 0,n)}}catch(vAe){return}return i},ho=e=>{let t={};if(!e)return t;t[e.type]=e;let{plugins:n}=e;return n&&Object.keys(n).length>0&&Object.keys(n).forEach(e=>{Object.assign(t,ho(n[e]))}),t},fo=e=>{let t={};return e&&Object.values(e).forEach(e=>{e.type&&Object.assign(t,ho(e))}),t},po=(e,t)=>{if(!e)return{};let n={};return Object.keys(e).forEach(r=>{let i=e[r],{version:a,pluginSettings:o,initialItems:s,plugins:l,extraProps:c}=i;n[r]=W9(i),n[r].origin=t,n[r].version=a,n[r].type=r,n[r].initialItems=s,n[r].pluginSettings=o,n[r].extraProps=c,n[r].plugins=po(l,t)}),n},mo=e=>{let t={};return e&&Object.values(e).forEach(e=>{if(!e.type)return;let{type:n,pluginSettings:r,version:i,initialItems:a,plugins:o,assets:s,content:l,extraProps:c}=e,d=W9(e);d.version=i,d.type=n,d.assets=s,d.initialItems=a,d.pluginSettings=r,d.origin="local-custom",d.content=l,d.extraProps=c,d.plugins=po(o,"local-custom"),Object.assign(t,ho(d))}),t},go=/* @__PURE__ */new Map,vo=(e,t,n,r=!0,i=!1)=>async()=>{let a=`${e}::${t}`;if(!go.get(a)){let n=uo(e,e.endsWith(".mjs")||e.includes(".esm.")||e.includes(".module."),t).finally(()=>{go.delete(a)});go.set(a,{promise:n,timestamp:Date.now()})}let o=await(go.get(a)?.promise);if(!o)return{default:X9};let{type:s,pluginSettings:l}=ne(o,"default",{}),{version:c,initialItems:d,plugins:u}=o;if(!s)return{default:X9};let h=o.default;return i||(h=W9(o.default)),h.version=c,h.origin="remote",h.type=s,h.initialItems=d,h.pluginSettings=l,h.plugins=po(u,"remote"),r&&n(h),{default:h}},bo=({url:e="",scope:t="",internalProps:n,autoRegister:r=!0,plitziJsxSkipHOC:i=!1,plitziJsxProps:a=da})=>{let{register:s}=m(co),l=k(()=>f(vo(e,t,s,r,i)),[e,t]);/* @__PURE__ */
6
6
  return P(o,i?{children:/* @__PURE__ */P(l,{internalProps:n,plitziJsxSkipHOC:i,...a})}:{children:/* @__PURE__ */P(l,{internalProps:n})})},yo=({type:e,plugins:t})=>{let n=(e?t[e]:void 0)??((e,t)=>Object.values(e).find(e=>e.subPlugins.find(e=>e===t)))(t,e);if(!n)return;let r=ne(n,"assets",[]).filter(e=>"script"===e.type),{scope:i}=n;return{url:r.find(e=>e.isMain)?.params.src??ne(r,"0.params.src",""),scope:i}},xo=({key:e,plitziElementLayout:t,type:n,internalProps:r,components:i,plugins:a})=>{let o={...r,plitziElementLayout:t},s=i.notFound?/* @__PURE__ */P(i.notFound,{internalProps:o},e):void 0;if(!n)return s;let l=i[n];if(l)/* @__PURE__ */return P(l,{internalProps:o,extraProps:l.extraProps},e);let c=yo({type:n,plugins:a});return c?/* @__PURE__ */P(bo,{url:c.url,scope:c.scope,internalProps:o},e):s},wo=e=>{let t={};for(let n of e.split(";")){let e=n.indexOf(":");if(-1===e)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();if(r&&i){let e=r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());t[e]=i}}return t},Oo=({id:e})=>{let[t]=z(()=>{if(typeof document>"u")return null;let t=document.querySelector(`[data-rsc-id="${e}"]`);if(!t)return null;let n={};for(let e=0;e<t.attributes.length;e++){let{name:r,value:i}=t.attributes[e];"class"!==r&&"style"!==r&&"data-rsc-id"!==r&&(n[r]=i)}let r=t.getAttribute("style");return{tag:t.tagName.toLowerCase(),className:t.className,style:r?wo(r):void 0,attrs:n,html:t.innerHTML}});return t?c(t.tag,{"data-rsc-id":e,className:t.className||void 0,style:t.style,...t.attrs,dangerouslySetInnerHTML:{__html:t.html}}):null},ko=l({});ko.displayName="BuilderContext";var So=l({});So.displayName="CollectionContext";var Co=(e,t)=>t.idRef?`${e}_${t.idRef}`:"",zo=async e=>{let t;try{return t=await(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}})).json(),t}catch{return t}},No=e=>{let t="number";return/^"/.test(e)?t=/:$/.test(e)?"text-red-700":"text-green-700":/true|false/.test(e)?t="text-blue-700":/null/.test(e)&&(t=""),`<span class="${t}">${e}</span>`},Eo=/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g,Ao=e=>e?.replace(Eo,No)??e,To=Symbol("twigArrowParams"),Po=(e,t)=>e===t?0:null==e?-1:null==t?1:"number"==typeof e&&"number"==typeof t?e-t:String(e).localeCompare(String(t)),Mo=e=>null==e?"":String(e),Io=e=>"object"==typeof e&&!!e&&"__PLITZI_RAW__"===e.__marker,Ro=e=>Io(e)?e.__raw:e,Do={raw:e=>(e=>({__raw:e,__marker:"__PLITZI_RAW__"}))(e),to_json:e=>"object"==typeof e&&e?JSON.stringify(e):Mo(e),json_encode:e=>"object"==typeof e&&e?JSON.stringify(e):Mo(e),object_as_json:e=>"object"==typeof e&&e?JSON.stringify(e):e,default:(e,t)=>(e=>null==e||""===e)(e)?t[0]:e,upper:e=>"string"==typeof e?e.toUpperCase():e,lower:e=>"string"==typeof e?e.toLowerCase():e,trim:e=>"string"==typeof e?e.trim():e,capitalize:e=>"string"==typeof e&&e.length>0?e[0].toUpperCase()+e.slice(1).toLowerCase():e,title:e=>"string"==typeof e?e.replace(/\b\w/g,e=>e.toUpperCase()):e,camelize:e=>"string"==typeof e?e.replace(/[-_]+(.)?/g,(e,t)=>t?t.toUpperCase():""):e,kebab:e=>"string"==typeof e?e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase():e,snake:e=>"string"==typeof e?e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase():e,ltrim:e=>"string"==typeof e?e.trimStart():e,rtrim:e=>"string"==typeof e?e.trimEnd():e,pad:(e,t)=>{if("string"!=typeof e)return e;let n=Number(t[0])||0,r=t.length>1?Mo(t[1]):" ";if(""===r)return e;let i=n-e.length;if(i<=0)return e;let a=Math.ceil(i/r.length);return r.repeat(a).slice(0,i)+e},padRight:(e,t)=>{if("string"!=typeof e)return e;let n=Number(t[0])||0,r=t.length>1?Mo(t[1]):" ";if(""===r)return e;let i=n-e.length;if(i<=0)return e;let a=Math.ceil(i/r.length);return e+r.repeat(a).slice(0,i)},number:(e,t)=>{if("number"==typeof e){let n=Number(t[0])||0;return e.toFixed(n)}if("string"!=typeof e)return e;let n=e.match(/-?\d+(?:\.\d+)?/);return n?Number(n[0]):0},replace:(e,t)=>"string"!=typeof e||0===t.length?e:e.split(Mo(t[0])).join(Mo(t[1])),slice:(e,t)=>{if(0===t.length)return e;let n=Number(t[0])||0,r=t.length>1&&Number.isFinite(Number(t[1]))?n+Number(t[1]):void 0;return"string"==typeof e||Array.isArray(e)?e.slice(n,r):e},split:(e,t)=>"string"==typeof e&&t.length>0?e.split(Mo(t[0])):e,join:(e,t)=>Array.isArray(e)?e.join(0===t.length?"":Mo(t[0])):e,reverse:e=>"string"==typeof e?e.split("").reverse().join(""):Array.isArray(e)?[...e].reverse():e,length:e=>"string"==typeof e||Array.isArray(e)?e.length:"number"==typeof e?Mo(e).length:"object"==typeof e&&e?Object.keys(e).length:0,first:e=>"string"==typeof e?e.length>0?e[0]:"":Array.isArray(e)?e.length>0?e[0]:void 0:e,last:e=>"string"==typeof e?e.length>0?e[e.length-1]:"":Array.isArray(e)?e.length>0?e[e.length-1]:void 0:e,contains:(e,t)=>{if(0===t.length)return!1;let n=t[0];return"string"==typeof e?e.includes(Mo(n)):!!Array.isArray(e)&&e.includes(n)},startswith:(e,t)=>"string"==typeof e&&t.length>0&&e.startsWith(Mo(t[0])),endswith:(e,t)=>"string"==typeof e&&t.length>0&&e.endsWith(Mo(t[0])),number_format:(e,t)=>{if("number"!=typeof e)return e;let n=Number(t[0])||0,r=null==t[1]?".":Mo(t[1]),i=null==t[2]?"":Mo(t[2]),a=e.toFixed(n);if(""===i)return a.replace(".",r);let o=a.split(".");return o[0]=o[0].replace(/\B(?=(\d{3})+(?!\d))/g,i),o.join(r)},sort:(e,t)=>{if(!Array.isArray(e))return e;let n=[...e],r=t[0];if("function"==typeof r){let e=r;return(e[To]??1)>=2?n.sort((t,n)=>Number(e(t,n))):n.sort((t,n)=>Po(e(t),e(n)))}return n.sort(Po)},batch:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=Number(t[0]);if(n<=0)return e;let r=[];for(let i=0;i<e.length;i+=n)r.push(e.slice(i,i+n));return r},map:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=t[0];return"function"==typeof n?e.map((e,t)=>n(e,t)):e},reduce:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=t[0];if("function"!=typeof n)return e;let r=t[1],i=+(void 0===r),a=void 0===r?e[0]:r;for(let o=i;o<e.length;o++)a=n(a,e[o],o);return a},merge:(e,t)=>{if(0===t.length)return e;let n=t[0];return Array.isArray(e)&&Array.isArray(n)?[...e,...n]:"object"==typeof e&&e&&"object"==typeof n&&n&&!Array.isArray(n)?{...e,...n}:e},keys:e=>"object"==typeof e&&e&&!Array.isArray(e)?Object.keys(e):e,values:e=>"object"==typeof e&&e&&!Array.isArray(e)?Object.values(e):e,filter:(e,t)=>{if(!Array.isArray(e))return e;if(0===t.length)return e.filter(Boolean);let n=t[0];if("function"==typeof n)return e.filter((e,t)=>n(e,t));let r=Mo(n);return e.filter(e=>{if("object"==typeof e&&e){let t=e[r];return null!=t&&!1!==t&&""!==t}return!!e})},column:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=Mo(t[0]);return e.map(e=>"object"==typeof e&&e?e[n]:void 0)},url_encode:e=>"string"==typeof e?encodeURIComponent(e):"object"==typeof e&&e&&!Array.isArray(e)?new URLSearchParams(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Mo(t)]))).toString():e,nl2br:e=>"string"==typeof e?e.replace(/\n/g,"<br>"):e,striptags:(e,t)=>{if("string"!=typeof e)return e;let n=t.length>0?Mo(t[0]).trim():"";if(n){let t=n.split(/(?:\s*>\s*<\s*|<\s*|>\s*)/).filter(Boolean).map(e=>e.replace(/[/>]/g,"").trim());if(t.length>0){let n=RegExp(`<(?!/?(?:${t.join("|")})\\b)[^>]+>`,"gi");return e.replace(n,"").replace(/\s+/g," ").trim()}}return e.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim()},abs:e=>"number"==typeof e?Math.abs(e):e,round:(e,t)=>{if("number"!=typeof e)return e;let n=Number(t[0])||0,r=null==t[1]?"common":Mo(t[1]),i=10**n;return"ceil"===r?Math.ceil(e*i)/i:"floor"===r?Math.floor(e*i)/i:Math.round(e*i)/i},format:(e,t)=>{if("string"!=typeof e)return e;let n=0;return e.replace(/%s|%d|%f|%%/g,e=>{if("%%"===e)return"%";let r=t[n];return n++,void 0===r?e:"%d"===e?String(Math.floor(Number(r))):"%f"===e?String(Number(r)):Mo(r)})},spaceless:e=>"string"==typeof e?e.replace(/>\s+</g,"><").trim():e,random:e=>Array.isArray(e)?e.length>0?e[Math.floor(Math.random()*e.length)]:void 0:"string"==typeof e?e.length>0?e[Math.floor(Math.random()*e.length)]:"":"number"==typeof e?Math.floor(Math.random()*e):e,date:(e,t)=>{if(0===t.length)return e;let n=Mo(t[0]),r=e instanceof Date?e:new Date(String(e));if(Number.isNaN(r.getTime()))return"";let i=e=>String(e).padStart(2,"0"),a={Y:String(r.getFullYear()),m:i(r.getMonth()+1),d:i(r.getDate()),H:i(r.getHours()),i:i(r.getMinutes()),s:i(r.getSeconds()),l:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],F:["January","February","March","April","May","June","July","August","September","October","November","December"][r.getMonth()],M:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getMonth()]},o="";for(let s of n)o+=Object.prototype.hasOwnProperty.call(a,s)?a[s]:s;return o},base64_encode:e=>"string"==typeof e?(e=>{let t=(new TextEncoder).encode(e),n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)})(e):e,base64_decode:e=>"string"==typeof e?(e=>{let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return(new TextDecoder).decode(n)})(e):e,md5:e=>"string"==typeof e?(e=>{let t=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],n=/* @__PURE__ */new Uint32Array(64);for(let p=0;p<64;p++)n[p]=Math.floor(4294967296*Math.abs(Math.sin(p+1)));let r=(new TextEncoder).encode(e),i=8*r.length,a=1+(r.length+8>>6)<<6,o=new Uint8Array(a);o.set(r),o[r.length]=128;let s=new DataView(o.buffer);s.setUint32(a-8,i>>>0,!0),s.setUint32(a-4,Math.floor(i/4294967296)>>>0,!0);let l=1732584193,c=4023233417,d=2562383102,u=271733878,h=(e,t)=>e<<t|e>>>32-t;for(let p=0;p<a;p+=64){let e=/* @__PURE__ */new Uint32Array(16);for(let t=0;t<16;t++)e[t]=s.getUint32(p+4*t,!0);let r=l,i=c,a=d,o=u;for(let s=0;s<64;s++){let l,c;s<16?(l=i&a|~i&o,c=s):s<32?(l=o&i|~o&a,c=(5*s+1)%16):s<48?(l=i^a^o,c=(3*s+5)%16):(l=a^(i|~o),c=7*s%16),l=l+r+n[s]+e[c]|0,r=o,o=a,a=i,i=i+h(l,t[s])|0}l=l+r|0,c=c+i|0,d=d+a|0,u=u+o|0}let f=e=>{let t="";for(let n=0;n<4;n++)t+=(e>>>8*n&255).toString(16).padStart(2,"0");return t};return f(l)+f(c)+f(d)+f(u)})(e):e,without:(e,t)=>{if("object"!=typeof e||!e||Array.isArray(e))return e;let n=t.map(Mo),r={};for(let[i,a]of Object.entries(e))n.includes(i)||(r[i]=a);return r},only:(e,t)=>{if("object"!=typeof e||!e||Array.isArray(e))return e;let n=t.map(Mo),r={};for(let[i,a]of Object.entries(e))n.includes(i)&&(r[i]=a);return r},find:(e,t)=>{if(!Array.isArray(e)||0===t.length)return;let n=t[0];if("function"==typeof n)return e.find((e,t)=>n(e,t));if(t.length<2)return;let r=Mo(n),i=t[1];return e.find(e=>"object"==typeof e&&e?e[r]===i:e===i)},pluck:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=Mo(t[0]);return e.map(e=>"object"==typeof e&&e?e[n]:void 0)},unique:e=>Array.isArray(e)?[...new Set(e)]:e,flatten:e=>Array.isArray(e)?e.flat():e,sum:e=>Array.isArray(e)?e.reduce((e,t)=>e+("number"==typeof t?t:0),0):e,chunk:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=Number(t[0]);if(n<=0)return e;let r=[];for(let i=0;i<e.length;i+=n)r.push(e.slice(i,i+n));return r},index_by:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=Mo(t[0]),r={};for(let i of e)"object"==typeof i&&i&&(r[String(i[n]??"")]=i);return r},group_by:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let n=Mo(t[0]),r={};for(let i of e)if("object"==typeof i&&i){let e=String(i[n]??"");r[e]=r[e]??[],r[e].push(i)}return r}},Lo=e=>!(null==e||!1===e||""===e||0===e||Array.isArray(e)&&0===e.length),Vo=(e,t)=>"string"==typeof t?t.includes(String(e)):Array.isArray(t)?t.includes(e):!("object"!=typeof t||!t)&&String(e)in t,Qo=[],jo=class e{variables;keepEmptyTokens;breakFlag=!1;continueFlag=!1;hasSet=!1;constructor(e,t=!1){this.variables={...e},this.keepEmptyTokens=t}evalNodes(e){let t=e.length;if(0===t)return"";if(1===t)return this.evalNode(e[0]);let n="";for(let r=0;r<t&&(n+=this.evalNode(e[r]),!this.breakFlag&&!this.continueFlag);r++);return n}evalNode(e){switch(e.type){case"text":return e.value;case"variable":return this.evalVariable(e);case"if":return this.evalIf(e);case"for":return this.evalFor(e);case"set":return this.evalSet(e);case"apply":return this.evalApply(e);case"break":return this.breakFlag=!0,"";case"continue":return this.continueFlag=!0,""}}evalVariable(e){let t=this.evalExpression(e.expression);return!this.keepEmptyTokens||null!=t&&""!==t?Io(t)?String(Ro(t)):"function"==typeof t?"":null!=t&&"object"!=typeof t?String(t):e.raw?null==t?"":String(t):"object"==typeof t&&t?JSON.stringify(t):"":e.source}evalIf(e){if(Lo(this.evalExpression(e.condition)))return this.evalNodes(e.body);for(let t of e.elseifClauses)if(Lo(this.evalExpression(t.condition)))return this.evalNodes(t.body);return e.elseBody?this.evalNodes(e.elseBody):""}evalFor(e){let t=this.evalExpression(e.collection);if(void 0!==e.source&&void 0===t)return e.source;let n,r=null;if(null!==e.keyVar){let i=(e=>"object"==typeof e&&e&&!Array.isArray(e)?Object.entries(e):null)(t);if(!i||0===i.length)return e.elseBody?this.evalNodes(e.elseBody):"";let a=i.length;r=Array(a),n=Array(a);for(let e=0;e<a;e++)r[e]=i[e][0],n[e]=i[e][1]}else{let r=(e=>Array.isArray(e)?e:"object"==typeof e&&e?Object.values(e):null)(t);if(!r||0===r.length)return e.elseBody?this.evalNodes(e.elseBody):"";n=r}return this.runLoop(e,n,r)}runLoop(e,t,n){let{valueVar:r,keyVar:i,body:a}=e,o=t.length,s=this.variables.loop,l={index:0,index0:0,first:!1,last:!1,length:o,revindex:0};this.variables.loop=l;let c="";for(let d=0;d<o;d++){if(l.index=d+1,l.index0=d,l.first=0===d,l.last=d===o-1,l.revindex=o-d,null!==n&&null!==i&&(this.variables[i]=n[d]),this.variables[r]=t[d],c+=this.evalNodes(a),this.breakFlag){this.breakFlag=!1;break}this.continueFlag&&=!1}return void 0===s?delete this.variables.loop:this.variables.loop=s,c}evalSet(e){return this.hasSet=!0,this.variables[e.name]=Array.isArray(e.value)?this.evalNodes(e.value):this.evalExpression(e.value),""}evalApply(e){let t=this.applyFilters(this.evalNodes(e.body),e.filters);return Io(t)?String(Ro(t)):"object"==typeof t&&t?JSON.stringify(t):null==t?"":String(t)}applyFilters(e,t){let n=e;for(let r of t){let e=Do[r.name];void 0!==e&&(n=e(n,0===r.args.length?Qo:this.evalArgs(r.args)))}return n}evalArgs(e){let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=this.evalExpression(e[r]);return n}evalExpression(e){switch(e.type){case"literal":return e.value;case"array":{let t=e.elements,n=Array(t.length);for(let e=0;e<t.length;e++)n[e]=this.evalExpression(t[e]);return n}case"object":{let t={};for(let n of e.entries){let e=this.evalExpression(n.key);t["string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):""]=this.evalExpression(n.value)}return t}case"range":return this.evalRange(e.start,e.end);case"path":return this.resolvePath(e.segments);case"function":return this.evalFunction(e.name,e.args);case"filter":return this.applyFilters(this.evalExpression(e.subject),e.filters);case"concat":{let t=e.parts,n=t.length,r="";for(let e=0;e<n;e++){let n=this.evalExpression(t[e]);r+=null==n?"":String(n)}return r}case"unary":return"-"===e.operator?-Number(this.evalExpression(e.operand)):!Lo(this.evalExpression(e.operand));case"binary":return this.evalBinary(e.operator,e.left,e.right);case"default":return this.evalExpression(e.value)??this.evalExpression(e.defaultExpr);case"ternary":return Lo(this.evalExpression(e.condition))?this.evalExpression(e.trueExpr):this.evalExpression(e.falseExpr);case"arrow":return this.createArrowFunction(e.params,e.body)}}createArrowFunction(t,n){let r={...this.variables},i=this.keepEmptyTokens,a=(...a)=>{let o=new e(r,i);for(let e=0;e<t.length;e++)o.variables[t[e]]=a[e];return o.evalExpression(n)};return a[To]=t.length,a}resolvePath(e){let t=e.length;if(0===t)return;let n=this.variables[e[0]];for(let r=1;r<t;r++){if(null==n)return;n=n[e[r]]}return n}evalRange(e,t){let n=Number(this.evalExpression(e)),r=Number(this.evalExpression(t)),i=n<=r,a=1+(i?r-n:n-r),o=Array(a);for(let s=0;s<a;s++)o[s]=i?n+s:n-s;return o}evalFunction(e,t){let n=this.evalArgs(t);switch(e){case"cycle":{let e=n[0],t=n[1];return Array.isArray(e)&&"number"==typeof t?e[t%e.length]:""}case"max":return this.minMax(n,Math.max);case"min":return this.minMax(n,Math.min);case"range":return this.rangeFunction(n);default:return""}}minMax(e,t){return 0===e.length?void 0:t(...1===e.length&&Array.isArray(e[0])?e[0]:e)}rangeFunction(e){if(0===e.length)return[];if(1===e.length){let t=Number(e[0]),n=Array(t+1);for(let e=0;e<=t;e++)n[e]=e;return n}let t=Number(e[0]),n=Number(e[1]),r=e.length>2?Number(e[2]):t<=n?1:-1;if(0===r)return[];let i=Math.floor((r>0?n-t:t-n)/Math.abs(r))+1;if(i<=0)return[];let a=Array(i);for(let o=0;o<i;o++)a[o]=t+o*r;return a}evalBinary(e,t,n){if("or"===e)return Lo(this.evalExpression(t))||Lo(this.evalExpression(n));if("and"===e)return Lo(this.evalExpression(t))&&Lo(this.evalExpression(n));let r=this.evalExpression(t),i=this.evalExpression(n),a="number"==typeof r&&"number"==typeof i;switch(e){case"+":return a?r+i:Number(r)+Number(i);case"-":return a?r-i:Number(r)-Number(i);case"*":return a?r*i:Number(r)*Number(i);case"/":return a?r/i:Number(r)/Number(i);case"%":return a?r%i:Number(r)%Number(i);case"==":return r===i||String(r)===String(i);case"!=":return r!==i&&String(r)!==String(i);case">":return a?r>i:Number(r)>Number(i);case"<":return a?r<i:Number(r)<Number(i);case">=":return a?r>=i:Number(r)>=Number(i);case"<=":return a?r<=i:Number(r)<=Number(i);case"in":return Vo(r,i);case"not in":return!Vo(r,i);case"is":return r===i;case"is not":return r!==i;default:return!1}}},Fo=(e,t)=>e[t],Bo=(e,t)=>{let n=t.indexOf(".");if(-1===n)return e[t];let r=e[t.slice(0,n)],i=n+1,a=t.length;for(;i<a;){if(null==r)return;let e=t.indexOf(".",i);if(-1===e)return r[t.slice(i)];r=r[t.slice(i,e)],i=e+1}return r},qo=e=>null==e?"":"object"==typeof e?JSON.stringify(e):String(e),Zo=e=>{try{return JSON.parse(e)||e}catch{return e}},Uo=41,Wo=e=>e>=97&&e<=122||e>=65&&e<=90||95===e,Xo=e=>Wo(e)||e>=48&&e<=57,Ho=e=>Xo(e)||45===e,Yo=e=>e>=48&&e<=57,_o=e=>32===e||9===e||10===e||13===e,Go=e=>{let t=e.length;if(0===t||!Wo(e.charCodeAt(0)))return!1;for(let n=1;n<t;n++)if(!Xo(e.charCodeAt(n)))return!1;return!0},Ko=e=>{let t=e.length;if(0===t)return!1;let n=!0;for(let r=0;r<t;r++){let t=e.charCodeAt(r);if(46===t){if(n)return!1;n=!0}else{if(n&&!Wo(t)||!n&&!Xo(t))return!1;n=!1}}return!n},Jo=e=>Go(e),$o=(e,t)=>t?`{{{${e}}}}`:`{{${e}}}`,es=e=>{switch(e.type){case"text":return e.value;case"variable":return $o(e.content,e.raw);case"tag":return`{%${e.content}%}`}},ts=class{src;pos=0;constructor(e){this.src=e}eof(){return this.pos>=this.src.length}peek(){return this.pos<this.src.length?this.src.charCodeAt(this.pos):-1}at(e){let t=this.pos+e;return t<this.src.length?this.src.charCodeAt(t):-1}skipWs(){for(;this.pos<this.src.length&&_o(this.src.charCodeAt(this.pos));)this.pos++}scanName(){let e=this.pos;if(!this.eof()&&Wo(this.src.charCodeAt(this.pos)))for(this.pos++;!this.eof()&&Ho(this.src.charCodeAt(this.pos));)this.pos++;return this.src.slice(e,this.pos)}scanStringLiteral(){let e=this.src.charCodeAt(this.pos);this.pos++;let t="";for(;this.pos<this.src.length&&this.src.charCodeAt(this.pos)!==e;)if(92===this.src.charCodeAt(this.pos)&&this.pos+1<this.src.length){this.pos++;let n=this.src.charCodeAt(this.pos);t+=110===n?"\n":116===n?"\t":114===n?"\r":92===n?"\\":n===e?String.fromCharCode(n):String.fromCharCode(92)+String.fromCharCode(n),this.pos++}else t+=this.src[this.pos],this.pos++;return this.pos<this.src.length&&this.pos++,t}scanNumber(){let e=this.pos;for(45===this.src.charCodeAt(this.pos)&&this.pos++;this.pos<this.src.length&&Yo(this.src.charCodeAt(this.pos));)this.pos++;if(46===this.src.charCodeAt(this.pos))for(this.pos++;this.pos<this.src.length&&Yo(this.src.charCodeAt(this.pos));)this.pos++;return Number(this.src.slice(e,this.pos))}matchKeyword(e){let t=this.pos+e.length;if(t>this.src.length)return!1;for(let n=0;n<e.length;n++)if(this.src.charCodeAt(this.pos+n)!==e.charCodeAt(n))return!1;return!(t<this.src.length&&Xo(this.src.charCodeAt(t))||(this.pos=t,this.skipWs(),0))}matchBinaryOp(){this.skipWs();let e=this.peek();if(61===this.at(1)){if(61===e)return this.pos+=2,"==";if(33===e)return this.pos+=2,"!=";if(62===e)return this.pos+=2,">=";if(60===e)return this.pos+=2,"<="}return 62===e?(this.pos++,">"):60===e?(this.pos++,"<"):null}},ns=e=>new rs(e).parseTernary(),rs=class extends ts{parseTernary(){let e=this.parseOr();if(this.skipWs(),63===this.peek()){this.pos++,this.skipWs();let t=this.parseOr();if(this.skipWs(),58===this.peek())return this.pos++,this.skipWs(),{type:"ternary",condition:e,trueExpr:t,falseExpr:this.parseTernary()}}return e}parseOr(){let e=this.parseAnd();for(this.skipWs();this.matchKeyword("or");)e={type:"binary",operator:"or",left:e,right:this.parseAnd()},this.skipWs();return e}parseAnd(){let e=this.parseNot();for(this.skipWs();this.matchKeyword("and");)e={type:"binary",operator:"and",left:e,right:this.parseNot()},this.skipWs();return e}parseNot(){return this.skipWs(),this.matchKeyword("not")?{type:"unary",operator:"not",operand:this.parseComparison()}:this.parseComparison()}parseComparison(){let e=this.parseConcat();for(this.skipWs();!this.eof();){if(this.matchKeyword("is")){this.skipWs(),e={type:"binary",operator:this.matchKeyword("not")?"is not":"is",left:e,right:this.parseConcat()},this.skipWs();continue}if(this.matchKeyword("not")){if(this.skipWs(),this.matchKeyword("in")){e={type:"binary",operator:"not in",left:e,right:this.parseConcat()},this.skipWs();continue}let t=this.src.slice(this.pos-4);return this.pos=this.src.length,{type:"unary",operator:"not",operand:ns(t)}}if(this.matchKeyword("in")){e={type:"binary",operator:"in",left:e,right:this.parseConcat()},this.skipWs();continue}let t=this.matchBinaryOp();if(!t)break;e={type:"binary",operator:t,left:e,right:this.parseConcat()},this.skipWs()}return e}parseConcat(){let e=this.parseAdditive();for(this.skipWs();126===this.peek();){this.pos++;let t=this.parseAdditive();e="concat"===e.type?{type:"concat",parts:[...e.parts,t]}:{type:"concat",parts:[e,t]},this.skipWs()}return e}parseAdditive(){let e=this.parseMultiplicative();this.skipWs();for(let t=this.peek();43===t||45===t;t=this.peek())this.pos++,e={type:"binary",operator:43===t?"+":"-",left:e,right:this.parseMultiplicative()},this.skipWs();return e}parseMultiplicative(){let e=this.parseDefault();this.skipWs();for(let t=this.peek();42===t||47===t||37===t;t=this.peek())this.pos++,e={type:"binary",operator:42===t?"*":47===t?"/":"%",left:e,right:this.parseDefault()},this.skipWs();return e}parseDefault(){if(this.skipWs(),45===this.peek()&&Yo(this.at(1)))return this.maybeTrailingFilters({type:"literal",value:this.scanNumber()});if(45===this.peek())return this.pos++,{type:"unary",operator:"-",operand:this.parseDefault()};let e=this.parseAtom();for(this.skipWs();63===this.peek()&&63===this.at(1);)this.pos+=2,this.skipWs(),e={type:"default",value:e,defaultExpr:this.parseAtom()},this.skipWs();return e}parseAtom(){this.skipWs();let e=this.peek();if(40===e){this.pos++,this.skipWs();let e=this.pos,t=this.tryParseArrowParams();if(null!==t)return this.maybeTrailingFilters({type:"arrow",params:t,body:this.parseTernary()});this.pos=e;let n=this.parseTernary();return this.skipWs(),this.peek()===Uo&&this.pos++,this.maybeTrailingFilters(n)}return 39===e||34===e?this.maybeTrailingFilters({type:"literal",value:this.scanStringLiteral()}):Yo(e)?this.maybeTrailingFilters({type:"literal",value:this.scanNumber()}):91===e?(this.pos++,this.maybeTrailingFilters({type:"array",elements:this.parseArgList(93)})):123===e?(this.pos++,this.maybeTrailingFilters(this.parseObjectLiteral())):this.parsePathOrFunctionOrArrow()}tryParseArrowParams(){let e=this.pos,t=[];for(this.skipWs();this.peek()!==Uo;){let n=this.scanName();if(!n)return this.pos=e,null;if(t.push(n),this.skipWs(),44!==this.peek())break;this.pos++,this.skipWs()}return this.skipWs(),this.peek()===Uo&&(this.pos++,this.skipWs(),61===this.peek()&&62===this.at(1))?(this.pos+=2,t):(this.pos=e,null)}parsePathOrFunctionOrArrow(){let e=this.scanName();if(!e)return this.pos++,{type:"literal",value:""};if("true"===e||"false"===e)return this.maybeTrailingFilters({type:"literal",value:"true"===e});if(this.skipWs(),61===this.peek()&&62===this.at(1))return this.pos+=2,this.maybeTrailingFilters({type:"arrow",params:[e],body:this.parseTernary()});if(40===this.peek()){this.pos++;let t=this.parseArgList(Uo);return this.maybeTrailingFilters({type:"function",name:e,args:t})}let t=[e];for(;46===this.peek();){this.pos++;let e=this.scanName();e&&t.push(e)}return this.maybeTrailingFilters({type:"path",segments:t})}maybeTrailingFilters(e){return this.skipWs(),124===this.peek()?{type:"filter",subject:e,filters:this.parseTrailingFilters()}:e}parseObjectLiteral(){let e=[];for(this.skipWs();!this.eof()&&125!==this.peek();){let t=this.parseObjectKey();this.skipWs(),58===this.peek()&&this.pos++,this.skipWs(),e.push({key:t,value:this.parseTernary()}),this.skipWs(),44===this.peek()&&(this.pos++,this.skipWs())}return 125===this.peek()&&this.pos++,{type:"object",entries:e}}parseObjectKey(){let e=this.peek();if(39===e||34===e)return{type:"literal",value:this.scanStringLiteral()};if(Yo(e))return{type:"literal",value:this.scanNumber()};if(40===e){this.pos++,this.skipWs();let e=this.parseTernary();return this.skipWs(),this.peek()===Uo&&this.pos++,e}return{type:"literal",value:this.scanName()}}parseArgList(e){let t=[];for(this.skipWs();!this.eof()&&this.peek()!==e;)t.push(this.parseTernary()),this.skipWs(),44===this.peek()&&(this.pos++,this.skipWs());return this.peek()===e&&this.pos++,t}parseTrailingFilters(){let e=[];for(;124===this.peek();)this.pos++,this.skipWs(),e.push(this.readFilter()),this.skipWs();return e}parseApplyChain(){this.skipWs();let e=[this.readFilter()];for(this.skipWs();124===this.peek();)this.pos++,this.skipWs(),e.push(this.readFilter()),this.skipWs();return e}readFilter(){let e=this.scanName();return this.skipWs(),40===this.peek()?(this.pos++,{name:e,args:this.parseArgList(Uo)}):{name:e,args:[]}}},is=e=>{let t=0;for(;t<e.length&&!_o(e.charCodeAt(t));)t++;return e.slice(0,t)},as=(e,t=!1)=>{let n=new ss(e,t),r=n.parseBody();if(!n.error){let e=n.peek();if(e&&"tag"===e.type){let t=is(e.content.trim());os.has(t)&&(n.error=`Orphan closing tag: {% ${t} %} without matching opening tag`)}}return{nodes:r,error:n.error}},os=/* @__PURE__ */new Set(["endif","endfor","endset","endapply","else","elseif"]),ss=class{tokens;keepEmptyTokens;pos=0;error=null;constructor(e,t=!1){this.tokens=e,this.keepEmptyTokens=t}peek(){return this.tokens[this.pos]}advance(){let e=this.tokens[this.pos];return e&&this.pos++,e}isTag(e){let t=this.peek();if(!t||"tag"!==t.type)return!1;let n=t.content.trim();return n===e||n.startsWith(e+" ")||n.startsWith(e+"\t")}parseBody(){let e=[];for(;this.pos<this.tokens.length;){let t=this.peek();if(!t||"tag"===t.type&&os.has(is(t.content.trim())))break;let n=this.parseNode();n&&e.push(n)}return e}parseNode(){let e=this.peek();return e?"text"===e.type?(this.advance(),{type:"text",value:e.value}):"variable"===e.type?this.parseVariable():this.parseTag():null}parseVariable(){let e=this.advance();if(!e||"variable"!==e.type)return{type:"variable",raw:!1,expression:{type:"literal",value:""},source:""};let t=e.content.trim(),n=this.keepEmptyTokens?$o(e.content,e.raw):"";if(Go(t))return{type:"variable",raw:e.raw,expression:{type:"path",segments:[t]},source:n};let r=ns(t);return{type:"variable",raw:e.raw,expression:r,source:n}}parseTag(){let e=this.peek();if(!e||"tag"!==e.type)return null;switch(is(e.content.trim())){case"if":return this.parseIf();case"for":return this.parseFor();case"set":return this.parseSet();case"apply":return this.parseApply();case"break":return this.advance(),{type:"break"};case"continue":return this.advance(),{type:"continue"};default:return this.advance(),null}}parseIf(){this.advance();let e=this.tokens[this.pos-1];if("tag"!==e.type)return this.error="Malformed {% if %} tag",{type:"if",condition:{type:"literal",value:!1},body:[],elseifClauses:[],elseBody:null};let t=e.content.trim(),n=-1===t.indexOf(" ")?"":t.slice(t.indexOf(" ")+1).trim();if(!n)return this.error="Malformed {% if %} tag: missing condition",{type:"if",condition:{type:"literal",value:!1},body:[],elseifClauses:[],elseBody:null};let r=ns(n),i=this.parseBody(),a=[],o=null,s=!1;for(;this.peek();){let e=this.peek();if(!e||"tag"!==e.type)break;let t=is(e.content.trim());if("elseif"===t){this.advance();let t=e.content.trim(),n=ns(t.slice(t.indexOf(" ")+1).trim()),r=this.parseBody();a.push({condition:n,body:r})}else{if("else"!==t){if("endif"===t){this.advance(),s=!0;break}break}this.advance(),o=this.parseBody()}}return s||(this.error="Malformed {% if %} block: missing {% endif %}"),{type:"if",condition:r,body:i,elseifClauses:a,elseBody:o}}parseFor(){let e=this.pos;this.advance();let t=this.tokens[this.pos-1];if("tag"!==t.type)return{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};let n=t.content.trim(),r=n.slice(n.indexOf(" ")+1).trim(),i=/\sin\s/.exec(r);if(!i)return this.error="Invalid {% for %} syntax: missing the `in` keyword",{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};let a=r.slice(0,i.index).trim(),o=r.slice(i.index+i[0].length).trim(),s=(e=>{let t=0;for(let n=0;n+1<e.length;n++){let r=e.charCodeAt(n);if(0!==t)r===t&&(t=0);else if(39===r||34===r)t=r;else if(46===r&&46===e.charCodeAt(n+1))return[e.slice(0,n).trim(),e.slice(n+2).trim()]}return null})(o),l=s?{type:"range",start:ns(s[0]),end:ns(s[1])}:ns(o),c=a.indexOf(","),d=-1===c?null:a.slice(0,c).trim(),u=-1===c?a:a.slice(c+1).trim();if(!Jo(u))return this.error=`Invalid {% for %} variable name: "${u}"`,{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};if(null!==d&&!Jo(d))return this.error=`Invalid {% for %} key variable name: "${d}"`,{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};let h=this.parseBody(),f=null;if(this.peek()){let e=this.peek();e&&"tag"===e.type&&"else"===is(e.content.trim())&&(this.advance(),f=this.parseBody())}let p=this.peek();return p&&"tag"===p.type&&"endfor"===is(p.content.trim())?this.advance():this.error="Malformed {% for %} block: missing {% endfor %}",{type:"for",valueVar:u,keyVar:d,collection:l,body:h,elseBody:f,source:this.keepEmptyTokens?this.reconstructRange(e,this.pos):void 0}}reconstructRange(e,t){let n="";for(let r=e;r<t;r++)n+=es(this.tokens[r]);return n}parseSet(){this.advance();let e=this.tokens[this.pos-1];if("tag"!==e.type)return{type:"set",name:"_unknown",value:{type:"literal",value:""}};let t=e.content.trim(),n=t.slice(t.indexOf(" ")+1).trim(),r=n.indexOf("=");if(-1===r){let e=n.trim(),t=this.parseBody(),r=this.peek();return r&&"tag"===r.type&&this.advance(),{type:"set",name:e,value:t}}return{type:"set",name:n.slice(0,r).trim(),value:ns(n.slice(r+1).trim())}}parseApply(){this.advance();let e=this.tokens[this.pos-1];if("tag"!==e.type)return{type:"apply",filters:[],body:[]};let t=e.content.trim(),n=(e=>new rs(e).parseApplyChain())(t.slice(t.indexOf(" ")+1).trim()),r=this.parseBody(),i=this.peek();return i&&"tag"===i.type&&this.advance(),{type:"apply",filters:n,body:r}}},ls=/* @__PURE__ */new Map,cs={hits:0,misses:0},ds=e=>{let t=ls.get(e);if(t)return cs.hits++,t;cs.misses++;let n=(e=>{let t=(e=>{let t=[],n=0;for(;n<e.length;){let r,i,a=e.indexOf("{{",n),o=e.indexOf("{%",n);if(-1===a&&-1===o)break;if(-1===a?(r=o,i=!0):-1===o||a<o?(r=a,i=!1):(r=o,i=!0),r>n&&t.push({type:"text",value:e.slice(n,r)}),i||123!==e.charCodeAt(r+2))if(i){let i=e.indexOf("%}",r+2);if(-1===i)return{tokens:t,error:"Unclosed tag"};t.push({type:"tag",content:e.slice(r+2,i)}),n=i+2}else{let i=e.indexOf("}}",r+2);if(-1===i)return{tokens:t,error:"Unclosed double-brace token"};t.push({type:"variable",content:e.slice(r+2,i),raw:!1}),n=i+2}else{let i=e.indexOf("}}}",r+3);if(-1===i)return{tokens:t,error:"Unclosed triple-brace token"};t.push({type:"variable",content:e.slice(r+3,i),raw:!0}),n=i+3}}return n<e.length&&t.push({type:"text",value:e.slice(n)}),{tokens:t,error:null}})(e);if(t.error)return null;let n=t.tokens,{hasTags:r,allSimpleOrDotted:i}=(e=>{let t=!1,n=!0;for(let r=0;r<e.length;r++){let i=e[r];if("tag"===i.type){t=!0;break}if("variable"===i.type&&!Ko(i.content.trim())){n=!1;break}}return{hasTags:t,allSimpleOrDotted:n}})(n),a=null,o=null;if(r||!i){let e=as(n,!1);if(e.error)return null;a=e.nodes;let t=as(n,!0);t.error||(o=t.nodes)}else{let e=as(n,!0);e.error||(o=e.nodes)}return{tokens:n,hasTags:r,allSimpleOrDotted:i,nodes:a,nodesWithSource:o}})(e);return n?((()=>{if(ls.size>=256){let e=ls.keys().next().value;void 0!==e&&ls.delete(e)}})(),ls.set(e,n),n):null},us=(e,t={},n=!1,r=!1)=>{if("string"!=typeof e)return e;try{if(-1===e.indexOf("{%")&&-1===e.indexOf("{{"))return e;let i="variables"in t?(e=>{let t={},n=e.variables;for(let r in n)t[r]=n[r];for(let r in e)t[r]=e[r];return t})(t):t,a=ds(e);if(!a)return e;if(!n&&!a.hasTags&&a.allSimpleOrDotted){let e=((e,t)=>{let n="";for(let r of e.tokens)if("text"===r.type)n+=r.value;else if("variable"===r.type){let e=r.content.trim(),i=-1===r.content.indexOf(".")?Fo(t,e):Bo(t,e);n+=r.raw?null==i?"":String(i):qo(i)}return n})(a,i);return r?Zo(e):e}let o=((e,t)=>t?e.nodesWithSource:e.nodes)(a,n);if(!o)return e;let{output:s,variables:l,hasSet:c}=((e,t,n=!1)=>{let r=new jo(t,n);return{output:r.evalNodes(e),variables:r.variables,hasSet:r.hasSet}})(o,i,n);return c&&Object.assign(t,l),n&&s===e?e:r?Zo(s):s}catch{return e}},hs="[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*",fs=`${hs}(?:\\??\\.${hs})*(?:\\s*\\?\\?\\s*[^|{}]+?)?(?:\\s*\\|\\s*[a-zA-Z_]+(?:\\([^)]*\\))?)*`,ps=`(?:\\{\\{\\{\\s*${fs}\\s*\\}\\}\\}|\\{\\{\\s*${fs}\\s*\\}\\})`,ms=new RegExp(ps,"g"),gs=RegExp(`^${ps}$`),vs=(e,t=!1)=>{if("string"!=typeof e)return!1;let n=t?gs:ms;return n.lastIndex=0,n.test(e.trim())},bs=()=>{if(typeof window>"u")return;let e=()=>{},t=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;"object"==typeof t&&Object.keys(t).forEach(n=>{let r=t[n];t[n]="function"==typeof r?e:null})};function ys(e){return xs(e,[])}function xs(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:xs(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";const n=Math.min(10,e.length),r=e.length-n,i=[];for(let a=0;a<n;++a)i.push(xs(e[a],t));return 1===r?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);return 0===n.length?"{}":t.length>2?"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]":"{ "+n.map(([e,n])=>e+": "+xs(n,t)).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function ws(e,t){if(!e)throw new Error(t??"Unexpected invariant triggered.")}var Os=/\r\n|[\n\r]/g;function ks(e,t){let n=0,r=1;for(const i of e.body.matchAll(Os)){if("number"!=typeof i.index&&ws(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Ss(e){return Cs(e.source,ks(e.source,e.start))}function Cs(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,a=e.locationOffset.line-1,o=t.line+a,s=1===t.line?n:0,l=t.column+s,c=`${e.name}:${o}:${l}\n`,d=r.split(/\r\n|[\n\r]/g),u=d[i];if(u.length>120){const e=Math.floor(l/80),t=l%80,n=[];for(let r=0;r<u.length;r+=80)n.push(u.slice(r,r+80));return c+zs([[`${o} |`,n[0]],...n.slice(1,e+1).map(e=>["|",e]),["|","^".padStart(t)],["|",n[e+1]]])}return c+zs([[o-1+" |",d[i-1]],[`${o} |`,u],["|","^".padStart(l)],[`${o+1} |`,d[i+1]]])}function zs(e){const t=e.filter(([e,t])=>void 0!==t),n=Math.max(...t.map(([e])=>e.length));return t.map(([e,t])=>e.padStart(n)+(t?" "+t:"")).join("\n")}var Ns=class e extends Error{constructor(t,n={}){const{nodes:r,source:i,positions:a,path:o,originalError:s,cause:l,extensions:c}=n,d="cause"in n;super(t,d||null!=s?{cause:d?l:s}:void 0),this.name="GraphQLError",this.path=o??void 0;const u=s??(l instanceof Error?l:void 0);this.originalError=u,this.nodes=Es(Array.isArray(r)?r:r?[r]:void 0);const h=Es(this.nodes?.map(e=>e.loc).filter(e=>null!=e));this.source=i??h?.[0]?.source,this.positions=a??h?.map(e=>e.start),this.locations=a&&i?a.map(e=>ks(i,e)):h?.map(e=>ks(e.source,e.start));const f=(p=u?.extensions,"object"==typeof p&&null!==p?u.extensions:void 0);var p;this.extensions=c??f??Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=s?.stack?Object.defineProperty(this,"stack",{value:s.stack,writable:!0,configurable:!0}):null!=Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const t of this.nodes)t.loc&&(e+="\n\n"+Ss(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+Cs(this.source,t);return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}};function Es(e){return void 0===e||0===e.length?void 0:e}var As=class{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},Ts=class{constructor(e,t,n,r,i,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}},Ps={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentArgument:["name","value"],FragmentSpread:["name","arguments","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:["name","directives"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},Ms=new Set(Object.keys(Ps));function Is(e){const t=e?.kind;return"string"==typeof t&&Ms.has(t)}var Rs="query",Ds="mutation",Ls="subscription",Vs=/* @__PURE__ */X({ARGUMENT:()=>Us,ARGUMENT_COORDINATE:()=>Pl,BOOLEAN:()=>$s,DIRECTIVE:()=>al,DIRECTIVE_ARGUMENT_COORDINATE:()=>Il,DIRECTIVE_COORDINATE:()=>Ml,DIRECTIVE_DEFINITION:()=>xl,DIRECTIVE_EXTENSION:()=>Ol,DOCUMENT:()=>js,ENUM:()=>tl,ENUM_TYPE_DEFINITION:()=>vl,ENUM_TYPE_EXTENSION:()=>Nl,ENUM_VALUE_DEFINITION:()=>bl,FIELD:()=>Zs,FIELD_DEFINITION:()=>fl,FLOAT:()=>Ks,FRAGMENT_ARGUMENT:()=>Ws,FRAGMENT_DEFINITION:()=>Ys,FRAGMENT_SPREAD:()=>Xs,INLINE_FRAGMENT:()=>Hs,INPUT_OBJECT_TYPE_DEFINITION:()=>yl,INPUT_OBJECT_TYPE_EXTENSION:()=>El,INPUT_VALUE_DEFINITION:()=>pl,INT:()=>Gs,INTERFACE_TYPE_DEFINITION:()=>ml,INTERFACE_TYPE_EXTENSION:()=>Cl,LIST:()=>nl,LIST_TYPE:()=>sl,MEMBER_COORDINATE:()=>Tl,NAME:()=>Qs,NAMED_TYPE:()=>ol,NON_NULL_TYPE:()=>ll,NULL:()=>el,OBJECT:()=>rl,OBJECT_FIELD:()=>il,OBJECT_TYPE_DEFINITION:()=>hl,OBJECT_TYPE_EXTENSION:()=>Sl,OPERATION_DEFINITION:()=>Fs,OPERATION_TYPE_DEFINITION:()=>dl,SCALAR_TYPE_DEFINITION:()=>ul,SCALAR_TYPE_EXTENSION:()=>kl,SCHEMA_DEFINITION:()=>cl,SCHEMA_EXTENSION:()=>wl,SELECTION_SET:()=>qs,STRING:()=>Js,TYPE_COORDINATE:()=>Al,UNION_TYPE_DEFINITION:()=>gl,UNION_TYPE_EXTENSION:()=>zl,VARIABLE:()=>_s,VARIABLE_DEFINITION:()=>Bs}),Qs="Name",js="Document",Fs="OperationDefinition",Bs="VariableDefinition",qs="SelectionSet",Zs="Field",Us="Argument",Ws="FragmentArgument",Xs="FragmentSpread",Hs="InlineFragment",Ys="FragmentDefinition",_s="Variable",Gs="IntValue",Ks="FloatValue",Js="StringValue",$s="BooleanValue",el="NullValue",tl="EnumValue",nl="ListValue",rl="ObjectValue",il="ObjectField",al="Directive",ol="NamedType",sl="ListType",ll="NonNullType",cl="SchemaDefinition",dl="OperationTypeDefinition",ul="ScalarTypeDefinition",hl="ObjectTypeDefinition",fl="FieldDefinition",pl="InputValueDefinition",ml="InterfaceTypeDefinition",gl="UnionTypeDefinition",vl="EnumTypeDefinition",bl="EnumValueDefinition",yl="InputObjectTypeDefinition",xl="DirectiveDefinition",wl="SchemaExtension",Ol="DirectiveExtension",kl="ScalarTypeExtension",Sl="ObjectTypeExtension",Cl="InterfaceTypeExtension",zl="UnionTypeExtension",Nl="EnumTypeExtension",El="InputObjectTypeExtension",Al="TypeCoordinate",Tl="MemberCoordinate",Pl="ArgumentCoordinate",Ml="DirectiveCoordinate",Il="DirectiveArgumentCoordinate";function Rl(e,t){if(!e)throw new Error(t)}function Dl(e){return 9===e||32===e}function Ll(e){return e>=48&&e<=57}function Vl(e){return e>=97&&e<=122||e>=65&&e<=90}function Ql(e){return Vl(e)||95===e}function jl(e){return Vl(e)||Ll(e)||95===e}function Fl(e){let t=Number.MAX_SAFE_INTEGER,n=null,r=-1;for(let i=0;i<e.length;++i){const a=e[i],o=Bl(a);o!==a.length&&(n??=i,r=i,0!==i&&o<t&&(t=o))}return e.map((e,n)=>0===n?e:e.slice(t)).slice(n??0,r+1)}function Bl(e){let t=0;for(;t<e.length&&Dl(e.charCodeAt(t));)++t;return t}var ql=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Zl(e){return Ul[e.charCodeAt(0)]}var Ul=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],Wl=Object.freeze({});function Xl(e,t,n=Ps){const r=/* @__PURE__ */new Map;for(const p of Object.values(Vs))r.set(p,Hl(t,p));let i,a,o,s=Array.isArray(e),l=[e],c=-1,d=[],u=e;const h=[],f=[];do{c++;const e=c===l.length,p=e&&0!==d.length;if(e){if(a=0===f.length?void 0:h[h.length-1],u=o,o=f.pop(),p)if(s){u=u.slice();let e=0;for(const[t,n]of d){const r=t-e;null===n?(u.splice(r,1),e++):u[r]=n}}else{u={...u};for(const[e,t]of d)u[e]=t}c=i.index,l=i.keys,d=i.edits,s=i.inArray,i=i.prev}else if(null!=o){if(a=s?c:l[c],u=o[a],null==u)continue;h.push(a)}let m;if(!Array.isArray(u)){if(Is(u)||Rl(!1,`Invalid AST Node: ${ys(u)}.`),m=(e?r.get(u.kind)?.leave:r.get(u.kind)?.enter)?.call(t,u,a,o,h,f),m===Wl)break;if(!1===m){if(!e){h.pop();continue}}else if(void 0!==m&&(d.push([a,m]),!e)){if(!Is(m)){h.pop();continue}u=m}}void 0===m&&p&&d.push([a,u]),e?h.pop():(i={inArray:s,index:c,keys:l,edits:d,prev:i},s=Array.isArray(u),l=s?u:n[u.kind]??[],c=-1,d=[],null!=o&&f.push(o),o=u)}while(void 0!==i);return 0!==d.length?d.at(-1)[1]:e}function Hl(e,t){const n=e[t];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}var Yl={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>_l(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=$l(e.variableDefinitions)?Kl("(\n",_l(e.variableDefinitions,"\n"),"\n)"):Kl("(",_l(e.variableDefinitions,", "),")"),n=Kl("",e.description,"\n")+_l([e.operation,_l([e.name,t]),_l(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r,description:i})=>Kl("",i,"\n")+e+": "+t+Kl(" = ",n)+Kl(" ",_l(r," "))},SelectionSet:{leave:({selections:e})=>Gl(e)},Field:{leave:({alias:e,name:t,arguments:n,directives:r,selectionSet:i})=>_l([ec(_l([Kl("",e,": "),t],""),n),Kl(" ",_l(r," ")),Kl(" ",i)])},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentArgument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,arguments:t,directives:n})=>ec("..."+e,t)+Kl(" ",_l(n," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>_l(["...",Kl("on ",e),_l(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i,description:a})=>Kl("",a,"\n")+`fragment ${e}${Kl("(",_l(n,", "),")")} on ${t} ${Kl("",_l(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>!0===t?function(e){const t=e.replaceAll('"""','\\"""'),n=t.split(/\r\n|[\n\r]/g),r=1===n.length,i=n.length>1&&n.slice(1).every(e=>0===e.length||Dl(e.charCodeAt(0))),a=t.endsWith('\\"""'),o=e.endsWith('"')&&!a,s=e.endsWith("\\"),l=o||s,c=!r||e.length>70||l||i||a;let d="";const u=r&&Dl(e.charCodeAt(0));return(c&&!u||i)&&(d+="\n"),d+=t,(c||l)&&(d+="\n"),'"""'+d+'"""'}(e):`"${e.replace(ql,Zl)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>{const t="["+_l(e,", ")+"]";return t.length>80?"[\n"+Jl(_l(e,"\n"))+"\n]":t}},ObjectValue:{leave:({fields:e})=>{const t="{ "+_l(e,", ")+" }";return t.length>80?Gl(e):t}},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Kl("(",_l(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>Kl("",e,"\n")+_l(["schema",_l(t," "),Gl(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>Kl("",e,"\n")+_l(["scalar",t,_l(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>Kl("",e,"\n")+_l(["type",t,Kl("implements ",_l(n," & ")),_l(r," "),Gl(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>Kl("",e,"\n")+t+($l(n)?Kl("(\n",Jl(_l(n,"\n")),"\n)"):Kl("(",_l(n,", "),")"))+": "+r+Kl(" ",_l(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>Kl("",e,"\n")+_l([t+": "+n,Kl("= ",r),_l(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>Kl("",e,"\n")+_l(["interface",t,Kl("implements ",_l(n," & ")),_l(r," "),Gl(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>Kl("",e,"\n")+_l(["union",t,_l(n," "),Kl("= ",_l(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>Kl("",e,"\n")+_l(["enum",t,_l(n," "),Gl(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>Kl("",e,"\n")+_l([t,_l(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>Kl("",e,"\n")+_l(["input",t,_l(n," "),Gl(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,directives:r,repeatable:i,locations:a})=>Kl("",e,"\n")+"directive @"+t+($l(n)?Kl("(\n",Jl(_l(n,"\n")),"\n)"):Kl("(",_l(n,", "),")"))+Kl(" ",_l(r," "))+(i?" repeatable":"")+" on "+_l(a," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>_l(["extend schema",_l(e," "),Gl(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>_l(["extend scalar",e,_l(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>_l(["extend type",e,Kl("implements ",_l(t," & ")),_l(n," "),Gl(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>_l(["extend interface",e,Kl("implements ",_l(t," & ")),_l(n," "),Gl(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>_l(["extend union",e,_l(t," "),Kl("= ",_l(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>_l(["extend enum",e,_l(t," "),Gl(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>_l(["extend input",e,_l(t," "),Gl(n)]," ")},DirectiveExtension:{leave:({name:e,directives:t})=>_l(["extend directive @"+e,_l(t," ")]," ")},TypeCoordinate:{leave:({name:e})=>e},MemberCoordinate:{leave:({name:e,memberName:t})=>_l([e,Kl(".",t)])},ArgumentCoordinate:{leave:({name:e,fieldName:t,argumentName:n})=>_l([e,Kl(".",t),Kl("(",n,":)")])},DirectiveCoordinate:{leave:({name:e})=>_l(["@",e])},DirectiveArgumentCoordinate:{leave:({name:e,argumentName:t})=>_l(["@",e,Kl("(",t,":)")])}};function _l(e,t=""){return e?.filter(e=>void 0!==e&&""!==e).join(t)??""}function Gl(e){return Kl("{\n",Jl(_l(e,"\n")),"\n}")}function Kl(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function Jl(e){return Kl(" ",e.replaceAll("\n","\n "))}function $l(e){return e?.some(e=>e.includes("\n"))??!1}function ec(e,t){let n=e+Kl("(",_l(t,", "),")");return n.length>80&&(n=e+Kl("(\n",Jl(_l(t,"\n")),"\n)")),n}var tc={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",FRAGMENT_VARIABLE_DEFINITION:"FRAGMENT_VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION",DIRECTIVE_DEFINITION:"DIRECTIVE_DEFINITION"};function nc(e,t,n){return new Ns(`Syntax Error: ${n}`,{source:e,positions:[t]})}var rc=function(){let e;try{const t=globalThis.process;"function"==typeof t?.getBuiltinModule&&(e=t.getBuiltinModule("node:diagnostics_channel"))}catch{}return e}(),ic=rc?.tracingChannel("graphql:parse"),ac=(rc?.tracingChannel("graphql:validate"),rc?.tracingChannel("graphql:execute"),rc?.tracingChannel("graphql:execute:variableCoercion"),rc?.tracingChannel("graphql:execute:rootSelectionSet"),rc?.tracingChannel("graphql:subscribe"),rc?.tracingChannel("graphql:resolve"),["start","end","asyncStart","asyncEnd","error"]),oc="<SOF>",sc="<EOF>",lc="$",cc="(",dc=")",uc="...",hc=":",fc="=",pc="@",mc="[",gc="]",vc="{",bc="|",yc="}",xc="Name",wc="Float",Oc="String",kc="BlockString",Sc="Comment",Cc=class{constructor(e){const t=new Ts(oc,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==sc)do{if(e.next)e=e.next;else{const t=Mc(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Sc);return e}};function zc(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Nc(e,t){return Ec(e.charCodeAt(t))&&Ac(e.charCodeAt(t+1))}function Ec(e){return e>=55296&&e<=56319}function Ac(e){return e>=56320&&e<=57343}function Tc(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return sc;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function Pc(e,t,n,r,i){const a=e.line;return new Ts(t,n,r,a,1+n-e.lineStart,i)}function Mc(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const t=n.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===n.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Ic(e,i);case 33:return Pc(e,"!",i,i+1);case 36:return Pc(e,lc,i,i+1);case 38:return Pc(e,"&",i,i+1);case 40:return Pc(e,cc,i,i+1);case 41:return Pc(e,dc,i,i+1);case 46:{const t=n.charCodeAt(i+1);if(46===t&&46===n.charCodeAt(i+2))return Pc(e,uc,i,i+3);if(46===t)throw nc(e.source,i,'Unexpected "..", did you mean "..."?');if(Ll(t)){const n=e.source.body.slice(i+1,Dc(e,i+1,t));throw nc(e.source,i,`Invalid number, expected digit before ".", did you mean "0.${n}"?`)}break}case 58:return Pc(e,hc,i,i+1);case 61:return Pc(e,fc,i,i+1);case 64:return Pc(e,pc,i,i+1);case 91:return Pc(e,mc,i,i+1);case 93:return Pc(e,gc,i,i+1);case 123:return Pc(e,vc,i,i+1);case 124:return Pc(e,bc,i,i+1);case 125:return Pc(e,yc,i,i+1);case 34:return 34===n.charCodeAt(i+1)&&34===n.charCodeAt(i+2)?qc(e,i):Lc(e,i)}if(Ll(t)||45===t)return Rc(e,i,t);if(Ql(t))return Zc(e,i);throw nc(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":zc(t)||Nc(n,i)?`Unexpected character: ${Tc(e,i)}.`:`Invalid character: ${Tc(e,i)}.`)}return Pc(e,sc,r,r)}function Ic(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const e=n.charCodeAt(i);if(10===e||13===e)break;if(zc(e))++i;else{if(!Nc(n,i))break;i+=2}}return Pc(e,Sc,t,i,n.slice(t+1,i))}function Rc(e,t,n){const r=e.source.body;let i=t,a=n,o=!1;if(45===a&&(a=r.charCodeAt(++i)),48===a){if(a=r.charCodeAt(++i),Ll(a))throw nc(e.source,i,`Invalid number, unexpected digit after 0: ${Tc(e,i)}.`)}else i=Dc(e,i,a),a=r.charCodeAt(i);if(46===a&&(o=!0,a=r.charCodeAt(++i),i=Dc(e,i,a),a=r.charCodeAt(i)),69!==a&&101!==a||(o=!0,a=r.charCodeAt(++i),43!==a&&45!==a||(a=r.charCodeAt(++i)),i=Dc(e,i,a),a=r.charCodeAt(i)),46===a||Ql(a))throw nc(e.source,i,`Invalid number, expected digit but got: ${Tc(e,i)}.`);return Pc(e,o?wc:"Int",t,i,r.slice(t,i))}function Dc(e,t,n){if(!Ll(n))throw nc(e.source,t,`Invalid number, expected digit but got: ${Tc(e,t)}.`);const r=e.source.body;let i=t+1;for(;Ll(r.charCodeAt(i));)++i;return i}function Lc(e,t){const n=e.source.body,r=n.length;let i=t+1,a=i,o="";for(;i<r;){const r=n.charCodeAt(i);if(34===r)return o+=n.slice(a,i),Pc(e,Oc,t,i+1,o);if(92===r){o+=n.slice(a,i);const t=117===n.charCodeAt(i+1)?123===n.charCodeAt(i+2)?Vc(e,i):Qc(e,i):Bc(e,i);o+=t.value,i+=t.size,a=i;continue}if(10===r||13===r)break;if(zc(r))++i;else{if(!Nc(n,i))throw nc(e.source,i,`Invalid character within String: ${Tc(e,i)}.`);i+=2}}throw nc(e.source,i,"Unterminated string.")}function Vc(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const e=n.charCodeAt(t+i++);if(125===e){if(i<5||!zc(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Fc(e),r<0)break}throw nc(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Qc(e,t){const n=e.source.body,r=jc(n,t+2);if(zc(r))return{value:String.fromCodePoint(r),size:6};if(Ec(r)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=jc(n,t+8);if(Ac(e))return{value:String.fromCodePoint(r,e),size:12}}throw nc(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function jc(e,t){return Fc(e.charCodeAt(t))<<12|Fc(e.charCodeAt(t+1))<<8|Fc(e.charCodeAt(t+2))<<4|Fc(e.charCodeAt(t+3))}function Fc(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Bc(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw nc(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function qc(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,a=t+3,o=a,s="";const l=[];for(;a<r;){const r=n.charCodeAt(a);if(34===r&&34===n.charCodeAt(a+1)&&34===n.charCodeAt(a+2)){s+=n.slice(o,a),l.push(s);const r=Pc(e,kc,t,a+3,Fl(l).join("\n"));return e.line+=l.length-1,e.lineStart=i,r}if(92!==r||34!==n.charCodeAt(a+1)||34!==n.charCodeAt(a+2)||34!==n.charCodeAt(a+3))if(10!==r&&13!==r)if(zc(r))++a;else{if(!Nc(n,a))throw nc(e.source,a,`Invalid character within String: ${Tc(e,a)}.`);a+=2}else s+=n.slice(o,a),l.push(s),13===r&&10===n.charCodeAt(a+1)?a+=2:++a,s="",o=a,i=a;else s+=n.slice(o,a),o=a+1,a+=4}throw nc(e.source,a,"Unterminated string.")}function Zc(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r&&jl(n.charCodeAt(i));)++i;return Pc(e,xc,t,i,n.slice(t,i))}var Uc=Symbol("Source"),Wc=class{constructor(e,t="GraphQL request",n={line:1,column:1}){this.__kind=Uc,this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Rl(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Rl(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function Xc(e,t){const n=new Hc(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var Hc=class{constructor(e,t={}){const{lexer:n,...r}=t;if(n)this._lexer=n;else{const t=function(e){return t=e,n=Uc,t?.__kind===n;var t,n}(e)?e:new Wc(e);this._lexer=new Cc(t)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(xc);return this.node(e,{kind:Qs,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:js,definitions:this.many(oc,this.parseDefinition,sc)})}parseDefinition(){if(this.peek(vc))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(e&&t.kind===vc)throw nc(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(t.kind===xc){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(e)throw nc(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if("extend"===t.value)return this.parseTypeSystemExtension()}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(vc))return this.node(e,{kind:Fs,operation:Rs,description:void 0,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:this.parseSelectionSet()});const t=this.parseDescription(),n=this.parseOperationType();let r;return this.peek(xc)&&(r=this.parseName()),this.node(e,{kind:Fs,operation:n,description:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(xc);switch(e.value){case"query":return Rs;case"mutation":return Ds;case"subscription":return Ls}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(cc,this.parseVariableDefinition,dc)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Bs,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(hc),this.parseTypeReference()),defaultValue:this.expectOptionalToken(fc)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(lc),this.node(e,{kind:_s,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:qs,selections:this.many(vc,this.parseSelection,yc)})}parseSelection(){return this.peek(uc)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,r;return this.expectOptionalToken(hc)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:Zs,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(vc)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(cc,t,dc)}parseFragmentArguments(){const e=this.parseFragmentArgument;return this.optionalMany(cc,e,dc)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(hc),this.node(t,{kind:Us,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragmentArgument(){const e=this._lexer.token,t=this.parseName();return this.expectToken(hc),this.node(e,{kind:Ws,name:t,value:this.parseValueLiteral(!1)})}parseFragment(){const e=this._lexer.token;this.expectToken(uc);const t=this.expectOptionalKeyword("on");if(!t&&this.peek(xc)){const t=this.parseFragmentName();return this.peek(cc)&&this._options.experimentalFragmentArguments?this.node(e,{kind:Xs,name:t,arguments:this.parseFragmentArguments(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Xs,name:t,directives:this.parseDirectives(!1)})}return this.node(e,{kind:Hs,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token,t=this.parseDescription();return this.expectKeyword("fragment"),!0===this._options.experimentalFragmentArguments?this.node(e,{kind:Ys,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Ys,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case mc:return this.parseList(e);case vc:return this.parseObject(e);case"Int":return this.advanceLexer(),this.node(t,{kind:Gs,value:t.value});case wc:return this.advanceLexer(),this.node(t,{kind:Ks,value:t.value});case Oc:case kc:return this.parseStringLiteral();case xc:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:$s,value:!0});case"false":return this.node(t,{kind:$s,value:!1});case"null":return this.node(t,{kind:el});default:return this.node(t,{kind:tl,value:t.value})}case lc:if(e){if(this.expectToken(lc),this._lexer.token.kind===xc){const e=this._lexer.token.value;throw nc(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Js,value:e.value,block:e.kind===kc})}parseList(e){return this.node(this._lexer.token,{kind:nl,values:this.any(mc,()=>this.parseValueLiteral(e),gc)})}parseObject(e){return this.node(this._lexer.token,{kind:rl,fields:this.any(vc,()=>this.parseObjectField(e),yc)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(hc),this.node(t,{kind:il,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(pc);)t.push(this.parseDirective(e));if(t.length)return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(pc),this.node(t,{kind:al,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(mc)){const n=this.parseTypeReference();this.expectToken(gc),t=this.node(e,{kind:sl,type:n})}else t=this.parseNamedType();return this.expectOptionalToken("!")?this.node(e,{kind:ll,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:ol,name:this.parseName()})}peekDescription(){return this.peek(Oc)||this.peek(kc)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.many(vc,this.parseOperationTypeDefinition,yc);return this.node(e,{kind:cl,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(hc);const n=this.parseNamedType();return this.node(e,{kind:dl,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:ul,description:t,name:n,directives:r})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:hl,description:t,name:n,interfaces:r,directives:i,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany("&",this.parseNamedType):void 0}parseFieldsDefinition(){return this.optionalMany(vc,this.parseFieldDefinition,yc)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(hc);const i=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(e,{kind:fl,description:t,name:n,arguments:r,type:i,directives:a})}parseArgumentDefs(){return this.optionalMany(cc,this.parseInputValueDef,dc)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(hc);const r=this.parseTypeReference();let i;this.expectOptionalToken(fc)&&(i=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(e,{kind:pl,description:t,name:n,type:r,defaultValue:i,directives:a})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(e,{kind:ml,description:t,name:n,interfaces:r,directives:i,fields:a})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:gl,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(fc)?this.delimitedMany(bc,this.parseNamedType):void 0}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:vl,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(vc,this.parseEnumValueDefinition,yc)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:bl,description:t,name:n,directives:r})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw nc(this._lexer.source,this._lexer.token.start,`${Yc(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:yl,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(vc,this.parseInputValueDef,yc)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===xc)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension();case"directive":return this.parseDirectiveExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(vc,this.parseOperationTypeDefinition,yc);if(void 0===t&&void 0===n)throw this.unexpected();return this.node(e,{kind:wl,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(void 0===n)throw this.unexpected();return this.node(e,{kind:kl,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(void 0===n&&void 0===r&&void 0===i)throw this.unexpected();return this.node(e,{kind:Sl,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(void 0===n&&void 0===r&&void 0===i)throw this.unexpected();return this.node(e,{kind:Cl,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(void 0===n&&void 0===r)throw this.unexpected();return this.node(e,{kind:zl,name:t,directives:n,types:r})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(void 0===n&&void 0===r)throw this.unexpected();return this.node(e,{kind:Nl,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(void 0===n&&void 0===r)throw this.unexpected();return this.node(e,{kind:El,name:t,directives:n,fields:r})}parseDirectiveExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(pc);const t=this.parseName(),n=this.parseConstDirectives();if(void 0===n)throw this.unexpected();return this.node(e,{kind:Ol,name:t,directives:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(pc);const n=this.parseName(),r=this.parseArgumentDefs(),i=this.parseConstDirectives(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:xl,description:t,name:n,arguments:r,directives:i,repeatable:a,locations:o})}parseDirectiveLocations(){return this.delimitedMany(bc,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.hasOwn(tc,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){const e=this._lexer.token,t=this.expectOptionalToken(pc),n=this.parseName();let r,i;return!t&&this.expectOptionalToken(".")&&(r=this.parseName()),(t||r)&&this.expectOptionalToken(cc)&&(i=this.parseName(),this.expectToken(hc),this.expectToken(dc)),t?i?this.node(e,{kind:Il,name:n,argumentName:i}):this.node(e,{kind:Ml,name:n}):r?i?this.node(e,{kind:Pl,name:n,fieldName:r,argumentName:i}):this.node(e,{kind:Tl,name:n,memberName:r}):this.node(e,{kind:Al,name:n})}node(e,t){return!0!==this._options.noLocation&&(t.loc=new As(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw nc(this._lexer.source,t.start,`Expected ${_c(e)}, found ${Yc(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==xc||t.value!==e)throw nc(this._lexer.source,t.start,`Expected "${e}", found ${Yc(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===xc&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=e??this._lexer.token;return nc(this._lexer.source,t.start,`Unexpected ${Yc(t)}.`)}any(e,t,n){this.expectToken(e);const r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}}many(e,t,n){this.expectToken(e);const r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(t.kind!==sc&&(++this._tokenCounter,void 0!==e&&this._tokenCounter>e))throw nc(this._lexer.source,t.start,`Document contains more than ${e} tokens. Parsing aborted.`)}};function Yc(e){const t=e.value;return _c(e.kind)+(null!=t?` "${t}"`:"")}function _c(e){return function(e){return"!"===e||e===lc||"&"===e||e===cc||e===dc||"."===e||e===uc||e===hc||e===fc||e===pc||e===mc||e===gc||e===vc||e===bc||e===yc}(e)?`"${e}"`:e}var Gc=function(e,t){return Gc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Gc(e,t)};function Kc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Gc(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Jc=function(){return Jc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Jc.apply(this,arguments)};function $c(e,t){var n,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(vAe){s=[6,vAe],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function ed(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function td(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function nd(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function rd(e){return this instanceof rd?(this.v=e,this):new rd(e)}function id(e){return"function"==typeof e}function ad(e){var t=e(function(e){Error.call(e),e.stack=/* @__PURE__ */(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var od=ad(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function sd(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ld=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=ed(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(f){e={error:f}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(id(l))try{l()}catch(vAe){i=vAe instanceof od?vAe.errors:[vAe]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var d=ed(c),u=d.next();!u.done;u=d.next()){var h=u.value;try{ud(h)}catch(p){i=null!=i?i:[],p instanceof od?i=nd(nd([],td(i)),td(p.errors)):i.push(p)}}}catch(m){n={error:m}}finally{try{u&&!u.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}}if(i)throw new od(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ud(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&sd(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&sd(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),cd=ld.EMPTY;function dd(e){return e instanceof ld||e&&"closed"in e&&id(e.remove)&&id(e.add)&&id(e.unsubscribe)}function ud(e){id(e)?e():e.unsubscribe()}var hd={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=hd.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,nd([e,t],td(n))):setTimeout.apply(void 0,nd([e,t],td(n)))},clearTimeout:function(e){var t=hd.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function fd(e){hd.setTimeout(function(){throw e})}function pd(){}var md=gd("C",void 0,void 0);function gd(e,t,n){return{kind:e,value:t,error:n}}function vd(e){e()}var bd=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,dd(t)&&t.add(n)):n.destination=kd,n}return Kc(t,e),t.create=function(e,t,n){return new xd(e,t,n)},t.prototype.next=function(e){this.isStopped?Od(function(e){return gd("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Od(gd("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Od(md,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ld);Function.prototype.bind;var yd=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){wd(n)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){wd(n)}else wd(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){wd(t)}},e}(),xd=function(e){function t(t,n,r){var i,a=e.call(this)||this;return i=id(t)||!t?{next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:t,a.destination=new yd(i),a}return Kc(t,e),t}(bd);function wd(e){fd(e)}function Od(e,t){var n=null;n&&hd.setTimeout(function(){return n(e,t)})}var kd={closed:!0,next:pd,error:function(e){throw e},complete:pd},Sd="function"==typeof Symbol&&Symbol.observable||"@@observable";function Cd(e){return e}var zd=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,a=(r=e)&&r instanceof bd||function(e){return e&&id(e.next)&&id(e.error)&&id(e.complete)}(r)&&dd(r)?e:new xd(e,t,n);return vd(function(){var e=i,t=e.operator,n=e.source;a.add(t?t.call(a,n):n?i._subscribe(a):i._trySubscribe(a))}),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=Nd(t))(function(t,r){var i=new xd({next:function(t){try{e(t)}catch(n){r(n),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Sd]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?Cd:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Nd(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function Nd(e){var t;return null!==(t=null!=e?e:void 0)&&void 0!==t?t:Promise}function Ed(e){return function(t){if(function(e){return id(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Ad(e,t,n,r,i){return new Td(e,t,n,r,i)}var Td=function(e){function t(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(r){t.error(r)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return Kc(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(bd),Pd=ad(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Md=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return Kc(t,e),t.prototype.lift=function(e){var t=new Id(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Pd},t.prototype.next=function(e){var t=this;vd(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=ed(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(o){n={error:o}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;vd(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;vd(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?cd:(this.currentObservers=null,a.push(e),new ld(function(){t.currentObservers=null,sd(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new zd;return e.source=this,e},t.create=function(e,t){return new Id(e,t)},t}(zd),Id=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return Kc(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:cd},t}(Md),Rd=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return Kc(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(Md),Dd={now:function(){return(Dd.delegate||Date).now()},delegate:void 0},Ld=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Dd);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return Kc(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,o=n._timestampProvider,s=n._windowTime;r||(i.push(t),!a&&i.push(o.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,a=(i?1:2)*t;if(t<1/0&&a<r.length&&r.splice(0,r.length-a),!i){for(var o=n.now(),s=0,l=1;l<r.length&&r[l]<=o;l+=2)s=l;s&&r.splice(0,s+1)}},t}(Md),Vd=function(e){function t(t,n){return e.call(this)||this}return Kc(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(ld),Qd={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Qd.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,nd([e,t],td(n))):setInterval.apply(void 0,nd([e,t],td(n)))},clearInterval:function(e){var t=Qd.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},jd=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return Kc(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),Qd.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&Qd.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)/* @__PURE__ */return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(vAe){r=!0,n=vAe||/* @__PURE__ */new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,sd(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Vd),Fd=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=Dd.now,e}(),Bd=function(e){function t(t,n){void 0===n&&(n=Fd.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return Kc(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(Fd),qd=new Bd(jd),Zd=new zd(function(e){return e.complete()});function Ud(e){return e&&id(e.schedule)}function Wd(e){return Ud((t=e)[t.length-1])?e.pop():void 0;var t}var Xd=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Hd(e){return id(null==e?void 0:e.then)}function Yd(e){return id(e[Sd])}function _d(e){return Symbol.asyncIterator&&id(null==e?void 0:e[Symbol.asyncIterator])}function Gd(e){/* @__PURE__ */
7
- return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Kd,Jd="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function $d(e){return id(null==e?void 0:e[Jd])}function eu(e){return function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),a=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{!function(e){e.value instanceof rd?Promise.resolve(e.value.v).then(l,c):d(a[0][2],e)}(i[e](t))}catch(vAe){d(a[0][3],vAe)}}function l(e){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}(this,arguments,function(){var t,n,r;return $c(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,rd(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,rd(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,rd(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function tu(e){return id(null==e?void 0:e.getReader)}function nu(e){if(e instanceof zd)return e;if(null!=e){if(Yd(e))return i=e,new zd(function(e){var t=i[Sd]();if(id(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Xd(e))return t=e,new zd(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()});if(Hd(e))return r=e,new zd(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,fd)});if(_d(e))return ru(e);if($d(e))return n=e,new zd(function(e){var t,r;try{for(var i=ed(n),a=i.next();!a.done;a=i.next()){var o=a.value;if(e.next(o),e.closed)return}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e.complete()});if(tu(e))return ru(eu(e))}var t,n,r,i;throw Gd(e)}function ru(e){return new zd(function(t){(function(e,t){var n,r,i,a;return function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{l(r.next(e))}catch(vAe){a(vAe)}}function s(e){try{l(r.throw(e))}catch(vAe){a(vAe)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function(){var o,s;return $c(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ed(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,i,(t=e[n](t)).done,t.value)})}}}(e),l.label=1;case 1:return[4,n.next()];case 2:if((r=l.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=l.sent(),i={error:s},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function iu(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function au(e,t){return void 0===t&&(t=0),Ed(function(n,r){n.subscribe(Ad(r,function(n){return iu(r,e,function(){return r.next(n)},t)},function(){return iu(r,e,function(){return r.complete()},t)},function(n){return iu(r,e,function(){return r.error(n)},t)}))})}function ou(e,t){return void 0===t&&(t=0),Ed(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function su(e,t){if(!e)throw new Error("Iterable cannot be null");return new zd(function(n){iu(n,t,function(){var r=e[Symbol.asyncIterator]();iu(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function lu(e,t){return t?function(e,t){if(null!=e){if(Yd(e))return function(e,t){return nu(e).pipe(ou(t),au(t))}(e,t);if(Xd(e))return function(e,t){return new zd(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(Hd(e))return function(e,t){return nu(e).pipe(ou(t),au(t))}(e,t);if(_d(e))return su(e,t);if($d(e))return function(e,t){return new zd(function(n){var r;return iu(n,t,function(){r=e[Jd](),iu(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(a){return void n.error(a)}i?n.complete():n.next(t)},0,!0)}),function(){return id(null==r?void 0:r.return)&&r.return()}})}(e,t);if(tu(e))return function(e,t){return su(eu(e),t)}(e,t)}throw Gd(e)}(e,t):nu(e)}function cu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return lu(e,Wd(e))}function du(e,t){var n=id(e)?e:function(){return e},r=function(e){return e.error(n())};return new zd(t?function(e){return t.schedule(r,0,e)}:r)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Kd||(Kd={}));var uu=function(){function e(e,t,n){this.kind=e,this.value=t,this.error=n,this.hasValue="N"===e}return e.prototype.observe=function(e){return function(e,t){var n,r,i,a=e,o=a.kind,s=a.value,l=a.error;if("string"!=typeof o)throw new TypeError('Invalid notification, missing "kind"');"N"===o?null===(n=t.next)||void 0===n||n.call(t,s):"E"===o?null===(r=t.error)||void 0===r||r.call(t,l):null===(i=t.complete)||void 0===i||i.call(t)}(this,e)},e.prototype.do=function(e,t,n){var r=this,i=r.kind,a=r.value,o=r.error;return"N"===i?null==e?void 0:e(a):"E"===i?null==t?void 0:t(o):null==n?void 0:n()},e.prototype.accept=function(e,t,n){var r;return id(null===(r=e)||void 0===r?void 0:r.next)?this.observe(e):this.do(e,t,n)},e.prototype.toObservable=function(){var e=this,t=e.kind,n=e.value,r=e.error,i="N"===t?cu(n):"E"===t?du(function(){return r}):"C"===t?Zd:0;if(!i)throw new TypeError("Unexpected notification kind "+t);return i},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();ad(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function hu(e,t){return Ed(function(n,r){var i=0;n.subscribe(Ad(r,function(n){r.next(e.call(t,n,i++))}))})}function fu(e,t,n){return void 0===n&&(n=1/0),id(t)?fu(function(n,r){return hu(function(e,i){return t(n,e,r,i)})(nu(e(n,r)))},n):("number"==typeof t&&(n=t),Ed(function(t,r){return function(e,t,n,r){var i=[],a=0,o=0,s=!1,l=function(){!s||i.length||a||t.complete()},c=function(e){return a<r?d(e):i.push(e)},d=function(e){a++;var s=!1;nu(n(e,o++)).subscribe(Ad(t,function(e){t.next(e)},function(){s=!0},void 0,function(){if(s)try{a--;for(var e=function(){var e=i.shift();d(e)};i.length&&a<r;)e();l()}catch(n){t.error(n)}}))};return e.subscribe(Ad(t,c,function(){s=!0,l()})),function(){}}(t,r,e,n)}))}function pu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(void 0===(n=1)&&(n=1/0),fu(Cd,n))(lu(e,Wd(e)));var n}function mu(e,t){return Ed(function(n,r){var i=0;n.subscribe(Ad(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function gu(e){return Ed(function(t,n){var r,i=null,a=!1;i=t.subscribe(Ad(n,void 0,void 0,function(o){r=nu(e(o,gu(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):a=!0})),a&&(i.unsubscribe(),i=null,r.subscribe(n))})}function vu(e,t){return e===t}function bu(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new Md}:t,r=e.resetOnError,i=void 0===r||r,a=e.resetOnComplete,o=void 0===a||a,s=e.resetOnRefCountZero,l=void 0===s||s;return function(e){var t,r,a,s=0,c=!1,d=!1,u=function(){null==r||r.unsubscribe(),r=void 0},h=function(){u(),t=a=void 0,c=d=!1},f=function(){var e=t;h(),null==e||e.unsubscribe()};return Ed(function(e,p){s++,d||c||u();var m=a=null!=a?a:n();p.add(function(){0!==--s||d||c||(r=yu(f,l))}),m.subscribe(p),!t&&s>0&&(t=new xd({next:function(e){return m.next(e)},error:function(e){d=!0,u(),r=yu(h,i,e),m.error(e)},complete:function(){c=!0,u(),r=yu(h,o),m.complete()}}),nu(e).subscribe(t))})(e)}}function yu(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new xd({next:function(){i.unsubscribe(),e()}});return nu(t.apply(void 0,nd([],td(n)))).subscribe(i)}}else e()}function xu(e,t,n){var r,i,a,o,s=!1;return e&&"object"==typeof e?(r=e.bufferSize,o=void 0===r?1/0:r,i=e.windowTime,t=void 0===i?1/0:i,s=void 0!==(a=e.refCount)&&a,n=e.scheduler):o=null!=e?e:1/0,bu({connector:function(){return new Ld(o,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function wu(e,t,n){var r=id(e)||t||n?{next:e,error:t,complete:n}:e;return r?Ed(function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(Ad(t,function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)},function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()},function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)},function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)}))}):Cd}function Ou(e){try{return e()}catch{}}var ku=Ou(()=>globalThis)||Ou(()=>window)||Ou(()=>self)||Ou(()=>global)||Ou(function(){return Ou.constructor("return this")()}),Su="4.2.7",Cu=/* @__PURE__ */new Map;function zu(e){const t=Cu.get(e)||1;return Cu.set(e,t+1),`${e}:${t}:${Math.random().toString(36).slice(2)}`}var Nu="Invariant Violation",Eu=class e extends Error{constructor(t=Nu){super(t),this.name=Nu,Object.setPrototypeOf(this,e.prototype)}},Au=["debug","log","warn","error","silent"],Tu=Au.indexOf("silent");function Pu(e,...t){if(!e)throw Iu(...t)}function Mu(e){return function(t,...n){if(Au.indexOf(e)>=Tu){const r=console[e]||console.log;if("number"==typeof t){const e=t;(t=Lu(e))||(t=Vu(e,n),n=[])}r(t,...n)}}}function Iu(e,...t){return new Eu(Lu(e,t)||Vu(e,t))}Pu.debug=Mu("debug"),Pu.log=Mu("log"),Pu.warn=Mu("warn"),Pu.error=Mu("error");var Ru=Symbol.for("ApolloErrorMessageHandler_"+Su);function Du(e){if("string"==typeof e)return e;try{return function(e,t=0){const n=zu("stringifyForDisplay");return JSON.stringify(e,(e,t)=>void 0===t?n:t,t).split(JSON.stringify(n)).join("<undefined>")}(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function Lu(e,t=[]){if(e)return ku[Ru]&&ku[Ru](e,t.map(Du))}function Vu(e,t=[]){if(e)return"string"==typeof e?t.reduce((e,t)=>e.replace(/%[sdfo]/,Du(t)),e):`An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#${encodeURIComponent(JSON.stringify({version:Su,message:e,args:t.map(Du)}))}`}function Qu(e,t,n,r){if("IntValue"===n.kind||"FloatValue"===n.kind)e[t.value]=Number(n.value);else if("BooleanValue"===n.kind||"StringValue"===n.kind)e[t.value]=n.value;else if("ObjectValue"===n.kind){const i={};n.fields.map(e=>Qu(i,e.name,e.value,r)),e[t.value]=i}else if("Variable"===n.kind){const i=(r||{})[n.name.value];e[t.value]=i}else if("ListValue"===n.kind)e[t.value]=n.values.map(e=>{const n={};return Qu(n,t,e,r),n[t.value]});else if("EnumValue"===n.kind)e[t.value]=n.value;else{if("NullValue"!==n.kind)throw Iu(19,t.value,n.kind);e[t.value]=null}}function ju(e,t){if(e.arguments&&e.arguments.length){const n={};return e.arguments.forEach(({name:e,value:r})=>Qu(n,e,r,t)),n}return null}var Fu=Symbol.for("apollo.cacheSize"),Bu={...ku[Fu]};function qu(e,t){return e.definitions.find(e=>"OperationDefinition"===e.kind&&!!e.name)?.name.value??t}var Zu=()=>Object.create(null),{forEach:Uu,slice:Wu}=Array.prototype,{hasOwnProperty:Xu}=Object.prototype,Hu=class e{constructor(e=!0,t=Zu){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return Uu.call(e,e=>t=t.getChildTrie(e)),Xu.call(t,"data")?t.data:t.data=this.makeData(Wu.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,r=e.length;t&&n<r;++n){const r=t.mapFor(e[n],!1);t=r&&r.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],r=this.mapFor(n,!1),i=r&&r.get(n);i&&(t=i.removeArray(Wu.call(e,1)),i.data||i.weak||i.strong&&i.strong.size||r.delete(n))}else t=this.data,delete this.data;return t}getChildTrie(t){const n=this.mapFor(t,!0);let r=n.get(t);return r||n.set(t,r=new e(this.weakness,this.makeData)),r}mapFor(e,t){return this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(e)?this.weak||(t?this.weak=/* @__PURE__ */new WeakMap:void 0):this.strong||(t?this.strong=/* @__PURE__ */new Map:void 0)}};function Yu(){}var _u=class{constructor(e=1/0,t=Yu){this.max=e,this.dispose=t,this.map=/* @__PURE__ */new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:n}=t;n&&(n.older=e),e&&(e.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)}};function Gu(){}var Ku=Gu,Ju="undefined"!=typeof WeakRef?WeakRef:function(e){return{deref:()=>e}},$u="undefined"!=typeof WeakMap?WeakMap:Map,eh="undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){return{register:Gu,unregister:Gu}},th=class{constructor(e=1/0,t=Ku){this.max=e,this.dispose=t,this.map=new $u,this.newest=null,this.oldest=null,this.unfinalizedNodes=/* @__PURE__ */new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const e=this.unfinalizedNodes.values();for(let t=0;t<10024;t++){const t=e.next().value;if(!t)break;this.unfinalizedNodes.delete(t);const n=t.key;delete t.key,t.keyRef=new Ju(n),this.registry.register(n,t,t)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new eh(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:n}=t;n&&(n.older=e),e&&(e.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return!!t&&(this.deleteNode(t),!0)}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}},nh=/* @__PURE__ */new WeakSet;function rh(e){e.size<=(e.max||-1)||nh.has(e)||(nh.add(e),setTimeout(()=>{e.clean(),nh.delete(e)},100))}var ih=function(e,t){const n=new th(e,t);return n.set=function(e,t){const n=th.prototype.set.call(this,e,t);return rh(this),n},n},ah=function(e,t){const n=new _u(e,t);return n.set=function(e,t){const n=_u.prototype.set.call(this,e,t);return rh(this),n},n};function oh(e,{max:t,makeCacheKey:n=e=>e}){const r=new Hu(!0),i=new ih(t);return(...t)=>{const a=r.lookupArray(n(t)),o=i.get(a);if(o){if(o.error)throw o.error;return o.result}const s=i.set(a,{});try{return s.result=e(...t)}catch(l){throw s.error=l,l}}}var sh=oh((e,t)=>{Pu(e&&"Document"===e.kind,1);const n=e.definitions.filter(e=>"OperationDefinition"===e.kind);t&&Pu(1==n.length&&n[0].operation===t,4,t,t,n[0].operation),Xl(e,{Field(t,r,i,a){if(t.alias&&("__typename"===t.alias.value||t.alias.value.startsWith("__ac_"))&&t.alias.value!==t.name.value){let r=e,i=[];for(const e of a)r=r[e],"Field"===r.kind&&i.push(r.alias?.value||r.name.value);throw i.splice(-1,1,t.name.value),Iu(5,t.alias.value,i.join("."),n[0].operation,qu(e,"(anonymous)"))}}})},{max:Bu.checkDocument||2e3}),{toString:lh}=Object.prototype;function ch(...e){const t={};return e.forEach(e=>{e&&Reflect.ownKeys(e).forEach(n=>{const r=e[n];void 0!==r&&(t[n]=r)})}),t}function dh(e=[]){const t={};return e.forEach(e=>{t[e.name.value]=e}),t}function uh(e){return null!==e&&"object"==typeof e}var{hasOwnProperty:hh}=Object.prototype,fh=function(e,t,n){return this.merge(e[n],t[n])},ph=e=>isNaN(+e)?{}:[],mh=class{options;reconciler;constructor(e={}){this.options=e,this.reconciler=e.reconciler||fh}merge(e,t,n={}){const r=n.atPath;if(r?.length){const[i,...a]=r;void 0===e&&(e=ph(i));let o=e[i];void 0===o&&a.length&&(o=ph(a[0]));const s=this.merge(o,t,{...n,atPath:a});return o!==s&&((e=this.shallowCopyForMerge(e))[i]=s),e}return Array.isArray(e)&&Array.isArray(t)&&"truncate"===this.options.arrayMerge&&e.length>t.length&&(e=e.slice(0,t.length),this.pastCopies.add(e)),uh(t)&&uh(e)?(Object.keys(t).forEach(n=>{if(hh.call(e,n)){const r=e[n];if(t[n]!==r){const i=this.reconciler(e,t,n);i!==r&&((e=this.shallowCopyForMerge(e))[n]=i)}}else(e=this.shallowCopyForMerge(e))[n]=t[n]}),e):t}isObject=uh;pastCopies=/* @__PURE__ */new Set;shallowCopyForMerge(e){return uh(e)&&(this.pastCopies.has(e)||(e=Array.isArray(e)?e.slice(0):{__proto__:Object.getPrototypeOf(e),...e},this.pastCopies.add(e))),e}};function gh(e){const t={},n=e&&e.variableDefinitions;return n&&n.length&&n.forEach(e=>{e.defaultValue&&Qu(t,e.variable.name,e.defaultValue)}),t}function vh(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":{const n=e.name.value;if("function"==typeof t)return t(n);const r=t&&t[n];return Pu(r,9,n),r||null}default:return null}}function bh(e,t){let n=t;const r=[];return e.definitions.forEach(e=>{if("OperationDefinition"===e.kind)throw Iu(10,e.operation,e.name?` named '${e.name.value}'`:"");"FragmentDefinition"===e.kind&&r.push(e)}),void 0===n&&(Pu(1===r.length,11,r.length),n=r[0].name.value),{...e,definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:n}}]}},...e.definitions]}}function yh(e){return e.definitions.filter(e=>"FragmentDefinition"===e.kind)}function xh(e){let t;sh(e);for(let n of e.definitions){if("OperationDefinition"===n.kind)return n;"FragmentDefinition"!==n.kind||t||(t=n)}if(t)return t;throw Iu(12)}function wh(e){return sh(e),e.definitions.filter(e=>"OperationDefinition"===e.kind)[0]}function Oh(e){const t=wh(e);return Pu(t&&"query"===t.operation,13),t}var kh,Sh=Object.assign(function(e){return JSON.stringify(e,Ch)},{reset(){kh=new ah(Bu.canonicalStringify||1e3)}});function Ch(e,t){if(t&&"object"==typeof t){const e=Object.getPrototypeOf(t);if(e===Object.prototype||null===e){const n=Object.keys(t);if(n.every(zh))return t;const r=JSON.stringify(n);let i=kh.get(r);if(!i){n.sort();const e=JSON.stringify(n);i=kh.get(e)||n,kh.set(r,i),kh.set(e,i)}const a=Object.create(e);return i.forEach(e=>{a[e]=t[e]}),a}}return t}function zh(e,t,n){return 0===t||n[t-1]<=e}Sh.reset();var Nh=["connection","include","skip","client","rest","export","nonreactive","stream"],Eh=Sh,Ah=Object.assign(function(e,t,n){if(t&&n&&n.connection&&n.connection.key){if(n.connection.filter&&n.connection.filter.length>0){const e=n.connection.filter?n.connection.filter:[];e.sort();const r={};e.forEach(e=>{r[e]=t[e]});const i=Eh(r);if("{}"!==i)return`${n.connection.key}(${i})`}return n.connection.key}let r=e;if(t){const e=Eh(t);"{}"!==e&&(r+=`(${e})`)}return n&&Object.keys(n).forEach(e=>{-1===Nh.indexOf(e)&&(n[e]&&Object.keys(n[e]).length?r+=`@${e}(${Eh(n[e])})`:r+=`@${e}`)}),r},{setStringify(e){const t=Eh;return Eh=e,t}});function Th(e){return!!e.errors?.length}function Ph(e,t,n){const r=new Set(e),i=r.size;return Xl(t,{Directive(e){if(r.delete(e.name.value)&&(!n||!r.size))return Wl}}),n?!r.size:r.size<i}function Mh(e){let t=!1;return Xl(e,{Directive:{enter(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some(e=>"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value),t))return Wl}}}),t}var Ih=Array.isArray;function Rh(e){return"Field"===e.kind}function Dh(e){return Array.isArray(e)&&e.length>0}function Lh(e){return{__ref:String(e)}}function Vh(e){let t=e[0]||{};const n=e.length;if(n>1){const r=new mh;for(let i=1;i<n;++i)t=r.merge(t,e[i])}return t}function Qh(e,t){return ch(e,t,t.variables&&{variables:ch({...e&&e.variables,...t.variables})})}function jh(e){return e.catch(()=>{}),e}function Fh(e,t){sh(t);const n=Bh(""),r=Bh(""),i=e=>{for(let t,i=0;i<e.length&&(t=e[i]);++i)if(!Ih(t)){if("OperationDefinition"===t.kind)return n(t.name&&t.name.value);if("FragmentDefinition"===t.kind)return r(t.name.value)}return Pu.error(14),null};let a=0;for(let m=t.definitions.length-1;m>=0;--m)"OperationDefinition"===t.definitions[m].kind&&++a;const o=function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return e.forEach(e=>{e&&(e.name?t.set(e.name,e):e.test&&n.set(e.test,e))}),e=>{let r=t.get(e.name.value);return!r&&n.size&&n.forEach((t,n)=>{n(e)&&(r=t)}),r}}(e),s=e=>Dh(e)&&e.map(o).some(e=>e&&e.remove),l=/* @__PURE__ */new Map;let c=!1;const d={enter(e){if(s(e.directives))return c=!0,null}},u=Xl(t,{Field:d,InlineFragment:d,VariableDefinition:{enter:()=>!1},Variable:{enter(e,t,n,r,a){const o=i(a);o&&o.variables.add(e.name.value)}},FragmentSpread:{enter(e,t,n,r,a){if(s(e.directives))return c=!0,null;const o=i(a);o&&o.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter(e,t,n,r){l.set(JSON.stringify(r),e)},leave:(e,t,n,i)=>e===l.get(JSON.stringify(i))?e:a>0&&e.selectionSet.selections.every(e=>"Field"===e.kind&&"__typename"===e.name.value)?(r(e.name.value).removed=!0,c=!0,null):void 0},Directive:{leave(e){if(o(e))return c=!0,null}}});if(!c)return t;const h=e=>(e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach(t=>{h(r(t)).transitiveVars.forEach(t=>{e.transitiveVars.add(t)})})),e),f=/* @__PURE__ */new Set;u.definitions.forEach(e=>{"OperationDefinition"===e.kind?h(n(e.name&&e.name.value)).fragmentSpreads.forEach(e=>{f.add(e)}):"FragmentDefinition"!==e.kind||0!==a||r(e.name.value).removed||f.add(e.name.value)}),f.forEach(e=>{h(r(e)).fragmentSpreads.forEach(e=>{f.add(e)})});const p={enter(e){if(t=e.name.value,!f.has(t)||r(t).removed)return null;var t}};return function(e){return qh(wh(e)||function(e){Pu("Document"===e.kind,6),Pu(e.definitions.length<=1,7);const t=e.definitions[0];return Pu("FragmentDefinition"===t.kind,8),t}(e),dh(yh(e)))?null:e}(Xl(u,{FragmentSpread:p,FragmentDefinition:p,OperationDefinition:{leave(e){if(e.variableDefinitions){const t=h(n(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return{...e,variableDefinitions:e.variableDefinitions.filter(e=>t.has(e.variable.name.value))}}}}}))}function Bh(e){const t=/* @__PURE__ */new Map;return function(n=e){let r=t.get(n);return r||t.set(n,r={variables:/* @__PURE__ */new Set,fragmentSpreads:/* @__PURE__ */new Set}),r}}function qh(e,t){return!e||e.selectionSet.selections.every(e=>"FragmentSpread"===e.kind&&qh(t[e.name.value],t))}function Zh(e){return Xl(e,{FragmentSpread(e){if(!e.directives?.some(({name:e})=>"unmask"===e.value))return null}})}function Uh(e){return e.alias?e.alias.value:e.name.value}function Wh({directives:e},t){return!e||!e.length||function(e){const t=[];return e&&e.length&&e.forEach(e=>{if(!function({name:{value:e}}){return"skip"===e||"include"===e}(e))return;const n=e.arguments,r=e.name.value;Pu(n&&1===n.length,16,r);const i=n[0];Pu(i.name&&"if"===i.name.value,17,r);const a=i.value;Pu(a&&("Variable"===a.kind||"BooleanValue"===a.kind),18,r),t.push({directive:e,ifArgument:i})}),t}(e).every(({directive:e,ifArgument:n})=>{let r=!1;return"Variable"===n.value.kind?(r=t&&t[n.value.name.value],Pu(void 0!==r,15,e.name.value)):r=n.value.value,"skip"===e.name.value?!r:r})}function Xh(e){const t={data:e.data};return e.error&&(t.error=e.error),t}function Hh(e,t=()=>{}){return n=>new zd(r=>{let i=t();return n.subscribe({next(t){let n;try{n=e(t,i)}catch(vAe){r.error(vAe)}void 0!==n&&r.next(n)},error(e){r.error(e)},complete(){r.complete()}})})}var{toString:Yh,hasOwnProperty:_h}=Object.prototype,Gh=Function.prototype.toString,Kh=/* @__PURE__ */new Map;function Jh(e,t){try{return $h(e,t)}finally{Kh.clear()}}function $h(e,t){if(e===t)return!0;const n=Yh.call(e);if(n!==Yh.call(t))return!1;switch(n){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":{if(rf(e,t))return!0;const n=ef(e),r=ef(t),i=n.length;if(i!==r.length)return!1;for(let e=0;e<i;++e)if(!_h.call(t,n[e]))return!1;for(let a=0;a<i;++a){const r=n[a];if(!$h(e[r],t[r]))return!1}return!0}case"[object Error]":return e.name===t.name&&e.message===t.message;case"[object Number]":if(e!=e)return t!=t;case"[object Boolean]":case"[object Date]":return+e===+t;case"[object RegExp]":case"[object String]":return e==`${t}`;case"[object Map]":case"[object Set]":{if(e.size!==t.size)return!1;if(rf(e,t))return!0;const r=e.entries(),i="[object Map]"===n;for(;;){const e=r.next();if(e.done)break;const[n,a]=e.value;if(!t.has(n))return!1;if(i&&!$h(a,t.get(n)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":e=new Uint8Array(e),t=new Uint8Array(t);case"[object DataView]":{let n=e.byteLength;if(n===t.byteLength)for(;n--&&e[n]===t[n];);return-1===n}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const n=Gh.call(e);return n===Gh.call(t)&&!function(e,t){const n=e.length-t.length;return n>=0&&e.indexOf(t,n)===n}(n,nf)}}return!1}function ef(e){return Object.keys(e).filter(tf,e)}function tf(e){return void 0!==this[e]}var nf="{ [native code] }";function rf(e,t){let n=Kh.get(e);if(n){if(n.has(t))return!0}else Kh.set(e,n=/* @__PURE__ */new Set);return n.add(t),!1}function af(e,{data:t,...n},{data:r,...i},a){return Jh(n,i)&&of(xh(e).selectionSet,t,r,{fragmentMap:dh(yh(e)),variables:a})}function of(e,t,n,r){if(t===n)return!0;const i=/* @__PURE__ */new Set;return e.selections.every(e=>{if(i.has(e))return!0;if(i.add(e),!Wh(e,r.variables))return!0;if(sf(e))return!0;if(Rh(e)){const i=Uh(e),a=t&&t[i],o=n&&n[i],s=e.selectionSet;if(!s)return Jh(a,o);const l=Array.isArray(a),c=Array.isArray(o);if(l!==c)return!1;if(l&&c){const e=a.length;if(o.length!==e)return!1;for(let t=0;t<e;++t)if(!of(s,a[t],o[t],r))return!1;return!0}return of(s,a,o,r)}{const i=vh(e,r.fragmentMap);if(i)return!!sf(i)||of(i.selectionSet,t,n,r)}})}function sf(e){return!!e.directives&&e.directives.some(lf)}function lf(e){return"nonreactive"===e.name.value}var cf=oh(function(e,t,n){return function(e,t){let n,r;function i(e){return e!==n&&(n=e,r=t(n)),r}return Object.assign(e.pipe(hu(i),xu({bufferSize:1,refCount:!0})),{getCurrentResult:()=>i(e.getCurrentResult())})}(e,n)},{max:1,makeCacheKey:e=>e.slice(0,2)}),df=Symbol.for("apollo.result.extensions"),uf=Symbol.for("apollo.result.streamInfo"),hf=Symbol.for("apollo.observableQuery.variablesUnknown"),ff=null,pf={},mf=1;function gf(e){try{return e()}catch(t){}}var vf="@wry/context:Slot",bf=gf(()=>globalThis)||gf(()=>global)||Object.create(null),yf=bf[vf]||Array[vf]||function(e){try{Object.defineProperty(bf,vf,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(class{constructor(){this.id=["slot",mf++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=ff;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===pf)break;return e!==ff&&(ff.slots[this.id]=t),!0}return ff&&(ff.slots[this.id]=pf),!1}getValue(){if(this.hasValue())return ff.slots[this.id]}withValue(e,t,n,r){const i={__proto__:null,[this.id]:e},a=ff;ff={parent:a,slots:i};try{return t.apply(r,n)}finally{ff=a}}static bind(e){const t=ff;return function(){const n=ff;try{return ff=t,e.apply(this,arguments)}finally{ff=n}}}static noContext(e,t,n){if(!ff)return e.apply(n,t);{const r=ff;try{return ff=null,e.apply(n,t)}finally{ff=r}}}}),{bind:xf,noContext:wf}=yf,Of=new yf,{hasOwnProperty:kf}=Object.prototype,Sf=Array.from||function(e){const t=[];return e.forEach(e=>t.push(e)),t};function Cf(e){const{unsubscribe:t}=e;"function"==typeof t&&(e.unsubscribe=void 0,t())}var zf=[];function Nf(e,t){if(!e)throw new Error(t||"assertion failure")}function Ef(e,t){const n=e.length;return n>0&&n===t.length&&e[n-1]===t[n-1]}function Af(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}function Tf(e){return e.slice(0)}var Pf=class e{constructor(t){this.fn=t,this.parents=/* @__PURE__ */new Set,this.childValues=/* @__PURE__ */new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++e.count}peek(){if(1===this.value.length&&!Rf(this))return Mf(this),this.value[0]}recompute(e){return Nf(!this.recomputing,"already recomputing"),Mf(this),Rf(this)?function(e,t){return Bf(e),Of.withValue(e,If,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{Cf(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(vAe){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,Rf(e)||Lf(e)}(e),Af(e.value)}(this,e):Af(this.value)}setDirty(){this.dirty||(this.dirty=!0,Df(this),Cf(this))}dispose(){this.setDirty(),Bf(this),Vf(this,(e,t)=>{e.setDirty(),qf(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=zf.pop()||/* @__PURE__ */new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Sf(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),zf.push(this.deps),this.deps=null)}};function Mf(e){const t=Of.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),Rf(e)?Qf(t,e):jf(t,e),t}function If(e,t){e.recomputing=!0;const{normalizeResult:n}=e;let r;n&&1===e.value.length&&(r=Tf(e.value)),e.value.length=0;try{if(e.value[0]=e.fn.apply(null,t),n&&r&&!Ef(r,e.value))try{e.value[0]=n(e.value[0],r[0])}catch(dX){}}catch(vAe){e.value[1]=vAe}e.recomputing=!1}function Rf(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function Df(e){Vf(e,Qf)}function Lf(e){Vf(e,jf)}function Vf(e,t){const n=e.parents.size;if(n){const r=Sf(e.parents);for(let i=0;i<n;++i)t(r[i],e)}}function Qf(e,t){Nf(e.childValues.has(t)),Nf(Rf(t));const n=!Rf(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=zf.pop()||/* @__PURE__ */new Set;e.dirtyChildren.add(t),n&&Df(e)}function jf(e,t){Nf(e.childValues.has(t)),Nf(!Rf(t));const n=e.childValues.get(t);0===n.length?e.childValues.set(t,Tf(t.value)):Ef(n,t.value)||e.setDirty(),Ff(e,t),Rf(e)||Lf(e)}function Ff(e,t){const n=e.dirtyChildren;n&&(n.delete(t),0===n.size&&(zf.length<100&&zf.push(n),e.dirtyChildren=null))}function Bf(e){e.childValues.size>0&&e.childValues.forEach((t,n)=>{qf(e,n)}),e.forgetDeps(),Nf(null===e.dirtyChildren)}function qf(e,t){t.parents.delete(e),e.childValues.delete(t),Ff(e,t)}Pf.count=0;var Zf,Uf={setDirty:!0,dispose:!0,forget:!0};function Wf(e){const t=/* @__PURE__ */new Map,n=e&&e.subscribe;function r(e){const r=Of.getValue();if(r){let i=t.get(e);i||t.set(e,i=/* @__PURE__ */new Set),r.dependOn(i),"function"==typeof n&&(Cf(i),i.unsubscribe=n(e))}}return r.dirty=function(e,n){const r=t.get(e);if(r){const i=n&&kf.call(Uf,n)?n:"setDirty";Sf(r).forEach(e=>e[i]()),t.delete(e),Cf(r)}},r}function Xf(...e){return(Zf||(Zf=new Hu("function"==typeof WeakMap))).lookupArray(e)}var Hf=/* @__PURE__ */new Set;function Yf(e,{max:t=Math.pow(2,16),keyArgs:n,makeCacheKey:r=Xf,normalizeResult:i,subscribe:a,cache:o=_u}=Object.create(null)){const s="function"==typeof o?new o(t,e=>e.dispose()):o,l=function(){const t=r.apply(null,n?n.apply(null,arguments):arguments);if(void 0===t)return e.apply(null,arguments);let o=s.get(t);o||(s.set(t,o=new Pf(e)),o.normalizeResult=i,o.subscribe=a,o.forget=()=>s.delete(t));const l=o.recompute(Array.prototype.slice.call(arguments));return s.set(t,o),Hf.add(s),Of.hasValue()||(Hf.forEach(e=>e.clean()),Hf.clear()),l};function c(e){const t=e&&s.get(e);t&&t.setDirty()}function d(e){const t=e&&s.get(e);if(t)return t.peek()}function u(e){return!!e&&s.delete(e)}return Object.defineProperty(l,"size",{get:()=>s.size,configurable:!1,enumerable:!1}),Object.freeze(l.options={max:t,keyArgs:n,makeCacheKey:r,normalizeResult:i,subscribe:a,cache:s}),l.dirtyKey=c,l.dirty=function(){c(r.apply(null,arguments))},l.peekKey=d,l.peek=function(){return d(r.apply(null,arguments))},l.forgetKey=u,l.forget=function(){return u(r.apply(null,arguments))},l.makeCacheKey=r,l.getKey=n?function(){return r.apply(null,n.apply(null,arguments))}:r,Object.freeze(l)}function _f(...e){return Xf.bind(null,...e)}var Gf=class{isIncrementalResult(e){return!1}prepareRequest(e){return Pu(!Ph(["defer","stream"],e.query),67),e}extractErrors(){}startRequest=void 0},Kf=class e{static empty(){return new e(()=>Zd)}static from(t){if(0===t.length)return e.empty();const[n,...r]=t;return n.concat(...r)}static split(t,n,r=new e((e,t)=>t(e))){const i=new e((e,i)=>t(e)?n.request(e,i):r.request(e,i));return Object.assign(i,{left:n,right:r})}static execute(e,t,n){return e.request(function(e,{client:t}){const n={query:e.query,variables:e.variables||{},extensions:e.extensions||{},operationName:qu(e.query),operationType:wh(e.query).operation};let r={...e.context};const i=()=>Object.freeze({...r});return Object.defineProperty(n,"setContext",{enumerable:!1,value:e=>{r="function"==typeof e?{...r,...e(i())}:{...r,...e}}}),Object.defineProperty(n,"getContext",{enumerable:!1,value:i}),Object.defineProperty(n,"client",{enumerable:!1,value:t}),n}(t,n),()=>Zd)}static concat(...t){return e.from(t)}constructor(e){e&&(this.request=e)}split(t,n,r){return this.concat(e.split(t,n,r))}concat(...e){return 0===e.length?this:e.reduce(this.combine.bind(this),this)}combine(t,n){const r=new e((e,r)=>t.request(e,e=>n.request(e,r)));return Object.assign(r,{left:t,right:n})}request(e,t){throw Iu(65)}left;right},Jf=Kf.execute;function $f(e){return e}var ep,tp=class e{transform;cached;resultCache=/* @__PURE__ */new WeakSet;getCacheKey(e){return[e]}static identity(){return new e($f,{cache:!1})}static split(t,n,r=e.identity()){return Object.assign(new e(e=>(t(e)?n:r).transformDocument(e),{cache:!1}),{left:n,right:r})}constructor(e,t={}){this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=!1!==t.cache,this.resetCache()}resetCache(){if(this.cached){const t=new Hu;this.performWork=Yf(e.prototype.performWork.bind(this),{makeCacheKey:e=>{const n=this.getCacheKey(e);if(n)return Pu(Array.isArray(n),20),t.lookupArray(n)},max:Bu["documentTransform.cache"],cache:th})}}performWork(e){return sh(e),this.transform(e)}transformDocument(e){if(this.resultCache.has(e))return e;const t=this.performWork(e);return this.resultCache.add(t),t}concat(t){return Object.assign(new e(e=>t.transformDocument(this.transformDocument(e)),{cache:!1}),{left:this,right:t})}left;right},np=Object.assign(e=>{let t=ep.get(e);return t||(t=function(e){return Xl(e,Yl)}(e),ep.set(e,t)),t},{reset(){ep=new ih(Bu.print||2e3)}});function rp(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}np.reset();var ip={kind:Zs,name:{kind:Qs,value:"__typename"}},ap=Object.assign(function(e){return Xl(e,{SelectionSet:{enter(e,t,n){if(n&&"OperationDefinition"===n.kind)return;const{selections:r}=e;if(!r)return;if(r.some(e=>"Field"===e.kind&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))))return;const i=n;return"Field"===i.kind&&i.directives&&i.directives.some(e=>"export"===e.name.value)?void 0:{...e,selections:[...r,ip]}}}})},{added:e=>e===ip});function op(e){return 7===e||8===e}function sp(e){return!op(e)}var lp=class{assumeImmutableResults=!1;lookupFragment(e){return null}batch(e){const t="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;let n;return this.performTransaction(()=>n=e.update(this),t),n}recordOptimisticTransaction(e,t){this.performTransaction(e,t)}transformDocument(e){return e}transformForLink(e){return e}identify(e){}gc(){return[]}modify(e){return!1}readQuery(e,t=!!e.optimistic){return this.read({...e,rootId:e.id||"ROOT_QUERY",optimistic:t})}fragmentWatches=new Hu(!0);watchFragment(e){const{fragment:t,fragmentName:n,from:r}=e,i=this.getFragmentDoc(t,n),a=(Array.isArray(r)?r:[r]).map(e=>null==e?e:this.toCacheId(e));if(!Array.isArray(r)){const t=this.watchSingleFragment(a[0],i,e);return null===r?t:cf(t,Symbol.for("apollo.transform.individualResult"),e=>({...e,data:e.data??{}}))}let o;function s(e){const t=e.reduce((e,t,n)=>(e.data.push(t.data),e.complete&&=t.complete,e.dataState=e.complete?"complete":"partial",t.missing&&(e.missing||={},e.missing[n]=t.missing),e),{data:[],dataState:"complete",complete:!0});return Jh(o,t)||(o=t),o}if(0===a.length)return hp;let l=!1;const c=a.map(t=>this.watchSingleFragment(t,i,e)),d=function(e){return 0===e.length?Zd:new zd(t=>{const{length:n}=e,r=new Array(n),i=/* @__PURE__ */new Map;e.forEach((e,t)=>{i.has(e)||i.set(e,/* @__PURE__ */new Set),i.get(e).add(t)});let a,o=i.size,s=i.size;i.forEach((n,i)=>{let l=!1;const c=i.subscribe({next:o=>{n.forEach(e=>r[e]=o),l||(l=!0,s--),s||(a||=new Set(e.filter(e=>e.dirty)),a.delete(i),a.size||(t.next(r.slice()),a=void 0))},complete:()=>{o--,o||t.complete()},error:t.error.bind(t)});t.add(c)})})}(c).pipe(hu(s),wu({subscribe:()=>l=!0,unsubscribe:()=>l=!1}),xu({bufferSize:1,refCount:!0}));return Object.assign(d,{getCurrentResult:()=>l&&o?o:s(c.map(e=>e.getCurrentResult()))})}onAfterBroadcast=e=>e();watchSingleFragment(e,t,n){if(null===e)return dp;const{optimistic:r=!0,variables:i}=n,a=[t,Sh({id:e,optimistic:r,variables:i})],o=this.fragmentWatches.lookupArray(a);if(!o.observable){let c,d=!1;function u(e){const r=e.result;return c&&af(t,{data:c.data},{data:r},n.variables)||(c={data:r,dataState:e.complete?"complete":"partial",complete:e.complete},e.missing&&(c.missing=e.missing.missing)),c}const h=new zd(n=>{d=!0;const o=this.watch({variables:i,returnPartialData:!0,id:e,query:t,optimistic:r,immediate:!0,callback:e=>{h.dirty=!0,this.onAfterBroadcast(()=>{n.next(u(e)),h.dirty=!1})}});return()=>{d=!1,o(),this.fragmentWatches.removeArray(a)}}).pipe((void 0===l&&(l=Cd),s=null!=s?s:vu,Ed(function(e,t){var n,r=!0;e.subscribe(Ad(t,function(e){var i=l(e);!r&&s(n,i)||(r=!1,n=i,t.next(e))}))})),bu({connector:()=>new Ld(1),resetOnRefCountZero:()=>function(e,t,n){void 0===e&&(e=0),void 0===n&&(n=qd);var r=-1;return null!=t&&(Ud(t)?n=t:r=t),new zd(function(t){var i,a=(i=e)instanceof Date&&!isNaN(i)?+e-n.now():e;a<0&&(a=0);var o=0;return n.schedule(function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())},a)})}(0)}));o.observable=Object.assign(h,{dirty:!1,getCurrentResult:()=>d&&c?c:u(this.diff({id:e,query:t,returnPartialData:!0,optimistic:r,variables:i}))})}var s,l;return o.observable}getFragmentDoc=Yf(bh,{max:Bu["cache.fragmentQueryDocuments"]||1e3,cache:th,makeCacheKey:_f(this)});readFragment(e,t=!!e.optimistic){const n=void 0!==e.from?this.toCacheId(e.from):e.id;return this.read({...e,query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:n,optimistic:t})}writeQuery({id:e,data:t,...n}){return this.write(Object.assign(n,{dataId:e||"ROOT_QUERY",result:t}))}writeFragment({data:e,fragment:t,fragmentName:n,...r}){const i=void 0!==r.from?this.toCacheId(r.from):r.id;return this.write(Object.assign(r,{query:this.getFragmentDoc(t,n),dataId:i,result:e}))}updateQuery(e,t){return this.batch({update(n){const r=n.readQuery(e),i=t(r);return null==i?r:(n.writeQuery({...e,data:i}),i)}})}updateFragment(e,t){return this.batch({update(n){const r=n.readFragment(e),i=t(r);return null==i?r:(n.writeFragment({...e,data:i}),i)}})}toCacheId(e){return"string"==typeof e?e:this.identify(e)}},cp=Object.freeze({data:null,dataState:"complete",complete:!0}),dp=Object.assign(new zd(e=>{e.next(cp)}),{dirty:!1,getCurrentResult:()=>cp}),up=Object.freeze({data:[],dataState:"complete",complete:!0}),hp=Object.assign(new zd(e=>{e.next(up)}),{getCurrentResult:()=>up}),fp=class e extends Error{message;path;query;variables;constructor(t,n,r,i){if(super(t),this.message=t,this.path=n,this.query=r,this.variables=i,this.name="MissingFieldError",Array.isArray(this.path)){this.missing=this.message;for(let e=this.path.length-1;e>=0;--e)this.missing={[this.path[e]]:this.missing}}else this.missing=this.path;this.__proto__=e.prototype}missing},{hasOwnProperty:pp}=Object.prototype;function mp({__typename:e,id:t,_id:n},r){if("string"==typeof e&&(r&&(r.keyObject=null!=t?{id:t}:null!=n?{_id:n}:void 0),null==t&&null!=n&&(t=n),null!=t))return`${e}:${"number"==typeof t||"string"==typeof t?t:JSON.stringify(t)}`}var gp={dataIdFromObject:mp,resultCaching:!0},vp=/^[_a-z][_0-9a-z]*/i;function bp(e){const t=e.match(vp);return t?t[0]:e}function yp(e,t,n){return!!uh(t)&&(Ih(t)?t.every(t=>yp(e,t,n)):e.selections.every(e=>{if(Rh(e)&&Wh(e,n)){const r=Uh(e);return pp.call(t,r)&&(!e.selectionSet||yp(e.selectionSet,t[r],n))}return!0}))}function xp(e){return uh(e)&&!rp(e)&&!Ih(e)}function wp(e,t){const n=dh(yh(e));return{fragmentMap:n,lookupFragment(e){let r=n[e];return!r&&t&&(r=t.lookup(e)),r||null}}}var Op={},kp=()=>Op,Sp={},Cp=class{policies;group;data={};constructor(e,t){this.policies=e,this.group=t}toObject(){return{...this.data}}has(e){return void 0!==this.lookup(e,!0)}get(e,t){if(this.group.depend(e,t),pp.call(this.data,e)){const n=this.data[e];if(n&&pp.call(n,t))return n[t]}return"__typename"===t&&pp.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ap?this.parent.get(e,t):void 0}lookup(e,t){return t&&this.group.depend(e,"__exists"),pp.call(this.data,e)?this.data[e]:this instanceof Ap?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?{}:void 0}merge(e,t){let n;rp(e)&&(e=e.__ref),rp(t)&&(t=t.__ref);const r="string"==typeof e?this.lookup(n=e):e,i="string"==typeof t?this.lookup(n=t):t;if(!i)return;Pu("string"==typeof n,104);const a=new mh({reconciler:Pp}).merge(r,i);if(this.data[n]=a,a!==r&&(delete this.refs[n],this.group.caching)){const e={};r||(e.__exists=1),Object.keys(i).forEach(t=>{if(!r||r[t]!==a[t]){e[t]=1;const n=bp(t);n===t||this.policies.hasKeyArgs(a.__typename,n)||(e[n]=1),void 0!==a[t]||this instanceof Ap||delete a[t]}}),!e.__typename||r&&r.__typename||this.policies.rootTypenamesById[n]!==a.__typename||delete e.__typename,Object.keys(e).forEach(e=>this.group.dirty(n,e))}}modify(e,t,n){const r=this.lookup(e);if(r){const i={};let a=!1,o=!0;const s={DELETE:Op,INVALIDATE:Sp,isReference:rp,toReference:this.toReference,canRead:this.canRead,readField:(t,n)=>this.policies.readField("string"==typeof t?{fieldName:t,from:n||Lh(e)}:t,{store:this})};if(Object.keys(r).forEach(l=>{const c=bp(l);let d=r[l];if(void 0===d)return;const u="function"==typeof t?t:t[l]||(n?void 0:t[c]);if(u){let t=u===kp?Op:u(d,{...s,fieldName:c,storeFieldName:l,storage:this.getStorage(e,l)});t===Sp?this.group.dirty(e,l):(t===Op&&(t=void 0),t!==d&&(i[l]=t,a=!0,d=t))}void 0!==d&&(o=!1)}),a)return this.merge(e,i),o&&(this instanceof Ap?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1}delete(e,t,n){const r=this.lookup(e);if(r){const i=this.getFieldValue(r,"__typename"),a=t&&n?this.policies.getStoreFieldName({typename:i,fieldName:t,args:n}):t;return this.modify(e,a?{[a]:kp}:kp,!!n)}return!1}evict(e,t){let n=!1;return e.id&&(pp.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Ap&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n}clear(){this.replace(null)}extract(){const e=this.toObject(),t=[];return this.getRootIdSet().forEach(e=>{pp.call(this.policies.rootTypenamesById,e)||t.push(e)}),t.length&&(e.__META={extraRootIds:t.sort()}),e}replace(e){if(Object.keys(this.data).forEach(t=>{e&&pp.call(e,t)||this.delete(t)}),e){const{__META:t,...n}=e;Object.keys(n).forEach(e=>{this.merge(e,n[e])}),t&&t.extraRootIds.forEach(this.retain,this)}}rootIds={};retain(e){return this.rootIds[e]=(this.rootIds[e]||0)+1}release(e){if(this.rootIds[e]>0){const t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0}getRootIdSet(e=/* @__PURE__ */new Set){return Object.keys(this.rootIds).forEach(e.add,e),this instanceof Ap?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e}gc(){const e=this.getRootIdSet(),t=this.toObject();e.forEach(n=>{pp.call(t,n)&&(Object.keys(this.findChildRefIds(n)).forEach(e.add,e),delete t[n])});const n=Object.keys(t);if(n.length){let e=this;for(;e instanceof Ap;)e=e.parent;n.forEach(t=>e.delete(t))}return n}refs={};findChildRefIds(e){if(!pp.call(this.refs,e)){const t=this.refs[e]={},n=this.data[e];if(!n)return t;const r=/* @__PURE__ */new Set([n]);r.forEach(e=>{rp(e)&&(t[e.__ref]=!0),uh(e)&&Object.keys(e).forEach(t=>{const n=e[t];uh(n)&&r.add(n)})})}return this.refs[e]}makeCacheKey(){return this.group.keyMaker.lookupArray(arguments)}getFieldValue=(e,t)=>rp(e)?this.get(e.__ref,t):e&&e[t];canRead=e=>rp(e)?this.has(e.__ref):"object"==typeof e;toReference=(e,t)=>{if("string"==typeof e)return Lh(e);if(rp(e))return e;const[n]=this.policies.identify(e);if(n){const r=Lh(n);return t&&this.merge(n,e),r}};get supportsResultCaching(){return this.group.caching}},zp=class{caching;parent;d=null;keyMaker;constructor(e,t=null){this.caching=e,this.parent=t,this.resetCaching()}resetCaching(){this.d=this.caching?Wf():null,this.keyMaker=new Hu}depend(e,t){if(this.d){this.d(Np(e,t));const n=bp(t);n!==t&&this.d(Np(e,n)),this.parent&&this.parent.depend(e,t)}}dirty(e,t){this.d&&this.d.dirty(Np(e,t),"__exists"===t?"forget":"setDirty")}};function Np(e,t){return t+"#"+e}function Ep(e,t){Mp(e)&&e.group.depend(t,"__exists")}Cp.Root=class extends Cp{constructor({policies:e,resultCaching:t=!0,seed:n}){super(e,new zp(t)),n&&this.replace(n)}stump=new Tp(this);addLayer(e,t){return this.stump.addLayer(e,t)}removeLayer(){return this}storageTrie=new Hu;getStorage(){return this.storageTrie.lookupArray(arguments)}};var Ap=class e extends Cp{id;parent;replay;group;constructor(e,t,n,r){super(t.policies,r),this.id=e,this.parent=t,this.replay=n,this.group=r,n(this)}addLayer(t,n){return new e(t,this,n,this.group)}removeLayer(e){const t=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach(e=>{const n=this.data[e],r=t.lookup(e);r?n?n!==r&&Object.keys(n).forEach(t=>{Jh(n[t],r[t])||this.group.dirty(e,t)}):(this.group.dirty(e,"__exists"),Object.keys(r).forEach(t=>{this.group.dirty(e,t)})):this.delete(e)}),t):t===this.parent?this:t.addLayer(this.id,this.replay)}toObject(){return{...this.parent.toObject(),...this.data}}findChildRefIds(e){const t=this.parent.findChildRefIds(e);return pp.call(this.data,e)?{...t,...super.findChildRefIds(e)}:t}getStorage(...e){let t=this.parent;for(;t.parent;)t=t.parent;return t.getStorage(...e)}},Tp=class extends Ap{constructor(e){super("EntityStore.Stump",e,()=>{},new zp(e.group.caching,e.group))}removeLayer(){return this}merge(e,t){return this.parent.merge(e,t)}};function Pp(e,t,n){const r=e[n],i=t[n];return Jh(r,i)?r:i}function Mp(e){return!(!e||!e.supportsResultCaching)}var Ip=new yf;function Rp(e){const t=e.directives?.find(({name:e})=>"unmask"===e.value);if(!t)return"mask";const n=t.arguments?.find(({name:e})=>"mode"===e.value);return n&&"value"in n.value&&"migrate"===n.value.value?"migrate":"unmask"}function Dp(e,t,n){return Ip.withValue(!0,()=>{const r=Lp(e,t,n,!1);return Object.isFrozen(e),r})}function Lp(e,t,n,r,i){const{knownChanged:a}=n,o=function(e,t){if(t.has(e))return t.get(e);const n=Array.isArray(e)?[]:{};return t.set(e,n),n}(e,n.mutableTargets);if(Array.isArray(e)){for(const[i,s]of Array.from(e.entries())){if(null===s){o[i]=null;continue}const e=Lp(s,t,n,r,void 0);a.has(e)&&a.add(o),o[i]=e}return a.has(o)?o:e}for(const s of t.selections){let t;if(r&&a.add(o),"Field"===s.kind){const i=Uh(s),l=s.selectionSet;if(t=o[i]||e[i],void 0===t)continue;if(l&&null!==t){const o=Lp(e[i],l,n,r,void 0);a.has(o)&&(t=o)}o[i]=t}if("InlineFragment"!==s.kind||s.typeCondition&&!n.cache.fragmentMatches(s,e.__typename)||(t=Lp(e,s.selectionSet,n,r,i)),"FragmentSpread"===s.kind){const r=s.name.value,a=n.fragmentMap[r]||(n.fragmentMap[r]=n.cache.lookupFragment(r));Pu(a,39,r);const o=Rp(s);"mask"!==o&&(t=Lp(e,a.selectionSet,n,"migrate"===o,i))}a.has(t)&&a.add(o)}return"__typename"in e&&!("__typename"in o)&&(o.__typename=e.__typename),Object.keys(o).length!==Object.keys(e).length&&a.add(o),a.has(o)?o:e}var Vp={};function Qp(e){const t=JSON.stringify(e);return Vp[t]||(Vp[t]={})}function jp(e){const t=Qp(e);return t.keyFieldsFn||(t.keyFieldsFn=(t,n)=>{const r=(e,t)=>n.readField(t,e),i=n.keyObject=Bp(e,e=>{let i=Up(n.storeObject,e,r);return void 0===i&&t!==n.storeObject&&pp.call(t,e[0])&&(i=Up(t,e,Zp)),Pu(void 0!==i,107,e.join("."),t),i});return`${n.typename}:${JSON.stringify(i)}`})}function Fp(e){const t=Qp(e);return t.keyArgsFn||(t.keyArgsFn=(t,{field:n,variables:r,fieldName:i})=>{const a=Bp(e,e=>{const i=e[0],a=i.charAt(0);if("@"!==a){if("$"===a){const t=i.slice(1);if(r&&pp.call(r,t)){const n=e.slice(0);return n[0]=t,Up(r,n)}return}if(t)return Up(t,e)}else if(n&&Dh(n.directives)){const t=i.slice(1),a=n.directives.find(e=>e.name.value===t),o=a&&ju(a,r);return o&&Up(o,e.slice(1))}}),o=JSON.stringify(a);return(t||"{}"!==o)&&(i+=":"+o),i})}function Bp(e,t){const n=new mh;return qp(e).reduce((e,r)=>{let i=t(r);if(void 0!==i){for(let e=r.length-1;e>=0;--e)i={[r[e]]:i};e=n.merge(e,i)}return e},{})}function qp(e){const t=Qp(e);if(!t.paths){const n=t.paths=[],r=[];e.forEach((t,i)=>{Ih(t)?(qp(t).forEach(e=>n.push(r.concat(e))),r.length=0):(r.push(t),Ih(e[i+1])||(n.push(r.slice(0)),r.length=0))})}return t.paths}function Zp(e,t){return e[t]}function Up(e,t,n){return n=n||Zp,Wp(t.reduce(function e(t,r){return Ih(t)?t.map(t=>e(t,r)):t&&n(t,r)},e))}function Wp(e){return uh(e)?Ih(e)?e.map(Wp):Bp(Object.keys(e).sort(),t=>Up(e,t)):e}var Xp=new yf,Hp=/* @__PURE__ */new WeakMap;function Yp(e){let t=Hp.get(e);return t||Hp.set(e,t={vars:/* @__PURE__ */new Set,dep:Wf()}),t}function _p(e){Yp(e).vars.forEach(t=>t.forgetCache(e))}function Gp(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set,r=function(a){if(arguments.length>0){if(e!==a){e=a,t.forEach(e=>{Yp(e).dep.dirty(r),function(e){e.broadcastWatches&&e.broadcastWatches()}(e)});const i=Array.from(n);n.clear(),i.forEach(t=>t(e))}}else{const e=Xp.getValue();e&&(i(e),Yp(e).dep(r))}return e};r.onNextChange=e=>(n.add(e),()=>{n.delete(e)});const i=r.attachCache=e=>(t.add(e),Yp(e).vars.add(r),r);return r.forgetCache=e=>t.delete(e),r}function Kp(e){return void 0!==e.args?e.args:e.field?ju(e.field,e.variables):null}var Jp=()=>{},$p=(e,t)=>t.fieldName,em=(e,t,{mergeObjects:n})=>n(e,t),tm=(e,t)=>t,nm=(e,t,{streamFieldInfo:n,existingData:r})=>{if(!e&&!r)return t;const i=[],a=e??r,o=n?.isLastChunk?t.length:Math.max(a.length,t.length);for(let s=0;s<o;s++)i[s]=void 0===t[s]?a[s]:t[s];return i},rm=class{config;typePolicies={};toBeAdded={};supertypeMap=/* @__PURE__ */new Map;fuzzySubtypes=/* @__PURE__ */new Map;cache;rootIdsByTypename={};rootTypenamesById={};usingPossibleTypes=!1;constructor(e){this.config=e,this.config={dataIdFromObject:mp,...e},this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}identify(e,t){const n=this,r=t&&(t.typename||t.storeObject?.__typename)||e.__typename;if(r===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];const i=t&&t.storeObject||e,a={...t,typename:r,storeObject:i,readField:t&&t.readField||((...e)=>{const t=am(e,i);return n.readField(t,{store:n.cache.data,variables:t.variables})})};let o;const s=r&&this.getTypePolicy(r);let l=s&&s.keyFn||this.config.dataIdFromObject;return Ip.withValue(!0,()=>{for(;l;){const t=l({...e,...i},a);if(!Ih(t)){o=t;break}l=jp(t)}}),o=o?String(o):void 0,a.keyObject?[o,a.keyObject]:[o]}addTypePolicies(e){Object.keys(e).forEach(t=>{const{queryType:n,mutationType:r,subscriptionType:i,...a}=e[t];n&&this.setRootTypename("Query",t),r&&this.setRootTypename("Mutation",t),i&&this.setRootTypename("Subscription",t),pp.call(this.toBeAdded,t)?this.toBeAdded[t].push(a):this.toBeAdded[t]=[a]})}updateTypePolicy(e,t,n){const r=this.getTypePolicy(e),{keyFields:i,fields:a}=t;function o(e,t){e.merge="function"==typeof t?t:!0===t?em:!1===t?tm:e.merge}o(r,t.merge),r.keyFn=!1===i?Jp:Ih(i)?jp(i):"function"==typeof i?i:r.keyFn,a&&Object.keys(a).forEach(t=>{let r=n[t];r&&r?.typename===e||(r=n[t]={typename:e});const i=a[t];if("function"==typeof i)r.read=i;else{const{keyArgs:e,read:t,merge:n}=i;r.keyFn=!1===e?$p:Ih(e)?Fp(e):"function"==typeof e?e:r.keyFn,"function"==typeof t&&(r.read=t),o(r,n)}r.read&&r.merge&&(r.keyFn=r.keyFn||$p)})}setRootTypename(e,t=e){const n="ROOT_"+e.toUpperCase(),r=this.rootTypenamesById[n];t!==r&&(Pu(!r||r===e,108,e),r&&delete this.rootIdsByTypename[r],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)}addPossibleTypes(e){this.usingPossibleTypes=!0,Object.keys(e).forEach(t=>{this.getSupertypeSet(t,!0),e[t].forEach(e=>{this.getSupertypeSet(e,!0).add(t);const n=e.match(vp);n&&n[0]===e||this.fuzzySubtypes.set(e,new RegExp(e))})})}getTypePolicy(e){if(!pp.call(this.typePolicies,e)){const t=this.typePolicies[e]={};t.fields={};let n=this.supertypeMap.get(e);!n&&this.fuzzySubtypes.size&&(n=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach((t,r)=>{if(t.test(e)){const e=this.supertypeMap.get(r);e&&e.forEach(e=>n.add(e))}})),n&&n.size&&n.forEach(e=>{const{fields:n,...r}=this.getTypePolicy(e);Object.assign(t,r),Object.assign(t.fields,n)})}const t=this.toBeAdded[e];return t&&t.length&&t.splice(0).forEach(t=>{this.updateTypePolicy(e,t,this.typePolicies[e].fields)}),this.typePolicies[e]}getFieldPolicy(e,t){if(e)return this.getTypePolicy(e).fields[t]}getSupertypeSet(e,t){let n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=/* @__PURE__ */new Set),n}fragmentMatches(e,t,n,r){if(!e.typeCondition)return!0;if(!t)return!1;const i=e.typeCondition.name.value;if(t===i)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(i)){const a=this.getSupertypeSet(t,!0),o=[a],s=e=>{const t=this.getSupertypeSet(e,!1);t&&t.size&&o.indexOf(t)<0&&o.push(t)};let l=!(!n||!this.fuzzySubtypes.size),c=!1;for(let d=0;d<o.length;++d){const u=o[d];if(u.has(i))return a.has(i)||a.add(i),!0;u.forEach(s),l&&d===o.length-1&&yp(e.selectionSet,n,r)&&(l=!1,c=!0,this.fuzzySubtypes.forEach((e,n)=>{const r=t.match(e);r&&r[0]===t&&s(n)}))}}return!1}hasKeyArgs(e,t){const n=this.getFieldPolicy(e,t);return!(!n||!n.keyFn)}getStoreFieldName(e){const{typename:t,fieldName:n}=e,r=this.getFieldPolicy(t,n);let i,a=r&&r.keyFn;if(a&&t){const r={typename:t,fieldName:n,field:e.field||null,variables:e.variables},o=Kp(e);for(;a;){const e=a(o,r);if(!Ih(e)){i=e||n;break}a=Fp(e)}}return void 0===i&&(i=e.field?function(e,t){let n=null;e.directives&&(n={},e.directives.forEach(e=>{n[e.name.value]={},e.arguments&&e.arguments.forEach(({name:r,value:i})=>Qu(n[e.name.value],r,i,t))}));let r=null;return e.arguments&&e.arguments.length&&(r={},e.arguments.forEach(({name:e,value:n})=>Qu(r,e,n,t))),Ah(e.name.value,r,n)}(e.field,e.variables):Ah(n,Kp(e))),!1===i?n:n===bp(i)?i:n+":"+i}readField(e,t){const n=e.from;if(!n)return;if(!e.field&&!e.fieldName)return;if(void 0===e.typename){const r=t.store.getFieldValue(n,"__typename");r&&(e.typename=r)}const r=this.getStoreFieldName(e),i=bp(r),a=t.store.getFieldValue(n,r),o=this.getFieldPolicy(e.typename,i),s=o&&o.read;if(s){const i=im(this,n,e,t,t.store.getStorage(rp(n)?n.__ref:n,r));return Xp.withValue(this.cache,s,[a,i])}return a}getReadFunction(e,t){const n=this.getFieldPolicy(e,t);return n&&n.read}getMergeFunction(e,t,n){let r=this.getFieldPolicy(e,t),i=r&&r.merge;return!i&&n&&(r=this.getTypePolicy(n),i=r&&r.merge),i}runMergeFunction(e,t,{field:n,typename:r,merge:i,path:a},o,s){const l=e;if(i===em)return om(o.store)(e,t);if(i===tm)return t;o.overwrite&&(e=void 0);const c=o.extensions?.[uf]?.deref()?.peekArray(a);if(c){const{current:e,previous:n}=c;if(n&&Jh(n.incoming,t)&&Jh(n.streamFieldInfo,e))return n.result}const d=i(e,t,function(e,t,n,r,i,a){const o={...im(e,void 0,n,r,i),extensions:r.extensions,existingData:a},s=r.extensions;if(s&&uf in s){const{[uf]:e,...t}=s,r=e?.deref()?.peekArray(n.path);r&&(o.streamFieldInfo=r.current),o.extensions=0===Object.keys(t).length?void 0:t}return o}(this,0,{typename:r,fieldName:n.name.value,field:n,variables:o.variables,path:a},o,s||{},l));return c&&(c.previous={incoming:t,streamFieldInfo:c.current,result:d}),d}};function im(e,t,n,r,i){const a=e.getStoreFieldName(n),o=bp(a),s=n.variables||r.variables,{toReference:l,canRead:c}=r.store;return{args:Kp(n),field:n.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:rp,toReference:l,storage:i,cache:e.cache,canRead:c,readField:(...n)=>e.readField(am(n,t,s),r),mergeObjects:om(r.store)}}function am(e,t,n){const{0:r,1:i,length:a}=e;let o;return"string"==typeof r?o={fieldName:r,from:a>1?i:t}:(o={...r},pp.call(o,"from")||(o.from=t)),void 0===o.variables&&(o.variables=n),o}function om(e){return function(t,n){if(Ih(t)||Ih(n))throw Iu(111);if(uh(t)&&uh(n)){const r=e.getFieldValue(t,"__typename"),i=e.getFieldValue(n,"__typename");if(r&&i&&r!==i)return n;if(rp(t)&&xp(n))return e.merge(t.__ref,n),t;if(xp(t)&&rp(n))return e.merge(t,n.__ref),n;if(xp(t)&&xp(n))return{...t,...n}}return n}}function sm(e){return[e.selectionSet,e.objectOrReference,e.context]}var lm=class{executeSelectionSet;executeSubSelectedArray;config;knownResults=/* @__PURE__ */new WeakMap;constructor(e){this.config=e,this.executeSelectionSet=Yf(e=>{const t=sm(e);return this.executeSelectionSet.peek(...t)||(Ep(e.context.store,e.enclosingRef.__ref),this.execSelectionSetImpl(e))},{max:Bu["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:sm,makeCacheKey(e,t,n){if(Mp(n.store))return n.store.makeCacheKey(e,rp(t)?t.__ref:t,n.varString)}}),this.executeSubSelectedArray=Yf(e=>(Ep(e.context.store,e.enclosingRef.__ref),this.execSubSelectedArrayImpl(e)),{max:Bu["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey({field:e,array:t,context:n}){if(Mp(n.store))return n.store.makeCacheKey(e,t,n.varString)}})}diffQueryAgainstStore({store:e,query:t,rootId:n="ROOT_QUERY",variables:r,returnPartialData:i=!0}){const a=this.config.cache.policies;r={...gh(Oh(t)),...r};const o=Lh(n),s=this.executeSelectionSet({selectionSet:xh(t).selectionSet,objectOrReference:o,enclosingRef:o,context:{store:e,query:t,policies:a,variables:r,varString:Sh(r),...wp(t,this.config.fragments)}});let l;s.missing&&(l=new fp(function(e){try{JSON.stringify(e,(e,t)=>{if("string"==typeof t)throw t;return t})}catch(d){return d}}(s.missing),s.missing,t,r));const c=!l,{result:d}=s;return{result:c?d:i?0===Object.keys(d).length?null:d:null,complete:c,missing:l}}isFresh(e,t,n,r){if(Mp(r.store)&&this.knownResults.get(e)===n){const i=this.executeSelectionSet.peek(n,t,r);if(i&&e===i.result)return!0}return!1}execSelectionSetImpl({selectionSet:e,objectOrReference:t,enclosingRef:n,context:r}){if(rp(t)&&!r.policies.rootTypenamesById[t.__ref]&&!r.store.has(t.__ref))return{result:{},missing:`Dangling reference to missing ${t.__ref} object`};const{variables:i,policies:a,store:o}=r,s=o.getFieldValue(t,"__typename"),l=[];let c;const d=new mh;function u(e,t){return e.missing&&(c=d.merge(c,{[t]:e.missing})),e.result}"string"!=typeof s||a.rootIdsByTypename[s]||l.push({__typename:s});const h=new Set(e.selections);h.forEach(e=>{if(Wh(e,i))if(Rh(e)){let i=a.readField({fieldName:e.name.value,field:e,variables:r.variables,from:t},r);const o=Uh(e);void 0===i?ap.added(e)||(c=d.merge(c,{[o]:`Can't find field '${e.name.value}' on ${rp(t)?t.__ref+" object":"object "+JSON.stringify(t,null,2)}`})):Ih(i)?i.length>0&&(i=u(this.executeSubSelectedArray({field:e,array:i,enclosingRef:n,context:r}),o)):e.selectionSet&&null!=i&&(i=u(this.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:i,enclosingRef:rp(i)?i:n,context:r}),o)),void 0!==i&&l.push({[o]:i})}else{const t=vh(e,r.lookupFragment);if(!t&&"FragmentSpread"===e.kind)throw Iu(112,e.name.value);t&&a.fragmentMatches(t,s)&&t.selectionSet.selections.forEach(h.add,h)}});const f={result:Vh(l),missing:c};return f.result&&this.knownResults.set(f.result,e),f}execSubSelectedArrayImpl({field:e,array:t,enclosingRef:n,context:r}){let i,a=new mh;function o(e,t){return e.missing&&(i=a.merge(i,{[t]:e.missing})),e.result}return e.selectionSet&&(t=t.filter(e=>void 0===e||r.store.canRead(e))),t=t.map((t,i)=>null===t?null:Ih(t)?o(this.executeSubSelectedArray({field:e,array:t,enclosingRef:n,context:r}),i):e.selectionSet?o(this.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:t,enclosingRef:rp(t)?t:n,context:r}),i):t),{result:t,missing:i}}};function cm(e,t,n){const r=`${t}${n}`;let i=e.flavors.get(r);return i||e.flavors.set(r,i=e.clientOnly===t&&e.deferred===n?e:{...e,clientOnly:t,deferred:n}),i}var dm=class{cache;reader;fragments;constructor(e,t,n){this.cache=e,this.reader=t,this.fragments=n}writeToStore(e,{query:t,result:n,dataId:r,variables:i,overwrite:a,extensions:o}){const s=wh(t),l=new mh;i={...gh(s),...i};const c={store:e,written:{},merge:(e,t)=>l.merge(e,t),variables:i,varString:Sh(i),...wp(t,this.fragments),overwrite:!!a,incomingById:/* @__PURE__ */new Map,clientOnly:!1,deferred:!1,flavors:/* @__PURE__ */new Map,extensions:o},d=this.processSelectionSet({result:n||{},dataId:r,selectionSet:s.selectionSet,mergeTree:{map:/* @__PURE__ */new Map},context:c,path:[]});if(!rp(d))throw Iu(114,n);return c.incomingById.forEach(({storeObject:t,mergeTree:n,fieldNodeSet:r},i)=>{const a=Lh(i);if(n&&n.map.size){const e=this.applyMerges(n,a,t,c);if(rp(e))return;t=e}e.merge(i,t)}),e.retain(d.__ref),d}processSelectionSet({dataId:e,result:t,selectionSet:n,context:r,mergeTree:i,path:a}){const{policies:o}=this.cache;let s={};const l=e&&o.rootTypenamesById[e]||gm(t,n,r.fragmentMap)||e&&r.store.get(e,"__typename");"string"==typeof l&&(s.__typename=l);const c=(...e)=>{const t=am(e,s,r.variables);if(rp(t.from)){const e=r.incomingById.get(t.from.__ref);if(e){const n=o.readField({...t,from:e.storeObject},r);if(void 0!==n)return n}}return o.readField(t,r)},d=/* @__PURE__ */new Set;this.flattenFields(n,t,r,l).forEach((e,n)=>{const r=t[Uh(n)],u=[...a,n.name.value];if(d.add(n),void 0!==r){const t=o.getStoreFieldName({typename:l,fieldName:n.name.value,field:n,variables:e.variables}),a=hm(i,t);let d,h=this.processFieldValue(r,n,n.selectionSet?cm(e,!1,!1):e,a,u);n.selectionSet&&(rp(h)||xp(h))&&(d=c("__typename",h));const f=o.getMergeFunction(l,n.name.value,d);f?a.info={field:n,typename:l,merge:f,path:u}:e.extensions?.[uf]&&Array.isArray(h)&&function(e){return!!e.directives&&e.directives.some(e=>"stream"===e.name.value)}(n)?a.info={field:n,typename:l,merge:nm,path:u}:mm(i,t),s=e.merge(s,{[t]:h})}});try{const[i,a]=o.identify(t,{typename:l,selectionSet:n,fragmentMap:r.fragmentMap,storeObject:s,readField:c});e=e||i,a&&(s=r.merge(s,a))}catch(vAe){if(!e)throw vAe}if("string"==typeof e){const a=Lh(e),o=r.written[e]||(r.written[e]=[]);if(o.indexOf(n)>=0)return a;if(o.push(n),this.reader&&this.reader.isFresh(t,a,n,r))return a;const l=r.incomingById.get(e);return l?(l.storeObject=r.merge(l.storeObject,s),l.mergeTree=fm(l.mergeTree,i),d.forEach(e=>l.fieldNodeSet.add(e))):r.incomingById.set(e,{storeObject:s,mergeTree:pm(i)?void 0:i,fieldNodeSet:d}),a}return s}processFieldValue(e,t,n,r,i){return t.selectionSet&&null!==e?Ih(e)?e.map((e,a)=>{const o=this.processFieldValue(e,t,n,hm(r,a),[...i,a]);return mm(r,a),o}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:r,path:i}):e}flattenFields(e,t,n,r=gm(t,e,n.fragmentMap)){const i=/* @__PURE__ */new Map,{policies:a}=this.cache,o=new Hu(!1);return function e(s,l){const c=o.lookup(s,l.clientOnly,l.deferred);c.visited||(c.visited=!0,s.selections.forEach(o=>{if(!Wh(o,n.variables))return;let{clientOnly:s,deferred:c}=l;if(s&&c||!Dh(o.directives)||o.directives.forEach(e=>{const t=e.name.value;if("client"===t&&(s=!0),"defer"===t){const t=ju(e,n.variables);t&&!1===t.if||(c=!0)}}),Rh(o)){const e=i.get(o);e&&(s=s&&e.clientOnly,c=c&&e.deferred),i.set(o,cm(n,s,c))}else{const i=vh(o,n.lookupFragment);if(!i&&"FragmentSpread"===o.kind)throw Iu(116,o.name.value);i&&a.fragmentMatches(i,r,t,n.variables)&&e(i.selectionSet,cm(n,s,c))}}))}(e,n),i}applyMerges(e,t,n,r,i){if(e.map.size&&!rp(n)){const a=Ih(n)||!rp(t)&&!xp(t)?void 0:t,o=n;let s;a&&!i&&(i=[rp(a)?a.__ref:a]);const l=(e,t)=>Ih(e)?"number"==typeof t?e[t]:void 0:r.store.getFieldValue(e,String(t));e.map.forEach((e,t)=>{const n=l(a,t),c=l(o,t);if(void 0===c)return;i&&i.push(t);const d=this.applyMerges(e,n,c,r,i);d!==c&&(s=s||/* @__PURE__ */new Map,s.set(t,d)),i&&Pu(i.pop()===t)}),s&&(n=Ih(o)?o.slice(0):{...o},s.forEach((e,t)=>{n[t]=e}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,r,i&&r.store.getStorage(...i)):n}},um=[];function hm({map:e},t){return e.has(t)||e.set(t,um.pop()||{map:/* @__PURE__ */new Map}),e.get(t)}function fm(e,t){if(e===t||!t||pm(t))return e;if(!e||pm(e))return t;const n=e.info&&t.info?{...e.info,...t.info}:e.info||t.info,r=e.map.size&&t.map.size,i={info:n,map:r?/* @__PURE__ */new Map:e.map.size?e.map:t.map};if(r){const n=new Set(t.map.keys());e.map.forEach((e,r)=>{i.map.set(r,fm(e,t.map.get(r))),n.delete(r)}),n.forEach(n=>{i.map.set(n,fm(t.map.get(n),e.map.get(n)))})}return i}function pm(e){return!e||!(e.info||e.map.size)}function mm({map:e},t){const n=e.get(t);n&&pm(n)&&(um.push(n),e.delete(t))}function gm(e,t,n){let r;for(const i of t.selections)if(Rh(i)){if("__typename"===i.name.value)return e[Uh(i)]}else r?r.push(i):r=[i];if("string"==typeof e.__typename)return e.__typename;if(r)for(const i of r){const t=gm(e,vh(i,n).selectionSet,n);if("string"==typeof t)return t}}var vm=class extends lp{data;optimisticData;config;watches=/* @__PURE__ */new Set;storeReader;storeWriter;addTypenameTransform=new tp(ap);maybeBroadcastWatch;assumeImmutableResults=!0;policies;makeVar=Gp;constructor(e={}){super(),this.config=function(e){return ch(gp,e)}(e),this.policies=new rm({cache:this,dataIdFromObject:this.config.dataIdFromObject,possibleTypes:this.config.possibleTypes,typePolicies:this.config.typePolicies}),this.init()}init(){const e=this.data=new Cp.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()}resetResultCache(){const{fragments:e}=this.config;this.addTypenameTransform.resetCache(),e?.resetCaches(),this.storeWriter=new dm(this,this.storeReader=new lm({cache:this,fragments:e}),e),this.maybeBroadcastWatch=Yf((e,t)=>this.broadcastWatch(e,t),{max:Bu["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:e=>{const t=e.optimistic?this.optimisticData:this.data;if(Mp(t)){const{optimistic:n,id:r,variables:i}=e;return t.makeCacheKey(e.query,e.callback,Sh({optimistic:n,id:r,variables:i}))}}}),
7
+ return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Kd,Jd="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function $d(e){return id(null==e?void 0:e[Jd])}function eu(e){return function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),a=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{!function(e){e.value instanceof rd?Promise.resolve(e.value.v).then(l,c):d(a[0][2],e)}(i[e](t))}catch(vAe){d(a[0][3],vAe)}}function l(e){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}(this,arguments,function(){var t,n,r;return $c(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,rd(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,rd(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,rd(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function tu(e){return id(null==e?void 0:e.getReader)}function nu(e){if(e instanceof zd)return e;if(null!=e){if(Yd(e))return i=e,new zd(function(e){var t=i[Sd]();if(id(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Xd(e))return t=e,new zd(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()});if(Hd(e))return r=e,new zd(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,fd)});if(_d(e))return ru(e);if($d(e))return n=e,new zd(function(e){var t,r;try{for(var i=ed(n),a=i.next();!a.done;a=i.next()){var o=a.value;if(e.next(o),e.closed)return}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e.complete()});if(tu(e))return ru(eu(e))}var t,n,r,i;throw Gd(e)}function ru(e){return new zd(function(t){(function(e,t){var n,r,i,a;return function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{l(r.next(e))}catch(vAe){a(vAe)}}function s(e){try{l(r.throw(e))}catch(vAe){a(vAe)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function(){var o,s;return $c(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ed(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,i,(t=e[n](t)).done,t.value)})}}}(e),l.label=1;case 1:return[4,n.next()];case 2:if((r=l.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=l.sent(),i={error:s},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function iu(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}function au(e,t){return void 0===t&&(t=0),Ed(function(n,r){n.subscribe(Ad(r,function(n){return iu(r,e,function(){return r.next(n)},t)},function(){return iu(r,e,function(){return r.complete()},t)},function(n){return iu(r,e,function(){return r.error(n)},t)}))})}function ou(e,t){return void 0===t&&(t=0),Ed(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function su(e,t){if(!e)throw new Error("Iterable cannot be null");return new zd(function(n){iu(n,t,function(){var r=e[Symbol.asyncIterator]();iu(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function lu(e,t){return t?function(e,t){if(null!=e){if(Yd(e))return function(e,t){return nu(e).pipe(ou(t),au(t))}(e,t);if(Xd(e))return function(e,t){return new zd(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(Hd(e))return function(e,t){return nu(e).pipe(ou(t),au(t))}(e,t);if(_d(e))return su(e,t);if($d(e))return function(e,t){return new zd(function(n){var r;return iu(n,t,function(){r=e[Jd](),iu(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(a){return void n.error(a)}i?n.complete():n.next(t)},0,!0)}),function(){return id(null==r?void 0:r.return)&&r.return()}})}(e,t);if(tu(e))return function(e,t){return su(eu(e),t)}(e,t)}throw Gd(e)}(e,t):nu(e)}function cu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return lu(e,Wd(e))}function du(e,t){var n=id(e)?e:function(){return e},r=function(e){return e.error(n())};return new zd(t?function(e){return t.schedule(r,0,e)}:r)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Kd||(Kd={}));var uu=function(){function e(e,t,n){this.kind=e,this.value=t,this.error=n,this.hasValue="N"===e}return e.prototype.observe=function(e){return function(e,t){var n,r,i,a=e,o=a.kind,s=a.value,l=a.error;if("string"!=typeof o)throw new TypeError('Invalid notification, missing "kind"');"N"===o?null===(n=t.next)||void 0===n||n.call(t,s):"E"===o?null===(r=t.error)||void 0===r||r.call(t,l):null===(i=t.complete)||void 0===i||i.call(t)}(this,e)},e.prototype.do=function(e,t,n){var r=this,i=r.kind,a=r.value,o=r.error;return"N"===i?null==e?void 0:e(a):"E"===i?null==t?void 0:t(o):null==n?void 0:n()},e.prototype.accept=function(e,t,n){var r;return id(null===(r=e)||void 0===r?void 0:r.next)?this.observe(e):this.do(e,t,n)},e.prototype.toObservable=function(){var e=this,t=e.kind,n=e.value,r=e.error,i="N"===t?cu(n):"E"===t?du(function(){return r}):"C"===t?Zd:0;if(!i)throw new TypeError("Unexpected notification kind "+t);return i},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();ad(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function hu(e,t){return Ed(function(n,r){var i=0;n.subscribe(Ad(r,function(n){r.next(e.call(t,n,i++))}))})}function fu(e,t,n){return void 0===n&&(n=1/0),id(t)?fu(function(n,r){return hu(function(e,i){return t(n,e,r,i)})(nu(e(n,r)))},n):("number"==typeof t&&(n=t),Ed(function(t,r){return function(e,t,n,r){var i=[],a=0,o=0,s=!1,l=function(){!s||i.length||a||t.complete()},c=function(e){return a<r?d(e):i.push(e)},d=function(e){a++;var s=!1;nu(n(e,o++)).subscribe(Ad(t,function(e){t.next(e)},function(){s=!0},void 0,function(){if(s)try{a--;for(var e=function(){var e=i.shift();d(e)};i.length&&a<r;)e();l()}catch(n){t.error(n)}}))};return e.subscribe(Ad(t,c,function(){s=!0,l()})),function(){}}(t,r,e,n)}))}function pu(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(void 0===(n=1)&&(n=1/0),fu(Cd,n))(lu(e,Wd(e)));var n}function mu(e,t){return Ed(function(n,r){var i=0;n.subscribe(Ad(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function gu(e){return Ed(function(t,n){var r,i=null,a=!1;i=t.subscribe(Ad(n,void 0,void 0,function(o){r=nu(e(o,gu(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):a=!0})),a&&(i.unsubscribe(),i=null,r.subscribe(n))})}function vu(e,t){return e===t}function bu(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new Md}:t,r=e.resetOnError,i=void 0===r||r,a=e.resetOnComplete,o=void 0===a||a,s=e.resetOnRefCountZero,l=void 0===s||s;return function(e){var t,r,a,s=0,c=!1,d=!1,u=function(){null==r||r.unsubscribe(),r=void 0},h=function(){u(),t=a=void 0,c=d=!1},f=function(){var e=t;h(),null==e||e.unsubscribe()};return Ed(function(e,p){s++,d||c||u();var m=a=null!=a?a:n();p.add(function(){0!==--s||d||c||(r=yu(f,l))}),m.subscribe(p),!t&&s>0&&(t=new xd({next:function(e){return m.next(e)},error:function(e){d=!0,u(),r=yu(h,i,e),m.error(e)},complete:function(){c=!0,u(),r=yu(h,o),m.complete()}}),nu(e).subscribe(t))})(e)}}function yu(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new xd({next:function(){i.unsubscribe(),e()}});return nu(t.apply(void 0,nd([],td(n)))).subscribe(i)}}else e()}function xu(e,t,n){var r,i,a,o,s=!1;return e&&"object"==typeof e?(r=e.bufferSize,o=void 0===r?1/0:r,i=e.windowTime,t=void 0===i?1/0:i,s=void 0!==(a=e.refCount)&&a,n=e.scheduler):o=null!=e?e:1/0,bu({connector:function(){return new Ld(o,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function wu(e,t,n){var r=id(e)||t||n?{next:e,error:t,complete:n}:e;return r?Ed(function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(Ad(t,function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)},function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()},function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)},function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)}))}):Cd}function Ou(e){try{return e()}catch{}}var ku=Ou(()=>globalThis)||Ou(()=>window)||Ou(()=>self)||Ou(()=>global)||Ou(function(){return Ou.constructor("return this")()}),Su="4.2.8",Cu=/* @__PURE__ */new Map;function zu(e){const t=Cu.get(e)||1;return Cu.set(e,t+1),`${e}:${t}:${Math.random().toString(36).slice(2)}`}var Nu="Invariant Violation",Eu=class e extends Error{constructor(t=Nu){super(t),this.name=Nu,Object.setPrototypeOf(this,e.prototype)}},Au=["debug","log","warn","error","silent"],Tu=Au.indexOf("silent");function Pu(e,...t){if(!e)throw Iu(...t)}function Mu(e){return function(t,...n){if(Au.indexOf(e)>=Tu){const r=console[e]||console.log;if("number"==typeof t){const e=t;(t=Lu(e))||(t=Vu(e,n),n=[])}r(t,...n)}}}function Iu(e,...t){return new Eu(Lu(e,t)||Vu(e,t))}Pu.debug=Mu("debug"),Pu.log=Mu("log"),Pu.warn=Mu("warn"),Pu.error=Mu("error");var Ru=Symbol.for("ApolloErrorMessageHandler_"+Su);function Du(e){if("string"==typeof e)return e;try{return function(e,t=0){const n=zu("stringifyForDisplay");return JSON.stringify(e,(e,t)=>void 0===t?n:t,t).split(JSON.stringify(n)).join("<undefined>")}(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function Lu(e,t=[]){if(e)return ku[Ru]&&ku[Ru](e,t.map(Du))}function Vu(e,t=[]){if(e)return"string"==typeof e?t.reduce((e,t)=>e.replace(/%[sdfo]/,Du(t)),e):`An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#${encodeURIComponent(JSON.stringify({version:Su,message:e,args:t.map(Du)}))}`}function Qu(e,t,n,r){if("IntValue"===n.kind||"FloatValue"===n.kind)e[t.value]=Number(n.value);else if("BooleanValue"===n.kind||"StringValue"===n.kind)e[t.value]=n.value;else if("ObjectValue"===n.kind){const i={};n.fields.map(e=>Qu(i,e.name,e.value,r)),e[t.value]=i}else if("Variable"===n.kind){const i=(r||{})[n.name.value];e[t.value]=i}else if("ListValue"===n.kind)e[t.value]=n.values.map(e=>{const n={};return Qu(n,t,e,r),n[t.value]});else if("EnumValue"===n.kind)e[t.value]=n.value;else{if("NullValue"!==n.kind)throw Iu(19,t.value,n.kind);e[t.value]=null}}function ju(e,t){if(e.arguments&&e.arguments.length){const n={};return e.arguments.forEach(({name:e,value:r})=>Qu(n,e,r,t)),n}return null}var Fu=Symbol.for("apollo.cacheSize"),Bu={...ku[Fu]};function qu(e,t){return e.definitions.find(e=>"OperationDefinition"===e.kind&&!!e.name)?.name.value??t}var Zu=()=>Object.create(null),{forEach:Uu,slice:Wu}=Array.prototype,{hasOwnProperty:Xu}=Object.prototype,Hu=class e{constructor(e=!0,t=Zu){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return Uu.call(e,e=>t=t.getChildTrie(e)),Xu.call(t,"data")?t.data:t.data=this.makeData(Wu.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,r=e.length;t&&n<r;++n){const r=t.mapFor(e[n],!1);t=r&&r.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],r=this.mapFor(n,!1),i=r&&r.get(n);i&&(t=i.removeArray(Wu.call(e,1)),i.data||i.weak||i.strong&&i.strong.size||r.delete(n))}else t=this.data,delete this.data;return t}getChildTrie(t){const n=this.mapFor(t,!0);let r=n.get(t);return r||n.set(t,r=new e(this.weakness,this.makeData)),r}mapFor(e,t){return this.weakness&&function(e){switch(typeof e){case"object":if(null===e)break;case"function":return!0}return!1}(e)?this.weak||(t?this.weak=/* @__PURE__ */new WeakMap:void 0):this.strong||(t?this.strong=/* @__PURE__ */new Map:void 0)}};function Yu(){}var _u=class{constructor(e=1/0,t=Yu){this.max=e,this.dispose=t,this.map=/* @__PURE__ */new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:n}=t;n&&(n.older=e),e&&(e.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return!!t&&(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0)}};function Gu(){}var Ku=Gu,Ju="undefined"!=typeof WeakRef?WeakRef:function(e){return{deref:()=>e}},$u="undefined"!=typeof WeakMap?WeakMap:Map,eh="undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){return{register:Gu,unregister:Gu}},th=class{constructor(e=1/0,t=Ku){this.max=e,this.dispose=t,this.map=new $u,this.newest=null,this.oldest=null,this.unfinalizedNodes=/* @__PURE__ */new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const e=this.unfinalizedNodes.values();for(let t=0;t<10024;t++){const t=e.next().value;if(!t)break;this.unfinalizedNodes.delete(t);const n=t.key;delete t.key,t.keyRef=new Ju(n),this.registry.register(n,t,t)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new eh(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:e,newer:n}=t;n&&(n.older=e),e&&(e.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return!!t&&(this.deleteNode(t),!0)}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}},nh=/* @__PURE__ */new WeakSet;function rh(e){e.size<=(e.max||-1)||nh.has(e)||(nh.add(e),setTimeout(()=>{e.clean(),nh.delete(e)},100))}var ih=function(e,t){const n=new th(e,t);return n.set=function(e,t){const n=th.prototype.set.call(this,e,t);return rh(this),n},n},ah=function(e,t){const n=new _u(e,t);return n.set=function(e,t){const n=_u.prototype.set.call(this,e,t);return rh(this),n},n};function oh(e,{max:t,makeCacheKey:n=e=>e}){const r=new Hu(!0),i=new ih(t);return(...t)=>{const a=r.lookupArray(n(t)),o=i.get(a);if(o){if(o.error)throw o.error;return o.result}const s=i.set(a,{});try{return s.result=e(...t)}catch(l){throw s.error=l,l}}}var sh=oh((e,t)=>{Pu(e&&"Document"===e.kind,1);const n=e.definitions.filter(e=>"OperationDefinition"===e.kind);t&&Pu(1==n.length&&n[0].operation===t,4,t,t,n[0].operation),Xl(e,{Field(t,r,i,a){if(t.alias&&("__typename"===t.alias.value||t.alias.value.startsWith("__ac_"))&&t.alias.value!==t.name.value){let r=e,i=[];for(const e of a)r=r[e],"Field"===r.kind&&i.push(r.alias?.value||r.name.value);throw i.splice(-1,1,t.name.value),Iu(5,t.alias.value,i.join("."),n[0].operation,qu(e,"(anonymous)"))}}})},{max:Bu.checkDocument||2e3}),{toString:lh}=Object.prototype;function ch(...e){const t={};return e.forEach(e=>{e&&Reflect.ownKeys(e).forEach(n=>{const r=e[n];void 0!==r&&(t[n]=r)})}),t}function dh(e=[]){const t={};return e.forEach(e=>{t[e.name.value]=e}),t}function uh(e){return null!==e&&"object"==typeof e}var{hasOwnProperty:hh}=Object.prototype,fh=function(e,t,n){return this.merge(e[n],t[n])},ph=e=>isNaN(+e)?{}:[],mh=class{options;reconciler;constructor(e={}){this.options=e,this.reconciler=e.reconciler||fh}merge(e,t,n={}){const r=n.atPath;if(r?.length){const[i,...a]=r;void 0===e&&(e=ph(i));let o=e[i];void 0===o&&a.length&&(o=ph(a[0]));const s=this.merge(o,t,{...n,atPath:a});return o!==s&&((e=this.shallowCopyForMerge(e))[i]=s),e}return Array.isArray(e)&&Array.isArray(t)&&"truncate"===this.options.arrayMerge&&e.length>t.length&&(e=e.slice(0,t.length),this.pastCopies.add(e)),uh(t)&&uh(e)?(Object.keys(t).forEach(n=>{if(hh.call(e,n)){const r=e[n];if(t[n]!==r){const i=this.reconciler(e,t,n);i!==r&&((e=this.shallowCopyForMerge(e))[n]=i)}}else(e=this.shallowCopyForMerge(e))[n]=t[n]}),e):t}isObject=uh;pastCopies=/* @__PURE__ */new Set;shallowCopyForMerge(e){return uh(e)&&(this.pastCopies.has(e)||(e=Array.isArray(e)?e.slice(0):{__proto__:Object.getPrototypeOf(e),...e},this.pastCopies.add(e))),e}};function gh(e){const t={},n=e&&e.variableDefinitions;return n&&n.length&&n.forEach(e=>{e.defaultValue&&Qu(t,e.variable.name,e.defaultValue)}),t}function vh(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":{const n=e.name.value;if("function"==typeof t)return t(n);const r=t&&t[n];return Pu(r,9,n),r||null}default:return null}}function bh(e,t){let n=t;const r=[];return e.definitions.forEach(e=>{if("OperationDefinition"===e.kind)throw Iu(10,e.operation,e.name?` named '${e.name.value}'`:"");"FragmentDefinition"===e.kind&&r.push(e)}),void 0===n&&(Pu(1===r.length,11,r.length),n=r[0].name.value),{...e,definitions:[{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:n}}]}},...e.definitions]}}function yh(e){return e.definitions.filter(e=>"FragmentDefinition"===e.kind)}function xh(e){let t;sh(e);for(let n of e.definitions){if("OperationDefinition"===n.kind)return n;"FragmentDefinition"!==n.kind||t||(t=n)}if(t)return t;throw Iu(12)}function wh(e){return sh(e),e.definitions.filter(e=>"OperationDefinition"===e.kind)[0]}function Oh(e){const t=wh(e);return Pu(t&&"query"===t.operation,13),t}var kh,Sh=Object.assign(function(e){return JSON.stringify(e,Ch)},{reset(){kh=new ah(Bu.canonicalStringify||1e3)}});function Ch(e,t){if(t&&"object"==typeof t){const e=Object.getPrototypeOf(t);if(e===Object.prototype||null===e){const n=Object.keys(t);if(n.every(zh))return t;const r=JSON.stringify(n);let i=kh.get(r);if(!i){n.sort();const e=JSON.stringify(n);i=kh.get(e)||n,kh.set(r,i),kh.set(e,i)}const a=Object.create(e);return i.forEach(e=>{a[e]=t[e]}),a}}return t}function zh(e,t,n){return 0===t||n[t-1]<=e}Sh.reset();var Nh=["connection","include","skip","client","rest","export","nonreactive","stream"],Eh=Sh,Ah=Object.assign(function(e,t,n){if(t&&n&&n.connection&&n.connection.key){if(n.connection.filter&&n.connection.filter.length>0){const e=n.connection.filter?n.connection.filter:[];e.sort();const r={};e.forEach(e=>{r[e]=t[e]});const i=Eh(r);if("{}"!==i)return`${n.connection.key}(${i})`}return n.connection.key}let r=e;if(t){const e=Eh(t);"{}"!==e&&(r+=`(${e})`)}return n&&Object.keys(n).forEach(e=>{-1===Nh.indexOf(e)&&(n[e]&&Object.keys(n[e]).length?r+=`@${e}(${Eh(n[e])})`:r+=`@${e}`)}),r},{setStringify(e){const t=Eh;return Eh=e,t}});function Th(e){return!!e.errors?.length}function Ph(e,t,n){const r=new Set(e),i=r.size;return Xl(t,{Directive(e){if(r.delete(e.name.value)&&(!n||!r.size))return Wl}}),n?!r.size:r.size<i}function Mh(e){let t=!1;return Xl(e,{Directive:{enter(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some(e=>"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value),t))return Wl}}}),t}var Ih=Array.isArray;function Rh(e){return"Field"===e.kind}function Dh(e){return Array.isArray(e)&&e.length>0}function Lh(e){return{__ref:String(e)}}function Vh(e){let t=e[0]||{};const n=e.length;if(n>1){const r=new mh;for(let i=1;i<n;++i)t=r.merge(t,e[i])}return t}function Qh(e,t){return ch(e,t,t.variables&&{variables:ch({...e&&e.variables,...t.variables})})}function jh(e){return e.catch(()=>{}),e}function Fh(e,t){sh(t);const n=Bh(""),r=Bh(""),i=e=>{for(let t,i=0;i<e.length&&(t=e[i]);++i)if(!Ih(t)){if("OperationDefinition"===t.kind)return n(t.name&&t.name.value);if("FragmentDefinition"===t.kind)return r(t.name.value)}return Pu.error(14),null};let a=0;for(let m=t.definitions.length-1;m>=0;--m)"OperationDefinition"===t.definitions[m].kind&&++a;const o=function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return e.forEach(e=>{e&&(e.name?t.set(e.name,e):e.test&&n.set(e.test,e))}),e=>{let r=t.get(e.name.value);return!r&&n.size&&n.forEach((t,n)=>{n(e)&&(r=t)}),r}}(e),s=e=>Dh(e)&&e.map(o).some(e=>e&&e.remove),l=/* @__PURE__ */new Map;let c=!1;const d={enter(e){if(s(e.directives))return c=!0,null}},u=Xl(t,{Field:d,InlineFragment:d,VariableDefinition:{enter:()=>!1},Variable:{enter(e,t,n,r,a){const o=i(a);o&&o.variables.add(e.name.value)}},FragmentSpread:{enter(e,t,n,r,a){if(s(e.directives))return c=!0,null;const o=i(a);o&&o.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter(e,t,n,r){l.set(JSON.stringify(r),e)},leave:(e,t,n,i)=>e===l.get(JSON.stringify(i))?e:a>0&&e.selectionSet.selections.every(e=>"Field"===e.kind&&"__typename"===e.name.value)?(r(e.name.value).removed=!0,c=!0,null):void 0},Directive:{leave(e){if(o(e))return c=!0,null}}});if(!c)return t;const h=e=>(e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach(t=>{h(r(t)).transitiveVars.forEach(t=>{e.transitiveVars.add(t)})})),e),f=/* @__PURE__ */new Set;u.definitions.forEach(e=>{"OperationDefinition"===e.kind?h(n(e.name&&e.name.value)).fragmentSpreads.forEach(e=>{f.add(e)}):"FragmentDefinition"!==e.kind||0!==a||r(e.name.value).removed||f.add(e.name.value)}),f.forEach(e=>{h(r(e)).fragmentSpreads.forEach(e=>{f.add(e)})});const p={enter(e){if(t=e.name.value,!f.has(t)||r(t).removed)return null;var t}};return function(e){return qh(wh(e)||function(e){Pu("Document"===e.kind,6),Pu(e.definitions.length<=1,7);const t=e.definitions[0];return Pu("FragmentDefinition"===t.kind,8),t}(e),dh(yh(e)))?null:e}(Xl(u,{FragmentSpread:p,FragmentDefinition:p,OperationDefinition:{leave(e){if(e.variableDefinitions){const t=h(n(e.name&&e.name.value)).transitiveVars;if(t.size<e.variableDefinitions.length)return{...e,variableDefinitions:e.variableDefinitions.filter(e=>t.has(e.variable.name.value))}}}}}))}function Bh(e){const t=/* @__PURE__ */new Map;return function(n=e){let r=t.get(n);return r||t.set(n,r={variables:/* @__PURE__ */new Set,fragmentSpreads:/* @__PURE__ */new Set}),r}}function qh(e,t){return!e||e.selectionSet.selections.every(e=>"FragmentSpread"===e.kind&&qh(t[e.name.value],t))}function Zh(e){return Xl(e,{FragmentSpread(e){if(!e.directives?.some(({name:e})=>"unmask"===e.value))return null}})}function Uh(e){return e.alias?e.alias.value:e.name.value}function Wh({directives:e},t){return!e||!e.length||function(e){const t=[];return e&&e.length&&e.forEach(e=>{if(!function({name:{value:e}}){return"skip"===e||"include"===e}(e))return;const n=e.arguments,r=e.name.value;Pu(n&&1===n.length,16,r);const i=n[0];Pu(i.name&&"if"===i.name.value,17,r);const a=i.value;Pu(a&&("Variable"===a.kind||"BooleanValue"===a.kind),18,r),t.push({directive:e,ifArgument:i})}),t}(e).every(({directive:e,ifArgument:n})=>{let r=!1;return"Variable"===n.value.kind?(r=t&&t[n.value.name.value],Pu(void 0!==r,15,e.name.value)):r=n.value.value,"skip"===e.name.value?!r:r})}function Xh(e){const t={data:e.data};return e.error&&(t.error=e.error),t}function Hh(e,t=()=>{}){return n=>new zd(r=>{let i=t();return n.subscribe({next(t){let n;try{n=e(t,i)}catch(vAe){r.error(vAe)}void 0!==n&&r.next(n)},error(e){r.error(e)},complete(){r.complete()}})})}var{toString:Yh,hasOwnProperty:_h}=Object.prototype,Gh=Function.prototype.toString,Kh=/* @__PURE__ */new Map;function Jh(e,t){try{return $h(e,t)}finally{Kh.clear()}}function $h(e,t){if(e===t)return!0;const n=Yh.call(e);if(n!==Yh.call(t))return!1;switch(n){case"[object Array]":if(e.length!==t.length)return!1;case"[object Object]":{if(rf(e,t))return!0;const n=ef(e),r=ef(t),i=n.length;if(i!==r.length)return!1;for(let e=0;e<i;++e)if(!_h.call(t,n[e]))return!1;for(let a=0;a<i;++a){const r=n[a];if(!$h(e[r],t[r]))return!1}return!0}case"[object Error]":return e.name===t.name&&e.message===t.message;case"[object Number]":if(e!=e)return t!=t;case"[object Boolean]":case"[object Date]":return+e===+t;case"[object RegExp]":case"[object String]":return e==`${t}`;case"[object Map]":case"[object Set]":{if(e.size!==t.size)return!1;if(rf(e,t))return!0;const r=e.entries(),i="[object Map]"===n;for(;;){const e=r.next();if(e.done)break;const[n,a]=e.value;if(!t.has(n))return!1;if(i&&!$h(a,t.get(n)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":e=new Uint8Array(e),t=new Uint8Array(t);case"[object DataView]":{let n=e.byteLength;if(n===t.byteLength)for(;n--&&e[n]===t[n];);return-1===n}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{const n=Gh.call(e);return n===Gh.call(t)&&!function(e,t){const n=e.length-t.length;return n>=0&&e.indexOf(t,n)===n}(n,nf)}}return!1}function ef(e){return Object.keys(e).filter(tf,e)}function tf(e){return void 0!==this[e]}var nf="{ [native code] }";function rf(e,t){let n=Kh.get(e);if(n){if(n.has(t))return!0}else Kh.set(e,n=/* @__PURE__ */new Set);return n.add(t),!1}function af(e,{data:t,...n},{data:r,...i},a){return Jh(n,i)&&of(xh(e).selectionSet,t,r,{fragmentMap:dh(yh(e)),variables:a})}function of(e,t,n,r){if(t===n)return!0;const i=/* @__PURE__ */new Set;return e.selections.every(e=>{if(i.has(e))return!0;if(i.add(e),!Wh(e,r.variables))return!0;if(sf(e))return!0;if(Rh(e)){const i=Uh(e),a=t&&t[i],o=n&&n[i],s=e.selectionSet;if(!s)return Jh(a,o);const l=Array.isArray(a),c=Array.isArray(o);if(l!==c)return!1;if(l&&c){const e=a.length;if(o.length!==e)return!1;for(let t=0;t<e;++t)if(!of(s,a[t],o[t],r))return!1;return!0}return of(s,a,o,r)}{const i=vh(e,r.fragmentMap);if(i)return!!sf(i)||of(i.selectionSet,t,n,r)}})}function sf(e){return!!e.directives&&e.directives.some(lf)}function lf(e){return"nonreactive"===e.name.value}var cf=oh(function(e,t,n){return function(e,t){let n,r;function i(e){return e!==n&&(n=e,r=t(n)),r}return Object.assign(e.pipe(hu(i),xu({bufferSize:1,refCount:!0})),{getCurrentResult:()=>i(e.getCurrentResult())})}(e,n)},{max:1,makeCacheKey:e=>e.slice(0,2)}),df=Symbol.for("apollo.result.extensions"),uf=Symbol.for("apollo.result.streamInfo"),hf=Symbol.for("apollo.observableQuery.variablesUnknown"),ff=null,pf={},mf=1;function gf(e){try{return e()}catch(t){}}var vf="@wry/context:Slot",bf=gf(()=>globalThis)||gf(()=>global)||Object.create(null),yf=bf[vf]||Array[vf]||function(e){try{Object.defineProperty(bf,vf,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}}(class{constructor(){this.id=["slot",mf++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=ff;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===pf)break;return e!==ff&&(ff.slots[this.id]=t),!0}return ff&&(ff.slots[this.id]=pf),!1}getValue(){if(this.hasValue())return ff.slots[this.id]}withValue(e,t,n,r){const i={__proto__:null,[this.id]:e},a=ff;ff={parent:a,slots:i};try{return t.apply(r,n)}finally{ff=a}}static bind(e){const t=ff;return function(){const n=ff;try{return ff=t,e.apply(this,arguments)}finally{ff=n}}}static noContext(e,t,n){if(!ff)return e.apply(n,t);{const r=ff;try{return ff=null,e.apply(n,t)}finally{ff=r}}}}),{bind:xf,noContext:wf}=yf,Of=new yf,{hasOwnProperty:kf}=Object.prototype,Sf=Array.from||function(e){const t=[];return e.forEach(e=>t.push(e)),t};function Cf(e){const{unsubscribe:t}=e;"function"==typeof t&&(e.unsubscribe=void 0,t())}var zf=[];function Nf(e,t){if(!e)throw new Error(t||"assertion failure")}function Ef(e,t){const n=e.length;return n>0&&n===t.length&&e[n-1]===t[n-1]}function Af(e){switch(e.length){case 0:throw new Error("unknown value");case 1:return e[0];case 2:throw e[1]}}function Tf(e){return e.slice(0)}var Pf=class e{constructor(t){this.fn=t,this.parents=/* @__PURE__ */new Set,this.childValues=/* @__PURE__ */new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++e.count}peek(){if(1===this.value.length&&!Rf(this))return Mf(this),this.value[0]}recompute(e){return Nf(!this.recomputing,"already recomputing"),Mf(this),Rf(this)?function(e,t){return Bf(e),Of.withValue(e,If,[e,t]),function(e,t){if("function"==typeof e.subscribe)try{Cf(e),e.unsubscribe=e.subscribe.apply(null,t)}catch(vAe){return e.setDirty(),!1}return!0}(e,t)&&function(e){e.dirty=!1,Rf(e)||Lf(e)}(e),Af(e.value)}(this,e):Af(this.value)}setDirty(){this.dirty||(this.dirty=!0,Df(this),Cf(this))}dispose(){this.setDirty(),Bf(this),Vf(this,(e,t)=>{e.setDirty(),qf(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=zf.pop()||/* @__PURE__ */new Set),this.deps.add(e)}forgetDeps(){this.deps&&(Sf(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),zf.push(this.deps),this.deps=null)}};function Mf(e){const t=Of.getValue();if(t)return e.parents.add(t),t.childValues.has(e)||t.childValues.set(e,[]),Rf(e)?Qf(t,e):jf(t,e),t}function If(e,t){e.recomputing=!0;const{normalizeResult:n}=e;let r;n&&1===e.value.length&&(r=Tf(e.value)),e.value.length=0;try{if(e.value[0]=e.fn.apply(null,t),n&&r&&!Ef(r,e.value))try{e.value[0]=n(e.value[0],r[0])}catch(dX){}}catch(vAe){e.value[1]=vAe}e.recomputing=!1}function Rf(e){return e.dirty||!(!e.dirtyChildren||!e.dirtyChildren.size)}function Df(e){Vf(e,Qf)}function Lf(e){Vf(e,jf)}function Vf(e,t){const n=e.parents.size;if(n){const r=Sf(e.parents);for(let i=0;i<n;++i)t(r[i],e)}}function Qf(e,t){Nf(e.childValues.has(t)),Nf(Rf(t));const n=!Rf(e);if(e.dirtyChildren){if(e.dirtyChildren.has(t))return}else e.dirtyChildren=zf.pop()||/* @__PURE__ */new Set;e.dirtyChildren.add(t),n&&Df(e)}function jf(e,t){Nf(e.childValues.has(t)),Nf(!Rf(t));const n=e.childValues.get(t);0===n.length?e.childValues.set(t,Tf(t.value)):Ef(n,t.value)||e.setDirty(),Ff(e,t),Rf(e)||Lf(e)}function Ff(e,t){const n=e.dirtyChildren;n&&(n.delete(t),0===n.size&&(zf.length<100&&zf.push(n),e.dirtyChildren=null))}function Bf(e){e.childValues.size>0&&e.childValues.forEach((t,n)=>{qf(e,n)}),e.forgetDeps(),Nf(null===e.dirtyChildren)}function qf(e,t){t.parents.delete(e),e.childValues.delete(t),Ff(e,t)}Pf.count=0;var Zf,Uf={setDirty:!0,dispose:!0,forget:!0};function Wf(e){const t=/* @__PURE__ */new Map,n=e&&e.subscribe;function r(e){const r=Of.getValue();if(r){let i=t.get(e);i||t.set(e,i=/* @__PURE__ */new Set),r.dependOn(i),"function"==typeof n&&(Cf(i),i.unsubscribe=n(e))}}return r.dirty=function(e,n){const r=t.get(e);if(r){const i=n&&kf.call(Uf,n)?n:"setDirty";Sf(r).forEach(e=>e[i]()),t.delete(e),Cf(r)}},r}function Xf(...e){return(Zf||(Zf=new Hu("function"==typeof WeakMap))).lookupArray(e)}var Hf=/* @__PURE__ */new Set;function Yf(e,{max:t=Math.pow(2,16),keyArgs:n,makeCacheKey:r=Xf,normalizeResult:i,subscribe:a,cache:o=_u}=Object.create(null)){const s="function"==typeof o?new o(t,e=>e.dispose()):o,l=function(){const t=r.apply(null,n?n.apply(null,arguments):arguments);if(void 0===t)return e.apply(null,arguments);let o=s.get(t);o||(s.set(t,o=new Pf(e)),o.normalizeResult=i,o.subscribe=a,o.forget=()=>s.delete(t));const l=o.recompute(Array.prototype.slice.call(arguments));return s.set(t,o),Hf.add(s),Of.hasValue()||(Hf.forEach(e=>e.clean()),Hf.clear()),l};function c(e){const t=e&&s.get(e);t&&t.setDirty()}function d(e){const t=e&&s.get(e);if(t)return t.peek()}function u(e){return!!e&&s.delete(e)}return Object.defineProperty(l,"size",{get:()=>s.size,configurable:!1,enumerable:!1}),Object.freeze(l.options={max:t,keyArgs:n,makeCacheKey:r,normalizeResult:i,subscribe:a,cache:s}),l.dirtyKey=c,l.dirty=function(){c(r.apply(null,arguments))},l.peekKey=d,l.peek=function(){return d(r.apply(null,arguments))},l.forgetKey=u,l.forget=function(){return u(r.apply(null,arguments))},l.makeCacheKey=r,l.getKey=n?function(){return r.apply(null,n.apply(null,arguments))}:r,Object.freeze(l)}function _f(...e){return Xf.bind(null,...e)}var Gf=class{isIncrementalResult(e){return!1}prepareRequest(e){return Pu(!Ph(["defer","stream"],e.query),67),e}extractErrors(){}startRequest=void 0},Kf=class e{static empty(){return new e(()=>Zd)}static from(t){if(0===t.length)return e.empty();const[n,...r]=t;return n.concat(...r)}static split(t,n,r=new e((e,t)=>t(e))){const i=new e((e,i)=>t(e)?n.request(e,i):r.request(e,i));return Object.assign(i,{left:n,right:r})}static execute(e,t,n){return e.request(function(e,{client:t}){const n={query:e.query,variables:e.variables||{},extensions:e.extensions||{},operationName:qu(e.query),operationType:wh(e.query).operation};let r={...e.context};const i=()=>Object.freeze({...r});return Object.defineProperty(n,"setContext",{enumerable:!1,value:e=>{r="function"==typeof e?{...r,...e(i())}:{...r,...e}}}),Object.defineProperty(n,"getContext",{enumerable:!1,value:i}),Object.defineProperty(n,"client",{enumerable:!1,value:t}),n}(t,n),()=>Zd)}static concat(...t){return e.from(t)}constructor(e){e&&(this.request=e)}split(t,n,r){return this.concat(e.split(t,n,r))}concat(...e){return 0===e.length?this:e.reduce(this.combine.bind(this),this)}combine(t,n){const r=new e((e,r)=>t.request(e,e=>n.request(e,r)));return Object.assign(r,{left:t,right:n})}request(e,t){throw Iu(65)}left;right},Jf=Kf.execute;function $f(e){return e}var ep,tp=class e{transform;cached;resultCache=/* @__PURE__ */new WeakSet;getCacheKey(e){return[e]}static identity(){return new e($f,{cache:!1})}static split(t,n,r=e.identity()){return Object.assign(new e(e=>(t(e)?n:r).transformDocument(e),{cache:!1}),{left:n,right:r})}constructor(e,t={}){this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=!1!==t.cache,this.resetCache()}resetCache(){if(this.cached){const t=new Hu;this.performWork=Yf(e.prototype.performWork.bind(this),{makeCacheKey:e=>{const n=this.getCacheKey(e);if(n)return Pu(Array.isArray(n),20),t.lookupArray(n)},max:Bu["documentTransform.cache"],cache:th})}}performWork(e){return sh(e),this.transform(e)}transformDocument(e){if(this.resultCache.has(e))return e;const t=this.performWork(e);return this.resultCache.add(t),t}concat(t){return Object.assign(new e(e=>t.transformDocument(this.transformDocument(e)),{cache:!1}),{left:this,right:t})}left;right},np=Object.assign(e=>{let t=ep.get(e);return t||(t=function(e){return Xl(e,Yl)}(e),ep.set(e,t)),t},{reset(){ep=new ih(Bu.print||2e3)}});function rp(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}np.reset();var ip={kind:Zs,name:{kind:Qs,value:"__typename"}},ap=Object.assign(function(e){return Xl(e,{SelectionSet:{enter(e,t,n){if(n&&"OperationDefinition"===n.kind)return;const{selections:r}=e;if(!r)return;if(r.some(e=>"Field"===e.kind&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))))return;const i=n;return"Field"===i.kind&&i.directives&&i.directives.some(e=>"export"===e.name.value)?void 0:{...e,selections:[...r,ip]}}}})},{added:e=>e===ip});function op(e){return 7===e||8===e}function sp(e){return!op(e)}var lp=class{assumeImmutableResults=!1;lookupFragment(e){return null}batch(e){const t="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;let n;return this.performTransaction(()=>n=e.update(this),t),n}recordOptimisticTransaction(e,t){this.performTransaction(e,t)}transformDocument(e){return e}transformForLink(e){return e}identify(e){}gc(){return[]}modify(e){return!1}readQuery(e,t=!!e.optimistic){return this.read({...e,rootId:e.id||"ROOT_QUERY",optimistic:t})}fragmentWatches=new Hu(!0);watchFragment(e){const{fragment:t,fragmentName:n,from:r}=e,i=this.getFragmentDoc(t,n),a=(Array.isArray(r)?r:[r]).map(e=>null==e?e:this.toCacheId(e));if(!Array.isArray(r)){const t=this.watchSingleFragment(a[0],i,e);return null===r?t:cf(t,Symbol.for("apollo.transform.individualResult"),e=>({...e,data:e.data??{}}))}let o;function s(e){const t=e.reduce((e,t,n)=>(e.data.push(t.data),e.complete&&=t.complete,e.dataState=e.complete?"complete":"partial",t.missing&&(e.missing||={},e.missing[n]=t.missing),e),{data:[],dataState:"complete",complete:!0});return Jh(o,t)||(o=t),o}if(0===a.length)return hp;let l=!1;const c=a.map(t=>this.watchSingleFragment(t,i,e)),d=function(e){return 0===e.length?Zd:new zd(t=>{const{length:n}=e,r=new Array(n),i=/* @__PURE__ */new Map;e.forEach((e,t)=>{i.has(e)||i.set(e,/* @__PURE__ */new Set),i.get(e).add(t)});let a,o=i.size,s=i.size;i.forEach((n,i)=>{let l=!1;const c=i.subscribe({next:o=>{n.forEach(e=>r[e]=o),l||(l=!0,s--),s||(a||=new Set(e.filter(e=>e.dirty)),a.delete(i),a.size||(t.next(r.slice()),a=void 0))},complete:()=>{o--,o||t.complete()},error:t.error.bind(t)});t.add(c)})})}(c).pipe(hu(s),wu({subscribe:()=>l=!0,unsubscribe:()=>l=!1}),xu({bufferSize:1,refCount:!0}));return Object.assign(d,{getCurrentResult:()=>l&&o?o:s(c.map(e=>e.getCurrentResult()))})}onAfterBroadcast=e=>e();watchSingleFragment(e,t,n){if(null===e)return dp;const{optimistic:r=!0,variables:i}=n,a=[t,Sh({id:e,optimistic:r,variables:i})],o=this.fragmentWatches.lookupArray(a);if(!o.observable){let c,d=!1;function u(e){const r=e.result;return c&&af(t,{data:c.data},{data:r},n.variables)||(c={data:r,dataState:e.complete?"complete":"partial",complete:e.complete},e.missing&&(c.missing=e.missing.missing)),c}const h=new zd(n=>{d=!0;const o=this.watch({variables:i,returnPartialData:!0,id:e,query:t,optimistic:r,immediate:!0,callback:e=>{h.dirty=!0,this.onAfterBroadcast(()=>{n.next(u(e)),h.dirty=!1})}});return()=>{d=!1,o(),this.fragmentWatches.removeArray(a)}}).pipe((void 0===l&&(l=Cd),s=null!=s?s:vu,Ed(function(e,t){var n,r=!0;e.subscribe(Ad(t,function(e){var i=l(e);!r&&s(n,i)||(r=!1,n=i,t.next(e))}))})),bu({connector:()=>new Ld(1),resetOnRefCountZero:()=>function(e,t,n){void 0===e&&(e=0),void 0===n&&(n=qd);var r=-1;return null!=t&&(Ud(t)?n=t:r=t),new zd(function(t){var i,a=(i=e)instanceof Date&&!isNaN(i)?+e-n.now():e;a<0&&(a=0);var o=0;return n.schedule(function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())},a)})}(0)}));o.observable=Object.assign(h,{dirty:!1,getCurrentResult:()=>d&&c?c:u(this.diff({id:e,query:t,returnPartialData:!0,optimistic:r,variables:i}))})}var s,l;return o.observable}getFragmentDoc=Yf(bh,{max:Bu["cache.fragmentQueryDocuments"]||1e3,cache:th,makeCacheKey:_f(this)});readFragment(e,t=!!e.optimistic){const n=void 0!==e.from?this.toCacheId(e.from):e.id;return this.read({...e,query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:n,optimistic:t})}writeQuery({id:e,data:t,...n}){return this.write(Object.assign(n,{dataId:e||"ROOT_QUERY",result:t}))}writeFragment({data:e,fragment:t,fragmentName:n,...r}){const i=void 0!==r.from?this.toCacheId(r.from):r.id;return this.write(Object.assign(r,{query:this.getFragmentDoc(t,n),dataId:i,result:e}))}updateQuery(e,t){return this.batch({update(n){const r=n.readQuery(e),i=t(r);return null==i?r:(n.writeQuery({...e,data:i}),i)}})}updateFragment(e,t){return this.batch({update(n){const r=n.readFragment(e),i=t(r);return null==i?r:(n.writeFragment({...e,data:i}),i)}})}toCacheId(e){return"string"==typeof e?e:this.identify(e)}},cp=Object.freeze({data:null,dataState:"complete",complete:!0}),dp=Object.assign(new zd(e=>{e.next(cp)}),{dirty:!1,getCurrentResult:()=>cp}),up=Object.freeze({data:[],dataState:"complete",complete:!0}),hp=Object.assign(new zd(e=>{e.next(up)}),{getCurrentResult:()=>up}),fp=class e extends Error{message;path;query;variables;constructor(t,n,r,i){if(super(t),this.message=t,this.path=n,this.query=r,this.variables=i,this.name="MissingFieldError",Array.isArray(this.path)){this.missing=this.message;for(let e=this.path.length-1;e>=0;--e)this.missing={[this.path[e]]:this.missing}}else this.missing=this.path;this.__proto__=e.prototype}missing},{hasOwnProperty:pp}=Object.prototype;function mp({__typename:e,id:t,_id:n},r){if("string"==typeof e&&(r&&(r.keyObject=null!=t?{id:t}:null!=n?{_id:n}:void 0),null==t&&null!=n&&(t=n),null!=t))return`${e}:${"number"==typeof t||"string"==typeof t?t:JSON.stringify(t)}`}var gp={dataIdFromObject:mp,resultCaching:!0},vp=/^[_a-z][_0-9a-z]*/i;function bp(e){const t=e.match(vp);return t?t[0]:e}function yp(e,t,n){return!!uh(t)&&(Ih(t)?t.every(t=>yp(e,t,n)):e.selections.every(e=>{if(Rh(e)&&Wh(e,n)){const r=Uh(e);return pp.call(t,r)&&(!e.selectionSet||yp(e.selectionSet,t[r],n))}return!0}))}function xp(e){return uh(e)&&!rp(e)&&!Ih(e)}function wp(e,t){const n=dh(yh(e));return{fragmentMap:n,lookupFragment(e){let r=n[e];return!r&&t&&(r=t.lookup(e)),r||null}}}var Op={},kp=()=>Op,Sp={},Cp=class{policies;group;data={};constructor(e,t){this.policies=e,this.group=t}toObject(){return{...this.data}}has(e){return void 0!==this.lookup(e,!0)}get(e,t){if(this.group.depend(e,t),pp.call(this.data,e)){const n=this.data[e];if(n&&pp.call(n,t))return n[t]}return"__typename"===t&&pp.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Ap?this.parent.get(e,t):void 0}lookup(e,t){return t&&this.group.depend(e,"__exists"),pp.call(this.data,e)?this.data[e]:this instanceof Ap?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?{}:void 0}merge(e,t){let n;rp(e)&&(e=e.__ref),rp(t)&&(t=t.__ref);const r="string"==typeof e?this.lookup(n=e):e,i="string"==typeof t?this.lookup(n=t):t;if(!i)return;Pu("string"==typeof n,104);const a=new mh({reconciler:Pp}).merge(r,i);if(this.data[n]=a,a!==r&&(delete this.refs[n],this.group.caching)){const e={};r||(e.__exists=1),Object.keys(i).forEach(t=>{if(!r||r[t]!==a[t]){e[t]=1;const n=bp(t);n===t||this.policies.hasKeyArgs(a.__typename,n)||(e[n]=1),void 0!==a[t]||this instanceof Ap||delete a[t]}}),!e.__typename||r&&r.__typename||this.policies.rootTypenamesById[n]!==a.__typename||delete e.__typename,Object.keys(e).forEach(e=>this.group.dirty(n,e))}}modify(e,t,n){const r=this.lookup(e);if(r){const i={};let a=!1,o=!0;const s={DELETE:Op,INVALIDATE:Sp,isReference:rp,toReference:this.toReference,canRead:this.canRead,readField:(t,n)=>this.policies.readField("string"==typeof t?{fieldName:t,from:n||Lh(e)}:t,{store:this})};if(Object.keys(r).forEach(l=>{const c=bp(l);let d=r[l];if(void 0===d)return;const u="function"==typeof t?t:t[l]||(n?void 0:t[c]);if(u){let t=u===kp?Op:u(d,{...s,fieldName:c,storeFieldName:l,storage:this.getStorage(e,l)});t===Sp?this.group.dirty(e,l):(t===Op&&(t=void 0),t!==d&&(i[l]=t,a=!0,d=t))}void 0!==d&&(o=!1)}),a)return this.merge(e,i),o&&(this instanceof Ap?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1}delete(e,t,n){const r=this.lookup(e);if(r){const i=this.getFieldValue(r,"__typename"),a=t&&n?this.policies.getStoreFieldName({typename:i,fieldName:t,args:n}):t;return this.modify(e,a?{[a]:kp}:kp,!!n)}return!1}evict(e,t){let n=!1;return e.id&&(pp.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Ap&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n}clear(){this.replace(null)}extract(){const e=this.toObject(),t=[];return this.getRootIdSet().forEach(e=>{pp.call(this.policies.rootTypenamesById,e)||t.push(e)}),t.length&&(e.__META={extraRootIds:t.sort()}),e}replace(e){if(Object.keys(this.data).forEach(t=>{e&&pp.call(e,t)||this.delete(t)}),e){const{__META:t,...n}=e;Object.keys(n).forEach(e=>{this.merge(e,n[e])}),t&&t.extraRootIds.forEach(this.retain,this)}}rootIds={};retain(e){return this.rootIds[e]=(this.rootIds[e]||0)+1}release(e){if(this.rootIds[e]>0){const t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0}getRootIdSet(e=/* @__PURE__ */new Set){return Object.keys(this.rootIds).forEach(e.add,e),this instanceof Ap?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e}gc(){const e=this.getRootIdSet(),t=this.toObject();e.forEach(n=>{pp.call(t,n)&&(Object.keys(this.findChildRefIds(n)).forEach(e.add,e),delete t[n])});const n=Object.keys(t);if(n.length){let e=this;for(;e instanceof Ap;)e=e.parent;n.forEach(t=>e.delete(t))}return n}refs={};findChildRefIds(e){if(!pp.call(this.refs,e)){const t=this.refs[e]={},n=this.data[e];if(!n)return t;const r=/* @__PURE__ */new Set([n]);r.forEach(e=>{rp(e)&&(t[e.__ref]=!0),uh(e)&&Object.keys(e).forEach(t=>{const n=e[t];uh(n)&&r.add(n)})})}return this.refs[e]}makeCacheKey(){return this.group.keyMaker.lookupArray(arguments)}getFieldValue=(e,t)=>rp(e)?this.get(e.__ref,t):e&&e[t];canRead=e=>rp(e)?this.has(e.__ref):"object"==typeof e;toReference=(e,t)=>{if("string"==typeof e)return Lh(e);if(rp(e))return e;const[n]=this.policies.identify(e);if(n){const r=Lh(n);return t&&this.merge(n,e),r}};get supportsResultCaching(){return this.group.caching}},zp=class{caching;parent;d=null;keyMaker;constructor(e,t=null){this.caching=e,this.parent=t,this.resetCaching()}resetCaching(){this.d=this.caching?Wf():null,this.keyMaker=new Hu}depend(e,t){if(this.d){this.d(Np(e,t));const n=bp(t);n!==t&&this.d(Np(e,n)),this.parent&&this.parent.depend(e,t)}}dirty(e,t){this.d&&this.d.dirty(Np(e,t),"__exists"===t?"forget":"setDirty")}};function Np(e,t){return t+"#"+e}function Ep(e,t){Mp(e)&&e.group.depend(t,"__exists")}Cp.Root=class extends Cp{constructor({policies:e,resultCaching:t=!0,seed:n}){super(e,new zp(t)),n&&this.replace(n)}stump=new Tp(this);addLayer(e,t){return this.stump.addLayer(e,t)}removeLayer(){return this}storageTrie=new Hu;getStorage(){return this.storageTrie.lookupArray(arguments)}};var Ap=class e extends Cp{id;parent;replay;group;constructor(e,t,n,r){super(t.policies,r),this.id=e,this.parent=t,this.replay=n,this.group=r,n(this)}addLayer(t,n){return new e(t,this,n,this.group)}removeLayer(e){const t=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach(e=>{const n=this.data[e],r=t.lookup(e);r?n?n!==r&&Object.keys(n).forEach(t=>{Jh(n[t],r[t])||this.group.dirty(e,t)}):(this.group.dirty(e,"__exists"),Object.keys(r).forEach(t=>{this.group.dirty(e,t)})):this.delete(e)}),t):t===this.parent?this:t.addLayer(this.id,this.replay)}toObject(){return{...this.parent.toObject(),...this.data}}findChildRefIds(e){const t=this.parent.findChildRefIds(e);return pp.call(this.data,e)?{...t,...super.findChildRefIds(e)}:t}getStorage(...e){let t=this.parent;for(;t.parent;)t=t.parent;return t.getStorage(...e)}},Tp=class extends Ap{constructor(e){super("EntityStore.Stump",e,()=>{},new zp(e.group.caching,e.group))}removeLayer(){return this}merge(e,t){return this.parent.merge(e,t)}};function Pp(e,t,n){const r=e[n],i=t[n];return Jh(r,i)?r:i}function Mp(e){return!(!e||!e.supportsResultCaching)}var Ip=new yf;function Rp(e){const t=e.directives?.find(({name:e})=>"unmask"===e.value);if(!t)return"mask";const n=t.arguments?.find(({name:e})=>"mode"===e.value);return n&&"value"in n.value&&"migrate"===n.value.value?"migrate":"unmask"}function Dp(e,t,n){return Ip.withValue(!0,()=>{const r=Lp(e,t,n,!1);return Object.isFrozen(e),r})}function Lp(e,t,n,r,i){const{knownChanged:a}=n,o=function(e,t){if(t.has(e))return t.get(e);const n=Array.isArray(e)?[]:{};return t.set(e,n),n}(e,n.mutableTargets);if(Array.isArray(e)){for(const[i,s]of Array.from(e.entries())){if(null===s){o[i]=null;continue}const e=Lp(s,t,n,r,void 0);a.has(e)&&a.add(o),o[i]=e}return a.has(o)?o:e}for(const s of t.selections){let t;if(r&&a.add(o),"Field"===s.kind){const i=Uh(s),l=s.selectionSet;if(t=o[i]||e[i],void 0===t)continue;if(l&&null!==t){const o=Lp(e[i],l,n,r,void 0);a.has(o)&&(t=o)}o[i]=t}if("InlineFragment"!==s.kind||s.typeCondition&&!n.cache.fragmentMatches(s,e.__typename)||(t=Lp(e,s.selectionSet,n,r,i)),"FragmentSpread"===s.kind){const r=s.name.value,a=n.fragmentMap[r]||(n.fragmentMap[r]=n.cache.lookupFragment(r));Pu(a,39,r);const o=Rp(s);"mask"!==o&&(t=Lp(e,a.selectionSet,n,"migrate"===o,i))}a.has(t)&&a.add(o)}return"__typename"in e&&!("__typename"in o)&&(o.__typename=e.__typename),Object.keys(o).length!==Object.keys(e).length&&a.add(o),a.has(o)?o:e}var Vp={};function Qp(e){const t=JSON.stringify(e);return Vp[t]||(Vp[t]={})}function jp(e){const t=Qp(e);return t.keyFieldsFn||(t.keyFieldsFn=(t,n)=>{const r=(e,t)=>n.readField(t,e),i=n.keyObject=Bp(e,e=>{let i=Up(n.storeObject,e,r);return void 0===i&&t!==n.storeObject&&pp.call(t,e[0])&&(i=Up(t,e,Zp)),Pu(void 0!==i,107,e.join("."),t),i});return`${n.typename}:${JSON.stringify(i)}`})}function Fp(e){const t=Qp(e);return t.keyArgsFn||(t.keyArgsFn=(t,{field:n,variables:r,fieldName:i})=>{const a=Bp(e,e=>{const i=e[0],a=i.charAt(0);if("@"!==a){if("$"===a){const t=i.slice(1);if(r&&pp.call(r,t)){const n=e.slice(0);return n[0]=t,Up(r,n)}return}if(t)return Up(t,e)}else if(n&&Dh(n.directives)){const t=i.slice(1),a=n.directives.find(e=>e.name.value===t),o=a&&ju(a,r);return o&&Up(o,e.slice(1))}}),o=JSON.stringify(a);return(t||"{}"!==o)&&(i+=":"+o),i})}function Bp(e,t){const n=new mh;return qp(e).reduce((e,r)=>{let i=t(r);if(void 0!==i){for(let e=r.length-1;e>=0;--e)i={[r[e]]:i};e=n.merge(e,i)}return e},{})}function qp(e){const t=Qp(e);if(!t.paths){const n=t.paths=[],r=[];e.forEach((t,i)=>{Ih(t)?(qp(t).forEach(e=>n.push(r.concat(e))),r.length=0):(r.push(t),Ih(e[i+1])||(n.push(r.slice(0)),r.length=0))})}return t.paths}function Zp(e,t){return e[t]}function Up(e,t,n){return n=n||Zp,Wp(t.reduce(function e(t,r){return Ih(t)?t.map(t=>e(t,r)):t&&n(t,r)},e))}function Wp(e){return uh(e)?Ih(e)?e.map(Wp):Bp(Object.keys(e).sort(),t=>Up(e,t)):e}var Xp=new yf,Hp=/* @__PURE__ */new WeakMap;function Yp(e){let t=Hp.get(e);return t||Hp.set(e,t={vars:/* @__PURE__ */new Set,dep:Wf()}),t}function _p(e){Yp(e).vars.forEach(t=>t.forgetCache(e))}function Gp(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set,r=function(a){if(arguments.length>0){if(e!==a){e=a,t.forEach(e=>{Yp(e).dep.dirty(r),function(e){e.broadcastWatches&&e.broadcastWatches()}(e)});const i=Array.from(n);n.clear(),i.forEach(t=>t(e))}}else{const e=Xp.getValue();e&&(i(e),Yp(e).dep(r))}return e};r.onNextChange=e=>(n.add(e),()=>{n.delete(e)});const i=r.attachCache=e=>(t.add(e),Yp(e).vars.add(r),r);return r.forgetCache=e=>t.delete(e),r}function Kp(e){return void 0!==e.args?e.args:e.field?ju(e.field,e.variables):null}var Jp=()=>{},$p=(e,t)=>t.fieldName,em=(e,t,{mergeObjects:n})=>n(e,t),tm=(e,t)=>t,nm=(e,t,{streamFieldInfo:n,existingData:r})=>{if(!e&&!r)return t;const i=[],a=e??r,o=n?.isLastChunk?t.length:Math.max(a.length,t.length);for(let s=0;s<o;s++)i[s]=void 0===t[s]?a[s]:t[s];return i},rm=class{config;typePolicies={};toBeAdded={};supertypeMap=/* @__PURE__ */new Map;fuzzySubtypes=/* @__PURE__ */new Map;cache;rootIdsByTypename={};rootTypenamesById={};usingPossibleTypes=!1;constructor(e){this.config=e,this.config={dataIdFromObject:mp,...e},this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}identify(e,t){const n=this,r=t&&(t.typename||t.storeObject?.__typename)||e.__typename;if(r===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];const i=t&&t.storeObject||e,a={...t,typename:r,storeObject:i,readField:t&&t.readField||((...e)=>{const t=am(e,i);return n.readField(t,{store:n.cache.data,variables:t.variables})})};let o;const s=r&&this.getTypePolicy(r);let l=s&&s.keyFn||this.config.dataIdFromObject;return Ip.withValue(!0,()=>{for(;l;){const t=l({...e,...i},a);if(!Ih(t)){o=t;break}l=jp(t)}}),o=o?String(o):void 0,a.keyObject?[o,a.keyObject]:[o]}addTypePolicies(e){Object.keys(e).forEach(t=>{const{queryType:n,mutationType:r,subscriptionType:i,...a}=e[t];n&&this.setRootTypename("Query",t),r&&this.setRootTypename("Mutation",t),i&&this.setRootTypename("Subscription",t),pp.call(this.toBeAdded,t)?this.toBeAdded[t].push(a):this.toBeAdded[t]=[a]})}updateTypePolicy(e,t,n){const r=this.getTypePolicy(e),{keyFields:i,fields:a}=t;function o(e,t){e.merge="function"==typeof t?t:!0===t?em:!1===t?tm:e.merge}o(r,t.merge),r.keyFn=!1===i?Jp:Ih(i)?jp(i):"function"==typeof i?i:r.keyFn,a&&Object.keys(a).forEach(t=>{let r=n[t];r&&r?.typename===e||(r=n[t]={typename:e});const i=a[t];if("function"==typeof i)r.read=i;else{const{keyArgs:e,read:t,merge:n}=i;r.keyFn=!1===e?$p:Ih(e)?Fp(e):"function"==typeof e?e:r.keyFn,"function"==typeof t&&(r.read=t),o(r,n)}r.read&&r.merge&&(r.keyFn=r.keyFn||$p)})}setRootTypename(e,t=e){const n="ROOT_"+e.toUpperCase(),r=this.rootTypenamesById[n];t!==r&&(Pu(!r||r===e,108,e),r&&delete this.rootIdsByTypename[r],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)}addPossibleTypes(e){this.usingPossibleTypes=!0,Object.keys(e).forEach(t=>{this.getSupertypeSet(t,!0),e[t].forEach(e=>{this.getSupertypeSet(e,!0).add(t);const n=e.match(vp);n&&n[0]===e||this.fuzzySubtypes.set(e,new RegExp(e))})})}getTypePolicy(e){if(!pp.call(this.typePolicies,e)){const t=this.typePolicies[e]={};t.fields={};let n=this.supertypeMap.get(e);!n&&this.fuzzySubtypes.size&&(n=this.getSupertypeSet(e,!0),this.fuzzySubtypes.forEach((t,r)=>{if(t.test(e)){const e=this.supertypeMap.get(r);e&&e.forEach(e=>n.add(e))}})),n&&n.size&&n.forEach(e=>{const{fields:n,...r}=this.getTypePolicy(e);Object.assign(t,r),Object.assign(t.fields,n)})}const t=this.toBeAdded[e];return t&&t.length&&t.splice(0).forEach(t=>{this.updateTypePolicy(e,t,this.typePolicies[e].fields)}),this.typePolicies[e]}getFieldPolicy(e,t){if(e)return this.getTypePolicy(e).fields[t]}getSupertypeSet(e,t){let n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=/* @__PURE__ */new Set),n}fragmentMatches(e,t,n,r){if(!e.typeCondition)return!0;if(!t)return!1;const i=e.typeCondition.name.value;if(t===i)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(i)){const a=this.getSupertypeSet(t,!0),o=[a],s=e=>{const t=this.getSupertypeSet(e,!1);t&&t.size&&o.indexOf(t)<0&&o.push(t)};let l=!(!n||!this.fuzzySubtypes.size),c=!1;for(let d=0;d<o.length;++d){const u=o[d];if(u.has(i))return a.has(i)||a.add(i),!0;u.forEach(s),l&&d===o.length-1&&yp(e.selectionSet,n,r)&&(l=!1,c=!0,this.fuzzySubtypes.forEach((e,n)=>{const r=t.match(e);r&&r[0]===t&&s(n)}))}}return!1}hasKeyArgs(e,t){const n=this.getFieldPolicy(e,t);return!(!n||!n.keyFn)}getStoreFieldName(e){const{typename:t,fieldName:n}=e,r=this.getFieldPolicy(t,n);let i,a=r&&r.keyFn;if(a&&t){const r={typename:t,fieldName:n,field:e.field||null,variables:e.variables},o=Kp(e);for(;a;){const e=a(o,r);if(!Ih(e)){i=e||n;break}a=Fp(e)}}return void 0===i&&(i=e.field?function(e,t){let n=null;e.directives&&(n={},e.directives.forEach(e=>{n[e.name.value]={},e.arguments&&e.arguments.forEach(({name:r,value:i})=>Qu(n[e.name.value],r,i,t))}));let r=null;return e.arguments&&e.arguments.length&&(r={},e.arguments.forEach(({name:e,value:n})=>Qu(r,e,n,t))),Ah(e.name.value,r,n)}(e.field,e.variables):Ah(n,Kp(e))),!1===i?n:n===bp(i)?i:n+":"+i}readField(e,t){const n=e.from;if(!n)return;if(!e.field&&!e.fieldName)return;if(void 0===e.typename){const r=t.store.getFieldValue(n,"__typename");r&&(e.typename=r)}const r=this.getStoreFieldName(e),i=bp(r),a=t.store.getFieldValue(n,r),o=this.getFieldPolicy(e.typename,i),s=o&&o.read;if(s){const i=im(this,n,e,t,t.store.getStorage(rp(n)?n.__ref:n,r));return Xp.withValue(this.cache,s,[a,i])}return a}getReadFunction(e,t){const n=this.getFieldPolicy(e,t);return n&&n.read}getMergeFunction(e,t,n){let r=this.getFieldPolicy(e,t),i=r&&r.merge;return!i&&n&&(r=this.getTypePolicy(n),i=r&&r.merge),i}runMergeFunction(e,t,{field:n,typename:r,merge:i,path:a},o,s){const l=e;if(i===em)return om(o.store)(e,t);if(i===tm)return t;o.overwrite&&(e=void 0);const c=o.extensions?.[uf]?.deref()?.peekArray(a);if(c){const{current:e,previous:n}=c;if(n&&Jh(n.incoming,t)&&Jh(n.streamFieldInfo,e))return n.result}const d=i(e,t,function(e,t,n,r,i,a){const o={...im(e,void 0,n,r,i),extensions:r.extensions,existingData:a},s=r.extensions;if(s&&uf in s){const{[uf]:e,...t}=s,r=e?.deref()?.peekArray(n.path);r&&(o.streamFieldInfo=r.current),o.extensions=0===Object.keys(t).length?void 0:t}return o}(this,0,{typename:r,fieldName:n.name.value,field:n,variables:o.variables,path:a},o,s||{},l));return c&&(c.previous={incoming:t,streamFieldInfo:c.current,result:d}),d}};function im(e,t,n,r,i){const a=e.getStoreFieldName(n),o=bp(a),s=n.variables||r.variables,{toReference:l,canRead:c}=r.store;return{args:Kp(n),field:n.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:rp,toReference:l,storage:i,cache:e.cache,canRead:c,readField:(...n)=>e.readField(am(n,t,s),r),mergeObjects:om(r.store)}}function am(e,t,n){const{0:r,1:i,length:a}=e;let o;return"string"==typeof r?o={fieldName:r,from:a>1?i:t}:(o={...r},pp.call(o,"from")||(o.from=t)),void 0===o.variables&&(o.variables=n),o}function om(e){return function(t,n){if(Ih(t)||Ih(n))throw Iu(111);if(uh(t)&&uh(n)){const r=e.getFieldValue(t,"__typename"),i=e.getFieldValue(n,"__typename");if(r&&i&&r!==i)return n;if(rp(t)&&xp(n))return e.merge(t.__ref,n),t;if(xp(t)&&rp(n))return e.merge(t,n.__ref),n;if(xp(t)&&xp(n))return{...t,...n}}return n}}function sm(e){return[e.selectionSet,e.objectOrReference,e.context]}var lm=class{executeSelectionSet;executeSubSelectedArray;config;knownResults=/* @__PURE__ */new WeakMap;constructor(e){this.config=e,this.executeSelectionSet=Yf(e=>{const t=sm(e);return this.executeSelectionSet.peek(...t)||(Ep(e.context.store,e.enclosingRef.__ref),this.execSelectionSetImpl(e))},{max:Bu["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:sm,makeCacheKey(e,t,n){if(Mp(n.store))return n.store.makeCacheKey(e,rp(t)?t.__ref:t,n.varString)}}),this.executeSubSelectedArray=Yf(e=>(Ep(e.context.store,e.enclosingRef.__ref),this.execSubSelectedArrayImpl(e)),{max:Bu["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey({field:e,array:t,context:n}){if(Mp(n.store))return n.store.makeCacheKey(e,t,n.varString)}})}diffQueryAgainstStore({store:e,query:t,rootId:n="ROOT_QUERY",variables:r,returnPartialData:i=!0}){const a=this.config.cache.policies;r={...gh(Oh(t)),...r};const o=Lh(n),s=this.executeSelectionSet({selectionSet:xh(t).selectionSet,objectOrReference:o,enclosingRef:o,context:{store:e,query:t,policies:a,variables:r,varString:Sh(r),...wp(t,this.config.fragments)}});let l;s.missing&&(l=new fp(function(e){try{JSON.stringify(e,(e,t)=>{if("string"==typeof t)throw t;return t})}catch(d){return d}}(s.missing),s.missing,t,r));const c=!l,{result:d}=s;return{result:c?d:i?0===Object.keys(d).length?null:d:null,complete:c,missing:l}}isFresh(e,t,n,r){if(Mp(r.store)&&this.knownResults.get(e)===n){const i=this.executeSelectionSet.peek(n,t,r);if(i&&e===i.result)return!0}return!1}execSelectionSetImpl({selectionSet:e,objectOrReference:t,enclosingRef:n,context:r}){if(rp(t)&&!r.policies.rootTypenamesById[t.__ref]&&!r.store.has(t.__ref))return{result:{},missing:`Dangling reference to missing ${t.__ref} object`};const{variables:i,policies:a,store:o}=r,s=o.getFieldValue(t,"__typename"),l=[];let c;const d=new mh;function u(e,t){return e.missing&&(c=d.merge(c,{[t]:e.missing})),e.result}"string"!=typeof s||a.rootIdsByTypename[s]||l.push({__typename:s});const h=new Set(e.selections);h.forEach(e=>{if(Wh(e,i))if(Rh(e)){let i=a.readField({fieldName:e.name.value,field:e,variables:r.variables,from:t},r);const o=Uh(e);void 0===i?ap.added(e)||(c=d.merge(c,{[o]:`Can't find field '${e.name.value}' on ${rp(t)?t.__ref+" object":"object "+JSON.stringify(t,null,2)}`})):Ih(i)?i.length>0&&(i=u(this.executeSubSelectedArray({field:e,array:i,enclosingRef:n,context:r}),o)):e.selectionSet&&null!=i&&(i=u(this.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:i,enclosingRef:rp(i)?i:n,context:r}),o)),void 0!==i&&l.push({[o]:i})}else{const t=vh(e,r.lookupFragment);if(!t&&"FragmentSpread"===e.kind)throw Iu(112,e.name.value);t&&a.fragmentMatches(t,s)&&t.selectionSet.selections.forEach(h.add,h)}});const f={result:Vh(l),missing:c};return f.result&&this.knownResults.set(f.result,e),f}execSubSelectedArrayImpl({field:e,array:t,enclosingRef:n,context:r}){let i,a=new mh;function o(e,t){return e.missing&&(i=a.merge(i,{[t]:e.missing})),e.result}return e.selectionSet&&(t=t.filter(e=>void 0===e||r.store.canRead(e))),t=t.map((t,i)=>null===t?null:Ih(t)?o(this.executeSubSelectedArray({field:e,array:t,enclosingRef:n,context:r}),i):e.selectionSet?o(this.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:t,enclosingRef:rp(t)?t:n,context:r}),i):t),{result:t,missing:i}}};function cm(e,t,n){const r=`${t}${n}`;let i=e.flavors.get(r);return i||e.flavors.set(r,i=e.clientOnly===t&&e.deferred===n?e:{...e,clientOnly:t,deferred:n}),i}var dm=class{cache;reader;fragments;constructor(e,t,n){this.cache=e,this.reader=t,this.fragments=n}writeToStore(e,{query:t,result:n,dataId:r,variables:i,overwrite:a,extensions:o}){const s=wh(t),l=new mh;i={...gh(s),...i};const c={store:e,written:{},merge:(e,t)=>l.merge(e,t),variables:i,varString:Sh(i),...wp(t,this.fragments),overwrite:!!a,incomingById:/* @__PURE__ */new Map,clientOnly:!1,deferred:!1,flavors:/* @__PURE__ */new Map,extensions:o},d=this.processSelectionSet({result:n||{},dataId:r,selectionSet:s.selectionSet,mergeTree:{map:/* @__PURE__ */new Map},context:c,path:[]});if(!rp(d))throw Iu(114,n);return c.incomingById.forEach(({storeObject:t,mergeTree:n,fieldNodeSet:r},i)=>{const a=Lh(i);if(n&&n.map.size){const e=this.applyMerges(n,a,t,c);if(rp(e))return;t=e}e.merge(i,t)}),e.retain(d.__ref),d}processSelectionSet({dataId:e,result:t,selectionSet:n,context:r,mergeTree:i,path:a}){const{policies:o}=this.cache;let s={};const l=e&&o.rootTypenamesById[e]||gm(t,n,r.fragmentMap)||e&&r.store.get(e,"__typename");"string"==typeof l&&(s.__typename=l);const c=(...e)=>{const t=am(e,s,r.variables);if(rp(t.from)){const e=r.incomingById.get(t.from.__ref);if(e){const n=o.readField({...t,from:e.storeObject},r);if(void 0!==n)return n}}return o.readField(t,r)},d=/* @__PURE__ */new Set;this.flattenFields(n,t,r,l).forEach((e,n)=>{const r=t[Uh(n)],u=[...a,n.name.value];if(d.add(n),void 0!==r){const t=o.getStoreFieldName({typename:l,fieldName:n.name.value,field:n,variables:e.variables}),a=hm(i,t);let d,h=this.processFieldValue(r,n,n.selectionSet?cm(e,!1,!1):e,a,u);n.selectionSet&&(rp(h)||xp(h))&&(d=c("__typename",h));const f=o.getMergeFunction(l,n.name.value,d);f?a.info={field:n,typename:l,merge:f,path:u}:e.extensions?.[uf]&&Array.isArray(h)&&function(e){return!!e.directives&&e.directives.some(e=>"stream"===e.name.value)}(n)?a.info={field:n,typename:l,merge:nm,path:u}:mm(i,t),s=e.merge(s,{[t]:h})}});try{const[i,a]=o.identify(t,{typename:l,selectionSet:n,fragmentMap:r.fragmentMap,storeObject:s,readField:c});e=e||i,a&&(s=r.merge(s,a))}catch(vAe){if(!e)throw vAe}if("string"==typeof e){const a=Lh(e),o=r.written[e]||(r.written[e]=[]);if(o.indexOf(n)>=0)return a;if(o.push(n),this.reader&&this.reader.isFresh(t,a,n,r))return a;const l=r.incomingById.get(e);return l?(l.storeObject=r.merge(l.storeObject,s),l.mergeTree=fm(l.mergeTree,i),d.forEach(e=>l.fieldNodeSet.add(e))):r.incomingById.set(e,{storeObject:s,mergeTree:pm(i)?void 0:i,fieldNodeSet:d}),a}return s}processFieldValue(e,t,n,r,i){return t.selectionSet&&null!==e?Ih(e)?e.map((e,a)=>{const o=this.processFieldValue(e,t,n,hm(r,a),[...i,a]);return mm(r,a),o}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:r,path:i}):e}flattenFields(e,t,n,r=gm(t,e,n.fragmentMap)){const i=/* @__PURE__ */new Map,{policies:a}=this.cache,o=new Hu(!1);return function e(s,l){const c=o.lookup(s,l.clientOnly,l.deferred);c.visited||(c.visited=!0,s.selections.forEach(o=>{if(!Wh(o,n.variables))return;let{clientOnly:s,deferred:c}=l;if(s&&c||!Dh(o.directives)||o.directives.forEach(e=>{const t=e.name.value;if("client"===t&&(s=!0),"defer"===t){const t=ju(e,n.variables);t&&!1===t.if||(c=!0)}}),Rh(o)){const e=i.get(o);e&&(s=s&&e.clientOnly,c=c&&e.deferred),i.set(o,cm(n,s,c))}else{const i=vh(o,n.lookupFragment);if(!i&&"FragmentSpread"===o.kind)throw Iu(116,o.name.value);i&&a.fragmentMatches(i,r,t,n.variables)&&e(i.selectionSet,cm(n,s,c))}}))}(e,n),i}applyMerges(e,t,n,r,i){if(e.map.size&&!rp(n)){const a=Ih(n)||!rp(t)&&!xp(t)?void 0:t,o=n;let s;a&&!i&&(i=[rp(a)?a.__ref:a]);const l=(e,t)=>Ih(e)?"number"==typeof t?e[t]:void 0:r.store.getFieldValue(e,String(t));e.map.forEach((e,t)=>{const n=l(a,t),c=l(o,t);if(void 0===c)return;i&&i.push(t);const d=this.applyMerges(e,n,c,r,i);d!==c&&(s=s||/* @__PURE__ */new Map,s.set(t,d)),i&&Pu(i.pop()===t)}),s&&(n=Ih(o)?o.slice(0):{...o},s.forEach((e,t)=>{n[t]=e}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,r,i&&r.store.getStorage(...i)):n}},um=[];function hm({map:e},t){return e.has(t)||e.set(t,um.pop()||{map:/* @__PURE__ */new Map}),e.get(t)}function fm(e,t){if(e===t||!t||pm(t))return e;if(!e||pm(e))return t;const n=e.info&&t.info?{...e.info,...t.info}:e.info||t.info,r=e.map.size&&t.map.size,i={info:n,map:r?/* @__PURE__ */new Map:e.map.size?e.map:t.map};if(r){const n=new Set(t.map.keys());e.map.forEach((e,r)=>{i.map.set(r,fm(e,t.map.get(r))),n.delete(r)}),n.forEach(n=>{i.map.set(n,fm(t.map.get(n),e.map.get(n)))})}return i}function pm(e){return!e||!(e.info||e.map.size)}function mm({map:e},t){const n=e.get(t);n&&pm(n)&&(um.push(n),e.delete(t))}function gm(e,t,n){let r;for(const i of t.selections)if(Rh(i)){if("__typename"===i.name.value)return e[Uh(i)]}else r?r.push(i):r=[i];if("string"==typeof e.__typename)return e.__typename;if(r)for(const i of r){const t=gm(e,vh(i,n).selectionSet,n);if("string"==typeof t)return t}}var vm=class extends lp{data;optimisticData;config;watches=/* @__PURE__ */new Set;storeReader;storeWriter;addTypenameTransform=new tp(ap);maybeBroadcastWatch;assumeImmutableResults=!0;policies;makeVar=Gp;constructor(e={}){super(),this.config=function(e){return ch(gp,e)}(e),this.policies=new rm({cache:this,dataIdFromObject:this.config.dataIdFromObject,possibleTypes:this.config.possibleTypes,typePolicies:this.config.typePolicies}),this.init()}init(){const e=this.data=new Cp.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()}resetResultCache(){const{fragments:e}=this.config;this.addTypenameTransform.resetCache(),e?.resetCaches(),this.storeWriter=new dm(this,this.storeReader=new lm({cache:this,fragments:e}),e),this.maybeBroadcastWatch=Yf((e,t)=>this.broadcastWatch(e,t),{max:Bu["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:e=>{const t=e.optimistic?this.optimisticData:this.data;if(Mp(t)){const{optimistic:n,id:r,variables:i}=e;return t.makeCacheKey(e.query,e.callback,Sh({optimistic:n,id:r,variables:i}))}}}),
8
8
  /* @__PURE__ */new Set([this.data.group,this.optimisticData.group]).forEach(e=>e.resetCaching())}restore(e){return this.init(),e&&this.data.replace(e),this}extract(e=!1){return(e?this.optimisticData:this.data).extract()}read(e){const{returnPartialData:t=!1}=e;return this.storeReader.diffQueryAgainstStore({...e,store:e.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:t}).result}write(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}}modify(e){if(pp.call(e,"id")&&!e.id)return!1;const t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields,!1)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}}diff(e){return this.storeReader.diffQueryAgainstStore({...e,store:e.optimistic?this.optimisticData:this.data,rootId:e.id||"ROOT_QUERY",config:this.config})}watch(e){return this.watches.size||function(e){Yp(e).vars.forEach(t=>t.attachCache(e))}(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),()=>{this.watches.delete(e)&&!this.watches.size&&_p(this),this.maybeBroadcastWatch.forget(e)}}gc(e){Sh.reset(),np.reset();const t=this.optimisticData.gc();return e&&!this.txCount&&e.resetResultCache&&this.resetResultCache(),t}retain(e,t){return(t?this.optimisticData:this.data).retain(e)}release(e,t){return(t?this.optimisticData:this.data).release(e)}identify(e){if(rp(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(vAe){}}evict(e){if(!e.id){if(pp.call(e,"id"))return!1;e={...e,id:"ROOT_QUERY"}}try{return++this.txCount,this.optimisticData.evict(e,this.data)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}}reset(e){return this.init(),Sh.reset(),e&&e.discardWatches?(this.watches.forEach(e=>this.maybeBroadcastWatch.forget(e)),this.watches.clear(),_p(this)):this.broadcastWatches(),Promise.resolve()}removeOptimistic(e){const t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())}txCount=0;batch(e){const{update:t,optimistic:n=!0,removeOptimistic:r,onWatchUpdated:i}=e;let a;const o=e=>{const{data:n,optimisticData:r}=this;++this.txCount,e&&(this.data=this.optimisticData=e);try{return a=t(this)}finally{--this.txCount,this.data=n,this.optimisticData=r}},s=/* @__PURE__ */new Set;return i&&!this.txCount&&this.broadcastWatches({...e,onWatchUpdated:e=>(s.add(e),!1)}),"string"==typeof n?this.optimisticData=this.optimisticData.addLayer(n,o):!1===n?o(this.data):o(),"string"==typeof r&&(this.optimisticData=this.optimisticData.removeLayer(r)),i&&s.size?(this.broadcastWatches({...e,onWatchUpdated(e,t){const n=i.call(this,e,t);return!1!==n&&s.delete(e),n}}),s.size&&s.forEach(e=>this.maybeBroadcastWatch.dirty(e))):this.broadcastWatches(e),a}performTransaction(e,t){return this.batch({update:e,optimistic:t||null!==t})}transformDocument(e){return this.addTypenameTransform.transformDocument(this.addFragmentsToDocument(e))}fragmentMatches(e,t){return this.policies.fragmentMatches(e,t)}lookupFragment(e){return this.config.fragments?.lookup(e)||null}resolvesClientField(e,t){return!!this.policies.getReadFunction(e,t)}broadcastWatches(e){if(!this.txCount){const t=this.onAfterBroadcast,n=/* @__PURE__ */new Set;this.onAfterBroadcast=e=>{n.add(e)};try{this.watches.forEach(t=>this.maybeBroadcastWatch(t,e)),n.forEach(e=>e())}finally{this.onAfterBroadcast=t}}}addFragmentsToDocument(e){const{fragments:t}=this.config;return t?t.transform(e):e}broadcastWatch(e,t){const{lastDiff:n}=e,r=this.diff(e);t&&(e.optimistic&&"string"==typeof t.optimistic&&(r.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,r,n))||n&&Jh(n.result,r.result)||e.callback(e.lastDiff=r,n)}};function bm(e,t){return"object"==typeof e&&null!==e&&e[Symbol.for("apollo.error")]===t}function ym(e){Object.defineProperty(e,Symbol.for("apollo.error"),{value:e.name,enumerable:!1,writable:!1,configurable:!1})}function xm(e){return e.map(e=>e.message||"Error message not found.").join("\n")}var wm=class e extends Error{static is(e){return bm(e,"CombinedProtocolErrors")}static formatMessage=xm;errors;constructor(t){super(e.formatMessage(t,{defaultFormatMessage:xm})),this.name="CombinedProtocolErrors",this.errors=t,ym(this),Object.setPrototypeOf(this,e.prototype)}},Om=class e extends Error{static is(e){return bm(e,"UnconventionalError")}constructor(t){super("An error of unexpected shape occurred.",{cause:t}),this.name="UnconventionalError",ym(this),Object.setPrototypeOf(this,e.prototype)}};function km(e){return e.filter(e=>e).map(e=>e.message||"Error message not found.").join("\n")}var Sm,Cm=class e extends Error{static is(e){return bm(e,"CombinedGraphQLErrors")}static formatMessage=km;errors;data;extensions;constructor(t,n=t.errors||[]){super(e.formatMessage(n,{result:t,defaultFormatMessage:km})),this.errors=n,this.data=t.data,this.extensions=t.extensions,this.name="CombinedGraphQLErrors",ym(this),Object.setPrototypeOf(this,e.prototype)}},zm=/* @__PURE__ */new WeakSet,Nm=class e extends Error{static is(e){return bm(e,"ServerError")}response;statusCode;bodyText;constructor(t,n){super(t),this.name="ServerError",this.response=n.response,this.statusCode=n.response.status,this.bodyText=n.bodyText,ym(this),Object.setPrototypeOf(this,e.prototype)}},Em=class e extends Error{static is(e){return bm(e,"ServerParseError")}response;statusCode;bodyText;constructor(t,n){super(t instanceof Error?t.message:"Could not parse server response",{cause:t}),this.name="ServerParseError",this.response=n.response,this.statusCode=n.response.status,this.bodyText=n.bodyText,ym(this),Object.setPrototypeOf(this,e.prototype)}},Am=Symbol();!function(e){e[e.loading=1]="loading",e[e.setVariables=2]="setVariables",e[e.fetchMore=3]="fetchMore",e[e.refetch=4]="refetch",e[e.poll=6]="poll",e[e.ready=7]="ready",e[e.error=8]="error",e[e.streaming=9]="streaming"}(Sm||(Sm={}));var{assign:Tm,hasOwnProperty:Pm}=Object,Mm={loading:!0,networkStatus:Sm.loading,data:void 0,dataState:"empty",partial:!0},Im={loading:!1,networkStatus:Sm.ready,data:void 0,dataState:"empty",partial:!0},Rm=class{options;queryName;variablesUnknown=!1;_lastWrite;get query(){return this.lastQuery}get variables(){return this.options.variables}unsubscribeFromCache;input;subject;isTornDown;queryManager;subscriptions=/* @__PURE__ */new Set;waitForNetworkResult;lastQuery;linkSubscription;pollingInfo;get networkStatus(){return this.subject.getValue().result.networkStatus}get cache(){return this.queryManager.cache}constructor({queryManager:e,options:t,transformedQuery:n=e.transform(t.query)}){this.queryManager=e,this.waitForNetworkResult="network-only"===t.fetchPolicy,this.isTornDown=!1,this.subscribeToMore=this.subscribeToMore.bind(this),this.maskResult=this.maskResult.bind(this);const{watchQuery:{fetchPolicy:r="cache-first"}={}}=e.defaultOptions,{fetchPolicy:i=r,initialFetchPolicy:a=("standby"===i?r:i)}=t;t[hf]&&(Pu("standby"===i,82),this.variablesUnknown=!0),this.lastQuery=n,this.options={...t,initialFetchPolicy:a,fetchPolicy:i,variables:this.getVariablesWithDefaults(t.variables)},this.initializeObservablesQueue(),this["@@observable"]=()=>this,Symbol.observable&&(this[Symbol.observable]=()=>this);const o=wh(this.query);this.queryName=o&&o.name&&o.name.value}initializeObservablesQueue(){this.subject=new Rd({query:this.query,variables:this.variables,result:Mm,meta:{}});const e=this.subject.pipe(wu({subscribe:()=>{this.subject.observed||(this.reobserve(),setTimeout(()=>this.updatePolling()))},unsubscribe:()=>{this.subject.observed||this.tearDownQuery()}}),Hh(({query:e,variables:t,result:n,meta:r},i)=>{const{shouldEmit:a}=r;if(n===Mm&&(i.previous=void 0,i.previousVariables=void 0),"standby"===this.options.fetchPolicy||2===a)return;if(1===a)return l();const{previous:o,previousVariables:s}=i;if(o){const r=this.queryManager.getDocumentInfo(e),i=this.queryManager.dataMasking,a=i?r.nonReactiveQuery:e;if((i||r.hasNonreactiveDirective?af(a,o,n,t):Jh(o,n))&&Jh(s,t))return}if(3!==a||this.options.notifyOnNetworkStatusChange&&!Jh(o,n))return l();function l(){return i.previous=n,i.previousVariables=t,n}},()=>({})));this.pipe=e.pipe.bind(e),this.subscribe=e.subscribe.bind(e),this.input=new Md,this.input.complete=()=>{},this.input.pipe(this.operator).subscribe(this.subject)}subscribe;pipe;[Symbol.observable];"@@observable";getCacheDiff({optimistic:e=!0}={}){return this.cache.diff({query:this.query,variables:this.variables,returnPartialData:!0,optimistic:e})}getInitialResult(e){let t=e||this.options.fetchPolicy;!this.queryManager.prioritizeCacheValues||"network-only"!==t&&"cache-and-network"!==t||(t="cache-first");const n=()=>{const e=this.getCacheDiff(),t=this.options.returnPartialData||e.complete?e.result??void 0:void 0;return this.maskResult({data:t,dataState:e.complete?"complete":void 0===t?"empty":"partial",loading:!e.complete,networkStatus:e.complete?Sm.ready:Sm.loading,partial:!e.complete})};switch(t){case"cache-only":return{...n(),loading:!1,networkStatus:Sm.ready};case"cache-first":return n();case"cache-and-network":return{...n(),loading:!0,networkStatus:Sm.loading};case"standby":return Im;default:return Mm}}resubscribeCache(){const{variables:e,fetchPolicy:t}=this.options,n=this.query,r="standby"===t||"no-cache"===t||this.waitForNetworkResult,i=!Dm({query:n,variables:e},this.unsubscribeFromCache)&&!this.waitForNetworkResult;if((r||i)&&this.unsubscribeFromCache?.(),r||!i)return;const a={query:n,variables:e,optimistic:!0,watcher:this,callback:e=>{const t=this.queryManager.getDocumentInfo(n);if((t.hasClientExports||t.hasForcedResolvers)&&(a.lastDiff=void 0),a.lastOwnDiff===e)return;const{result:r}=this.subject.getValue();(e.complete||!r.error&&r!==Mm&&r!==Im)&&(Jh(r.data,e.result)||this.scheduleNotify())}},o=this.cache.watch(a);this.unsubscribeFromCache=Object.assign(()=>{this.unsubscribeFromCache=void 0,o()},{query:n,variables:e})}stableLastResult;getCurrentResult(){const{result:e}=this.subject.getValue();let t=e.networkStatus===Sm.error||this.hasObservers()||"no-cache"===this.options.fetchPolicy?e:this.getInitialResult();return t===Mm&&(t=this.getInitialResult()),Jh(this.stableLastResult,t)||(this.stableLastResult=t),this.stableLastResult}refetch(e){const{fetchPolicy:t}=this.options,n={pollInterval:0};return n.fetchPolicy="no-cache"===t?"no-cache":"network-only",e&&!Jh(this.variables,e)&&(n.variables=this.options.variables=this.getVariablesWithDefaults({...this.variables,...e})),this._lastWrite=void 0,this._reobserve(n,{newNetworkStatus:Sm.refetch})}fetchMore({query:e,variables:t,context:n,errorPolicy:r,updateQuery:i}){Pu("cache-only"!==this.options.fetchPolicy,84,qu(this.query,"(anonymous)"));const a={...ch(this.options,{errorPolicy:"none"},{query:e,context:n,errorPolicy:r}),variables:e?t:{...this.variables,...t},fetchPolicy:"no-cache",notifyOnNetworkStatusChange:this.options.notifyOnNetworkStatusChange};a.query=this.transformDocument(a.query),this.lastQuery=e?this.transformDocument(this.options.query):a.query;let o=!1;const s="no-cache"!==this.options.fetchPolicy;s||Pu(i,85);const{finalize:l,pushNotification:c}=this.pushOperation(Sm.fetchMore);c({source:"newNetworkStatus",kind:"N",value:{}},{shouldEmit:3});const{promise:d,operator:u}=Lm(),{observable:h}=this.queryManager.fetchObservableWithInfo(a,{networkStatus:Sm.fetchMore,exposeExtensions:!0}),f=h.pipe(u,mu(e=>"N"===e.kind&&"network"===e.source)).subscribe({next:e=>{o=!1;const t=e.value,n=t[df];if(op(e.value.networkStatus)&&l(),s){const e=this.getCacheDiff();this.cache.batch({update:e=>{i?e.updateQuery({query:this.query,variables:this.variables,returnPartialData:!0,optimistic:!1,extensions:n},e=>i(e,{fetchMoreResult:t.data,variables:a.variables})):e.writeQuery({query:a.query,variables:a.variables,data:t.data,extensions:n})},onWatchUpdated:(n,r)=>{if(n.watcher===this&&!Jh(r.result,e.result)){o=!0;const e=this.getCurrentResult();sp(t.networkStatus)&&c({kind:"N",source:"network",value:{...e,networkStatus:t.networkStatus===Sm.error?Sm.ready:t.networkStatus,loading:!1,data:r.result,dataState:"streaming"===t.dataState?"streaming":"complete"}})}}})}else{const e=this.getCurrentResult(),n=i(e.data,{fetchMoreResult:t.data,variables:a.variables});c({kind:"N",value:{...e,networkStatus:Sm.ready,loading:!1,data:n,dataState:"streaming"===e.dataState?"streaming":"complete"},source:"network"})}}});return jh(d.then(e=>Xh(this.maskResult(e))).finally(()=>{if(f.unsubscribe(),l(),s&&!o){const e=this.getCurrentResult();"streaming"===e.dataState?c({kind:"N",source:"network",value:{...e,dataState:"complete",networkStatus:Sm.ready}}):c({kind:"N",source:"newNetworkStatus",value:{}},{shouldEmit:1})}}))}subscribeToMore(e){const t=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:t=>{const{updateQuery:n,onError:r}=e,{error:i}=t;i?r?r(i):Pu.error(86,i):n&&this.updateQuery((e,r)=>n(e,{subscriptionData:t,...r}))}});return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)&&t.unsubscribe()}}applyOptions(e){const t=ch(this.options,e||{});Tm(this.options,t),this.updatePolling()}async setVariables(e){return e=this.getVariablesWithDefaults(e),Jh(this.variables,e)?Xh(this.getCurrentResult()):(this.options.variables=e,this.hasObservers()?this._reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:e},{newNetworkStatus:Sm.setVariables}):Xh(this.getCurrentResult()))}updateQuery(e){const{queryManager:t}=this,{result:n,complete:r}=this.getCacheDiff({optimistic:!1}),i=e(n,{variables:this.variables,complete:!!r,previousData:n});i&&(this.cache.writeQuery({query:this.options.query,data:i,variables:this.variables}),t.broadcastQueries())}startPolling(e){this.options.pollInterval=e,this.updatePolling()}stopPolling(){this.options.pollInterval=0,this.updatePolling()}applyNextFetchPolicy(e,t){if(t.nextFetchPolicy){const{fetchPolicy:n="cache-first",initialFetchPolicy:r=n}=t;"standby"===n||("function"==typeof t.nextFetchPolicy?t.fetchPolicy=t.nextFetchPolicy.call(t,n,{reason:e,options:t,observable:this,initialFetchPolicy:r}):t.fetchPolicy="variables-changed"===e?r:t.nextFetchPolicy)}return t.fetchPolicy}fetch(e,t,n,r){const i=this.options.fetchPolicy;e.context??={};let a=!1,{observable:o,fromLink:s}=this.queryManager.fetchObservableWithInfo(e,{networkStatus:t,query:n,onCacheHit:()=>{a=!0},fetchQueryOperator:e=>new zd(n=>{try{return e.subscribe({next(e){a=!0,n.next(e)},error:e=>n.error(e),complete:()=>n.complete()})}finally{a||(d.override=t,this.input.next({kind:"N",source:"newNetworkStatus",value:{resetError:!0},query:l,variables:c,meta:{shouldEmit:3,fetchPolicy:i}}))}}),observableQuery:this});const{query:l,variables:c}=this,d={abort:()=>{h.unsubscribe()},query:l,variables:c};this.activeOperations.add(d);let u=t==Sm.refetch||t==Sm.setVariables;o=o.pipe(r,bu());const h=o.pipe(wu({next:e=>{"newNetworkStatus"===e.source||"N"===e.kind&&e.value.loading?d.override=t:delete d.override},finalize:()=>this.activeOperations.delete(d)})).subscribe({next:e=>{const t={};u&&"N"===e.kind&&"loading"in e.value&&!e.value.loading&&(u=!1,t.shouldEmit=1),this.input.next({...e,query:l,variables:c,meta:t})}});return{fromLink:s,subscription:h,observable:o}}didWarnCacheOnlyPolling=!1;updatePolling(){if(this.queryManager.ssrMode)return;const{pollingInfo:e,options:{fetchPolicy:t,pollInterval:n}}=this,r=()=>{const{options:e}=this;return!e.pollInterval||!this.hasObservers()||"cache-only"===e.fetchPolicy||"standby"===e.fetchPolicy};if(r())return void this.cancelPolling();if(e?.interval===n)return;(e||(this.pollingInfo={})).interval=n;const i=()=>{if(r())return this.cancelPolling();this.pollingInfo&&(sp(this.networkStatus)||this.options.skipPollAttempt?.()?a():this._reobserve({fetchPolicy:"no-cache"===this.options.initialFetchPolicy?"no-cache":"network-only"},{newNetworkStatus:Sm.poll}).then(a,a))},a=()=>{const e=this.pollingInfo;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(i,e.interval))};a()}cancelPolling(){this.pollingInfo&&(clearTimeout(this.pollingInfo.timeout),delete this.pollingInfo)}reobserve(e){return this._reobserve(e)}_reobserve(e,t){this.isTornDown=!1;let{newNetworkStatus:n}=t||{};this.queryManager.obsQueries.add(this);const r=n===Sm.refetch||n===Sm.poll,i=this.variables,a=this.options.fetchPolicy,o=ch(this.options,e||{});this.variablesUnknown&&="standby"===o.fetchPolicy;const s=r?o:Tm(this.options,o),l=this.transformDocument(s.query);this.lastQuery=l,e&&"variables"in e&&(s.variables=this.getVariablesWithDefaults(e.variables)),r||(this.updatePolling(),!e||!e.variables||Jh(e.variables,i)||"standby"===s.fetchPolicy||s.fetchPolicy!==a&&"function"!=typeof s.nextFetchPolicy||(this.applyNextFetchPolicy("variables-changed",s),void 0===n&&(n=Sm.setVariables)));const c=this.networkStatus;n||(n=Sm.loading,c!==Sm.loading&&e?.variables&&!Jh(e.variables,i)&&(n=Sm.setVariables),"standby"===s.fetchPolicy&&(n=Sm.ready)),"standby"===s.fetchPolicy&&this.cancelPolling(),this.resubscribeCache();const{promise:d,operator:u}=Lm("standby"===s.fetchPolicy?{data:void 0}:void 0),{subscription:h,observable:f,fromLink:p}=this.fetch(s,n,l,u);r||!p&&this.linkSubscription||(this.linkSubscription&&this.linkSubscription.unsubscribe(),this.linkSubscription=h);const m=Object.assign(jh(d.then(e=>Xh(this.maskResult(e))).finally(()=>{this.hasObservers()||0!==this.activeOperations.size||this.tearDownQuery()})),{retain:()=>{const e=f.subscribe({}),t=()=>e.unsubscribe();return d.then(t,t),m}});return m}hasObservers(){return this.subject.observed}stop(){this.subject.complete(),this.initializeObservablesQueue(),this.tearDownQuery()}tearDownQuery(){this.isTornDown||(this.resetNotifications(),this.unsubscribeFromCache?.(),this.linkSubscription&&(this.linkSubscription.unsubscribe(),delete this.linkSubscription),this.stopPolling(),this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions.clear(),this.queryManager.obsQueries.delete(this),this.isTornDown=!0,this.abortActiveOperations(),this._lastWrite=void 0)}transformDocument(e){return this.queryManager.transform(e)}maskResult(e){const t=this.queryManager.maskOperation({document:this.query,data:e.data,fetchPolicy:this.options.fetchPolicy,cause:this});return t===e.data?e:{...e,data:t}}dirty=!1;notifyTimeout;resetNotifications(){this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0),this.dirty=!1}scheduleNotify(){this.dirty||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(()=>this.notify(!0),0)))}notify(e=!1){if(!e){const e=this.queryManager.getDocumentInfo(this.query);if(e.hasClientExports||e.hasForcedResolvers)return}const{dirty:t}=this;if(this.resetNotifications(),t&&("cache-only"===this.options.fetchPolicy||"cache-and-network"===this.options.fetchPolicy||!this.activeOperations.size)){const e=this.getCacheDiff();Jh(e.result,this.getCacheDiff({optimistic:!1}).result)?this.reobserveCacheFirst():this.input.next({kind:"N",value:{data:e.result,dataState:e.complete?"complete":e.result?"partial":"empty",networkStatus:Sm.ready,loading:!1,error:void 0,partial:!e.complete},source:"cache",query:this.query,variables:this.variables,meta:{}})}}activeOperations=/* @__PURE__ */new Set;pushOperation(e){let t=!1;const{query:n,variables:r}=this,i=()=>{this.activeOperations.delete(a)},a={override:e,abort:()=>{t=!0,i()},query:n,variables:r};return this.activeOperations.add(a),{finalize:i,pushNotification:(e,i)=>{t||this.input.next({...e,query:n,variables:r,meta:{...i}})}}}calculateNetworkStatus(e){return e===Sm.streaming?e:Array.from(this.activeOperations.values()).reverse().find(e=>Dm(e,this)&&void 0!==e.override)?.override??e}abortActiveOperations(){this.activeOperations.forEach(e=>e.abort())}reset(){const e="cache-only"===this.options.fetchPolicy;this.setResult(e?Im:Mm,{shouldEmit:e?1:2}),this.abortActiveOperations()}setResult(e,t){this.input.next({source:"setResult",kind:"N",value:e,query:this.query,variables:this.variables,meta:{...t}})}operator=Hh(e=>{const{query:t,variables:n,meta:r}=e;if("setResult"===e.source)return{query:t,variables:n,result:e.value,meta:r};if("C"===e.kind||!Dm(e,this))return;let i;const a=this.subject.getValue();if("cache"===e.source){if(i=e.value,i.networkStatus===Sm.ready&&i.partial&&(!this.options.returnPartialData||a.result.networkStatus===Sm.error)&&"cache-only"!==this.options.fetchPolicy)return}else if("network"===e.source)this.waitForNetworkResult&&(this.waitForNetworkResult=!1,this.resubscribeCache()),i="E"===e.kind?{...Dm(a,e)?a.result:{data:void 0,dataState:"empty",partial:!0},error:e.error,networkStatus:Sm.error,loading:!1}:e.value,"E"===e.kind&&"streaming"===i.dataState&&(i.dataState="complete"),i.error&&(r.shouldEmit=1);else if("newNetworkStatus"===e.source){const t=Dm(a,e)?a.result:this.getInitialResult(r.fetchPolicy),{resetError:n}=e.value,o=n?void 0:t.error,s=o?Sm.error:Sm.ready;i={...t,error:o,networkStatus:s}}return Pu(i),i.error||delete i.error,i.networkStatus=this.calculateNetworkStatus(i.networkStatus),i.loading=sp(i.networkStatus),i=this.maskResult(i),void 0!==a.result.data&&i.data!==a.result.data&&Jh(i.data,a.result.data)&&(i.data=a.result.data),{query:t,variables:n,result:i,meta:r}});reobserveCacheFirst(){const{fetchPolicy:e,nextFetchPolicy:t}=this.options;"cache-and-network"===e||"network-only"===e?this.reobserve({fetchPolicy:"cache-first",nextFetchPolicy(n,r){return this.nextFetchPolicy=t,"function"==typeof this.nextFetchPolicy?this.nextFetchPolicy(n,r):e}}):this.reobserve()}getVariablesWithDefaults(e){return this.queryManager.getVariables(this.query,e)}};function Dm(e,t){return!!(e&&t&&e.query===t.query&&Jh(e.variables,t.variables))}function Lm(e){let t,n,r=e;return{promise:new Promise((e,r)=>{t=e,n=r}),operator:wu({next(e){if("E"===e.kind)return n(e.error);"N"!==e.kind||"newNetworkStatus"===e.source||e.value.loading||(r=e.value)},finalize:()=>{if(r)t(r);else{const e="The operation was aborted.",t="AbortError";n("undefined"!=typeof DOMException?new DOMException(e,t):Object.assign(/* @__PURE__ */new Error(e),{name:t}))}}})}}var Vm={},Qm=/* @__PURE__ */new WeakMap;function jm(e,t){const n=e[t];"function"==typeof n&&(e[t]=function(){return Qm.set(e,(Qm.get(e)+1)%1e15),n.apply(this,arguments)})}var Fm=/* @__PURE__ */new WeakMap,Bm=class{cache;queryManager;id;observableQuery;incremental;constructor(e,t){const n=this.cache=e.cache,r=(Fm.get(e)||0)+1;Fm.set(e,r),this.id=r+"",this.observableQuery=t,this.queryManager=e,Qm.has(n)||(Qm.set(n,0),jm(n,"evict"),jm(n,"modify"),jm(n,"reset"))}_lastWrite;get lastWrite(){return(this.observableQuery||this)._lastWrite}set lastWrite(e){(this.observableQuery||this)._lastWrite=e}resetLastWrite(){this.lastWrite=void 0}shouldWrite(e,t){const{lastWrite:n}=this;return!(n&&n.dmCount===Qm.get(this.cache)&&Jh(t,n.variables)&&Jh(e.data,n.result.data)&&e.extensions?.[uf]===n.result.extensions?.[uf])}get hasNext(){return!!this.incremental&&this.incremental.hasNext}maybeHandleIncrementalResult(e,t,n){const{incrementalHandler:r}=this.queryManager;return r.isIncrementalResult(t)?(this.incremental||=r.startRequest({query:n}),this.incremental.handle(e,t)):t}markQueryResult(e,{document:t,variables:n,errorPolicy:r,cacheWriteBehavior:i}){const a={query:t,variables:n,returnPartialData:!0,optimistic:!0};this.observableQuery?.resetNotifications();const o=0===i,s=o?void 0:this.cache.diff(a);let l=this.maybeHandleIncrementalResult(s?.result,e,t);return o||(qm(l,r)?this.cache.batch({onWatchUpdated:(e,t)=>{e.watcher===this.observableQuery&&(e.lastOwnDiff=t)},update:e=>{if(this.shouldWrite(l,n))e.writeQuery({query:t,data:l.data,variables:n,overwrite:1===i,extensions:l.extensions}),this.lastWrite={result:l,variables:n,dmCount:Qm.get(this.cache)};else if(s&&s.complete)return void(l={...l,data:s.result});const r=e.diff(a);r.complete&&(l={...l,data:r.result})}}):this.lastWrite=void 0),l}markMutationResult(e,t,n=this.cache){const r=[],i=0===t.cacheWriteBehavior;let a=this.maybeHandleIncrementalResult(i?void 0:n.diff({id:"ROOT_MUTATION",query:this.queryManager.getDocumentInfo(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0}).result,e,t.document);if("ignore"===t.errorPolicy&&(a={...a,errors:[]}),Th(a)&&"none"===t.errorPolicy)return Promise.resolve(a);const o=()=>({...a,dataState:this.hasNext?"streaming":"complete"});if(!i&&qm(a,t.errorPolicy)){r.push({result:a.data,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables,extensions:a.extensions});const{updateQueries:e}=t;e&&this.queryManager.getObservableQueries("all").forEach(t=>{const n=t&&t.queryName;if(!n||!Object.hasOwnProperty.call(e,n))return;const i=e[n],{query:a,variables:s}=t,{result:l,complete:c}=t.getCacheDiff({optimistic:!1});if(c&&l){const e=i(l,{mutationResult:o(),queryName:a&&qu(a)||void 0,queryVariables:s});e&&r.push({result:e,dataId:"ROOT_QUERY",query:a,variables:s})}})}let s=t.refetchQueries;if("function"==typeof s&&(s=s(o())),r.length>0||(s||"").length>0||t.update||t.onQueryUpdated||t.removeOptimistic){const e=[];if(this.queryManager.refetchQueries({updateCache:e=>{i||r.forEach(t=>e.write(t));const{update:n}=t;if(n){if(!i){const n=e.diff({id:"ROOT_MUTATION",query:this.queryManager.getDocumentInfo(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0});n.complete&&(a={...a,data:n.result})}this.hasNext||n(e,a,{context:t.context,variables:t.variables})}i||t.keepRootFields||this.hasNext||e.modify({id:"ROOT_MUTATION",fields:(e,{fieldName:t,DELETE:n})=>"__typename"===t?e:n})},include:s,optimistic:!1,removeOptimistic:t.removeOptimistic,onQueryUpdated:t.onQueryUpdated||null}).forEach(t=>e.push(t)),t.awaitRefetchQueries||t.onQueryUpdated)return Promise.all(e).then(()=>a)}return Promise.resolve(a)}markMutationOptimistic(e,t){const n="function"==typeof e?e(t.variables,{IGNORE:Vm}):e;return n!==Vm&&(this.cache.recordOptimisticTransaction(e=>{try{this.markMutationResult({data:n},t,e)}catch(r){Pu.error(r)}},this.id),!0)}markSubscriptionResult(e,{document:t,variables:n,errorPolicy:r,cacheWriteBehavior:i}){0!==i&&(qm(e,r)&&this.cache.write({query:t,result:e.data,dataId:"ROOT_SUBSCRIPTION",variables:n,extensions:e.extensions}),this.queryManager.broadcastQueries())}};function qm(e,t="none"){const n="ignore"===t||"all"===t;let r=!Th(e);return!r&&n&&e.data&&(r=!0),r}var Zm=class{defaultOptions;client;clientOptions;assumeImmutableResults;documentTransform;ssrMode;defaultContext;dataMasking;incrementalHandler;localState;queryDeduplication;prioritizeCacheValues=!1;onBroadcast;mutationStore;obsQueries=/* @__PURE__ */new Set;fetchCancelFns=/* @__PURE__ */new Map;constructor(e){const t=new tp(e=>this.cache.transformDocument(e),{cache:!1});this.client=e.client,this.defaultOptions=e.defaultOptions,this.queryDeduplication=e.queryDeduplication,this.clientOptions=e.clientOptions,this.ssrMode=e.ssrMode,this.assumeImmutableResults=e.assumeImmutableResults,this.dataMasking=e.dataMasking,this.localState=e.localState,this.incrementalHandler=e.incrementalHandler;const n=e.documentTransform;this.documentTransform=n?t.concat(n).concat(t):t,this.defaultContext=e.defaultContext||{},(this.onBroadcast=e.onBroadcast)&&(this.mutationStore={})}get link(){return this.client.link}get cache(){return this.client.cache}stop(){this.obsQueries.forEach(e=>e.stop()),this.cancelPendingFetches(Iu(89))}cancelPendingFetches(e){this.fetchCancelFns.forEach(t=>t(e)),this.fetchCancelFns.clear()}async mutate({mutation:e,variables:t,optimisticResponse:n,updateQueries:r,refetchQueries:i=[],awaitRefetchQueries:a=!1,update:o,onQueryUpdated:s,fetchPolicy:l,errorPolicy:c,keepRootFields:d,context:u}){const h=new Bm(this);e=this.cache.transformForLink(this.transform(e));const{hasClientExports:f}=this.getDocumentInfo(e);t=this.getVariables(e,t),f&&(t=await this.localState.getExportedVariables({client:this.client,document:e,variables:t,context:u}));const p=this.mutationStore&&(this.mutationStore[h.id]={mutation:e,variables:t,loading:!0,error:null}),m=n&&h.markMutationOptimistic(n,{document:e,variables:t,cacheWriteBehavior:"no-cache"===l?0:2,errorPolicy:c,context:u,updateQueries:r,update:o,keepRootFields:d});return this.broadcastQueries(),new Promise((f,g)=>{const v={};return this.getObservableFromLink(e,{...u,optimisticResponse:m?n:void 0},t,l,{},!1).observable.pipe(Um(),fu(n=>{const f={...n};return lu(h.markMutationResult(f,{document:e,variables:t,cacheWriteBehavior:"no-cache"===l?0:2,errorPolicy:c,context:u,update:o,updateQueries:r,awaitRefetchQueries:a,refetchQueries:i,removeOptimistic:m?h.id:void 0,onQueryUpdated:s,keepRootFields:d}))})).pipe(hu(e=>{if(Th(e)&&"none"===c)throw new Cm(Xm(e));return p&&(p.loading=!1,p.error=null),e})).subscribe({next:t=>{if(this.broadcastQueries(),!h.hasNext){const n={data:this.maskOperation({document:e,data:t.data,fetchPolicy:l,cause:v})};Th(t)&&(n.error=new Cm(t)),Object.keys(t.extensions||{}).length&&(n.extensions=t.extensions),f(n)}},error:e=>(p&&(p.loading=!1,p.error=e),m&&this.cache.removeOptimistic(h.id),this.broadcastQueries(),"ignore"===c?f({data:void 0}):"all"===c?f({data:void 0,error:e}):void g(e))})})}fetchQuery(e,t){return sh(e.query,Rs),(async()=>function(e,t){return new Promise(function(n,r){var i,a=!1;e.subscribe({next:function(e){i=e,a=!0},error:r,complete:function(){n(a?i:t.defaultValue)}})})}(this.fetchObservableWithInfo(e,{networkStatus:t}).observable.pipe(Hh(e=>{switch(e.kind){case"E":throw e.error;case"N":if("newNetworkStatus"!==e.source)return Xh(e.value)}})),{defaultValue:{data:void 0}}))()}transform(e){return this.documentTransform.transformDocument(e)}transformCache=new ih(Bu["queryManager.getDocumentInfo"]||2e3);getDocumentInfo(e){const{transformCache:t}=this;if(!t.has(e)){const n=wh(e),r={hasClientExports:Ph(["client","export"],e,!0),hasForcedResolvers:Mh(e),hasNonreactiveDirective:Ph(["nonreactive"],e),hasIncrementalDirective:Ph(["defer"],e),nonReactiveQuery:Wm(e),clientQuery:Ph(["client"],e)?e:null,serverQuery:Fh([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"},{name:"unmask"}],e),operationType:n?.operation,defaultVars:gh(n),asQuery:{...e,definitions:e.definitions.map(e=>"OperationDefinition"===e.kind&&"query"!==e.operation?{...e,operation:"query"}:e)}};t.set(e,r)}const n=t.get(e);if(n.violation)throw n.violation;return n}getVariables(e,t){const n=this.getDocumentInfo(e).defaultVars,r=Object.entries(t??{}).map(([e,t])=>[e,void 0===t?n[e]:t]);return{...n,...Object.fromEntries(r)}}watchQuery(e){sh(e.query,Rs);const t=this.transform(e.query);return void 0===(e={...e,variables:this.getVariables(t,e.variables)}).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!0),new Rm({queryManager:this,options:e,transformedQuery:t})}query(e){const t=this.transform(e.query);return this.fetchQuery({...e,query:t}).then(n=>({...n,data:this.maskOperation({document:t,data:n?.data,fetchPolicy:e.fetchPolicy})}))}clearStore(e={discardWatches:!0}){return this.cancelPendingFetches(Iu(91)),this.obsQueries.forEach(e=>{e.reset()}),this.mutationStore&&(this.mutationStore={}),this.cache.reset(e)}getObservableQueries(e="active"){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Set;return Array.isArray(e)&&e.forEach(e=>{if("string"==typeof e)n.set(e,e),r.set(e,!1);else if(uh(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)){const t=np(this.transform(e));n.set(t,qu(e)),r.set(t,!1)}else uh(e)&&e.query&&i.add(e);var t}),this.obsQueries.forEach(n=>{const i=np(this.transform(n.options.query));if("all"===e)return void t.add(n);const{queryName:a,options:{fetchPolicy:o}}=n;"active"===e&&"standby"===o||("active"===e||a&&r.has(a)||i&&r.has(i))&&(t.add(n),a&&r.set(a,!0),i&&r.set(i,!0))}),i.size&&i.forEach(e=>{const n=new Rm({queryManager:this,options:{...Qh(this.defaultOptions.watchQuery,e),fetchPolicy:"network-only"}});t.add(n)}),t}refetchObservableQueries(e=!1){const t=[];return this.getObservableQueries(e?"all":"active").forEach(n=>{const{fetchPolicy:r}=n.options;!e&&"standby"===r||"cache-only"===r||t.push(n.refetch())}),this.broadcastQueries(),Promise.all(t)}startGraphQLSubscription(e){let{query:t,variables:n}=e;const{fetchPolicy:r="cache-first",errorPolicy:i="none",context:a={},extensions:o={}}=e;let s;sh(t,Ls),t=this.transform(t),n=this.getVariables(t,n);const l=(this.getDocumentInfo(t).hasClientExports?lu(this.localState.getExportedVariables({client:this.client,document:t,variables:n,context:a})):cu(n)).pipe(fu(e=>{const{observable:n,restart:l}=this.getObservableFromLink(t,a,e,r,o),c=new Bm(this);return s=l,n.pipe(hu(n=>{c.markSubscriptionResult(n,{document:t,variables:e,errorPolicy:i,cacheWriteBehavior:"no-cache"===r?0:2});const a={data:n.data??void 0};return Th(n)?a.error=new Cm(n):function(e){return"extensions"in e&&wm.is(e.extensions[Am])}(n)&&(a.error=n.extensions[Am],delete n.extensions[Am]),n.extensions&&Object.keys(n.extensions).length&&(a.extensions=n.extensions),a.error&&"none"===i&&(a.data=void 0),"ignore"===i&&delete a.error,a}),gu(e=>cu("ignore"===i?{data:void 0}:{data:void 0,error:e})),mu(e=>!(!e.data&&!e.error)))}));return Object.assign(l,{restart:()=>s?.()})}broadcastQueries(){this.onBroadcast&&this.onBroadcast(),this.obsQueries.forEach(e=>e.notify())}inFlightLinkObservables=new Hu(!1);getObservableFromLink(e,t,n,r,i,a=t?.queryDeduplication??this.queryDeduplication){let o={};const{serverQuery:s,clientQuery:l,operationType:c,hasIncrementalDirective:d}=this.getDocumentInfo(e),u=qu(e),h={client:this.client};if(s){const{inFlightLinkObservables:m,link:g}=this;try{const v=this.incrementalHandler.prepareRequest({query:s,variables:n,context:{...this.defaultContext,...t,queryDeduplication:a},extensions:i});function b(e){return new zd(t=>{function n(){return e.subscribe({next:t.next.bind(t),complete:t.complete.bind(t),error:t.error.bind(t)})}let r=n();return o.restart||=()=>{r.unsubscribe(),r=n()},()=>{r.unsubscribe(),o.restart=void 0}})}if(t=v.context,a){const y=np(s),x=Sh(n);o=m.lookup(y,x),o.observable||(o.observable=Jf(g,v,h).pipe(b,(f=()=>{m.peek(y,x)===o&&m.remove(y,x)},Ed(function(e,t){try{e.subscribe(t)}finally{t.add(f)}})),c===Ls?bu():xu({refCount:!0})))}else o.observable=Jf(g,v,h).pipe(b)}catch(p){o.observable=du(()=>p)}}else o.observable=cu({data:{}});var f;if(l){const{operation:w}=wh(e);Pu(!d,96,w[0].toUpperCase()+w.slice(1),u??"(anonymous)"),o.observable=o.observable.pipe(fu(e=>lu(this.localState.execute({client:this.client,document:l,remoteResult:e,context:t,variables:n,fetchPolicy:r}))))}return{restart:()=>o.restart?.(),observable:o.observable.pipe(gu(e=>{throw function(e){zm.add(e)}(e=function(e){return function(e){return null!==e&&"object"==typeof e&&"string"==typeof e.message&&"string"==typeof e.name&&("string"==typeof e.stack||void 0===e.stack)}(e)?e:"string"==typeof e?new Error(e,{cause:e}):new Om(e)}(e)),e}))}}getResultsFromLink(e,{queryInfo:t,cacheWriteBehavior:n,observableQuery:r,exposeExtensions:i}){const{errorPolicy:a}=e,o=this.cache.transformForLink(e.query);return this.getObservableFromLink(o,e.context,e.variables,e.fetchPolicy).observable.pipe(hu(s=>{const l=t.markQueryResult(s,{...e,document:o,cacheWriteBehavior:n}),c=Th(l);if(c&&"none"===a)throw t.resetLastWrite(),r?.resetNotifications(),new Cm(Xm(l));const d={data:l.data,...t.hasNext?{loading:!0,networkStatus:Sm.streaming,dataState:"streaming",partial:!0}:{dataState:l.data?"complete":"empty",loading:!1,networkStatus:Sm.ready,partial:!l.data}};return i&&"extensions"in l&&(d[df]=l.extensions),c&&("none"===a&&(d.data=void 0,d.dataState="empty"),"ignore"!==a&&(d.error=new Cm(Xm(l)),"streaming"!==d.dataState&&(d.networkStatus=Sm.error))),d}),gu(e=>{if("none"===a)throw t.resetLastWrite(),r?.resetNotifications(),e;const n={data:void 0,dataState:"empty",loading:!1,networkStatus:Sm.ready,partial:!0};return"ignore"!==a&&(n.error=e,n.networkStatus=Sm.error),cu(n)}))}fetchObservableWithInfo(e,{networkStatus:t=Sm.loading,query:n=e.query,fetchQueryOperator:r=e=>e,onCacheHit:i=()=>{},observableQuery:a,exposeExtensions:o}){const s=this.getVariables(n,e.variables);let{fetchPolicy:l="cache-first",errorPolicy:c="none",returnPartialData:d=!1,notifyOnNetworkStatusChange:u=!0,context:h={}}=e;!this.prioritizeCacheValues||"network-only"!==l&&"cache-and-network"!==l||(l="cache-first");const f=Object.assign({},e,{query:n,variables:s,fetchPolicy:l,errorPolicy:c,returnPartialData:d,notifyOnNetworkStatusChange:u,context:h}),p=new Bm(this,a),m=n=>{f.variables=n;const s="no-cache"===l?0:t===Sm.refetch&&"merge"!==f.refetchWritePolicy?1:2,c=this.fetchQueryByPolicy(f,{queryInfo:p,cacheWriteBehavior:s,onCacheHit:i,observableQuery:a,exposeExtensions:o});return c.observable=c.observable.pipe(r),"standby"!==f.fetchPolicy&&a?.applyNextFetchPolicy("after-fetch",e),c},g=()=>{this.fetchCancelFns.delete(p.id)};this.fetchCancelFns.set(p.id,e=>{v.next({kind:"E",error:e,source:"network"})});const v=new Md;let b,y;if(this.getDocumentInfo(f.query).hasClientExports)b=lu(this.localState.getExportedVariables({client:this.client,document:f.query,variables:f.variables,context:f.context})).pipe(fu(e=>m(e).observable)),y=!0;else{const e=m(f.variables);y=e.fromLink,b=e.observable}return{observable:new zd(e=>{e.add(g),b.subscribe(e),v.subscribe(e)}).pipe(bu()),fromLink:y}}refetchQueries({updateCache:e,include:t,optimistic:n=!1,removeOptimistic:r=(n?zu("refetchQueries"):void 0),onQueryUpdated:i}){const a=/* @__PURE__ */new Map;t&&this.getObservableQueries(t).forEach(e=>{if("cache-only"===e.options.fetchPolicy||e.variablesUnknown)return;const t=e.getCurrentResult();a.set(e,{oq:e,lastDiff:{result:t?.data,complete:!t?.partial}})});const o=/* @__PURE__ */new Map;if(e){const t=/* @__PURE__ */new Set;this.cache.batch({update:e,optimistic:n&&r||!1,removeOptimistic:r,onWatchUpdated(e,n,r){const s=e.watcher;if(s instanceof Rm&&!t.has(s)){if(t.add(s),i){a.delete(s);let e=i(s,n,r);return!0===e&&(e=s.refetch().retain()),!1!==e&&o.set(s,e),e}null!==i&&"cache-only"!==s.options.fetchPolicy&&a.set(s,{oq:s,lastDiff:r,diff:n})}}})}return a.size&&a.forEach(({oq:e,lastDiff:t,diff:n})=>{let r;i&&(n||(n=e.getCacheDiff()),r=i(e,n,t)),i&&!0!==r||(r=e.refetch().retain()),!1!==r&&o.set(e,r)}),r&&this.cache.removeOptimistic(r),o}noCacheWarningsByCause=/* @__PURE__ */new WeakSet;maskOperation(e){const{document:t,data:n}=e;return this.dataMasking?function(e,t,n){const r=wh(t);return Pu(r,43),null==e?e:Dp(e,r.selectionSet,{operationType:r.operation,operationName:r.name?.value,fragmentMap:dh(yh(t)),cache:n,mutableTargets:/* @__PURE__ */new WeakMap,knownChanged:/* @__PURE__ */new WeakSet})}(n,t,this.cache):n}maskFragment(e){const{data:t,fragment:n,fragmentName:r}=e;return this.dataMasking?function(e,t,n,r){const i=t.definitions.filter(e=>e.kind===Ys);void 0===r&&(Pu(1===i.length,41,i.length),r=i[0].name.value);const a=i.find(e=>e.name.value===r);return Pu(!!a,42,r),null==e||Jh(e,{})?e:Dp(e,a.selectionSet,{operationType:"fragment",operationName:a.name.value,fragmentMap:dh(yh(t)),cache:n,mutableTargets:/* @__PURE__ */new WeakMap,knownChanged:/* @__PURE__ */new WeakSet})}(t,n,this.cache,r):t}fetchQueryByPolicy({query:e,variables:t,fetchPolicy:n,errorPolicy:r,returnPartialData:i,context:a},{cacheWriteBehavior:o,onCacheHit:s,queryInfo:l,observableQuery:c,exposeExtensions:d}){const u=()=>this.cache.diff({query:e,variables:t,returnPartialData:!0,optimistic:!0}),h=(o,l)=>{const c=o.result,d=e=>(o.complete||i||(e=void 0),{data:e,dataState:o.complete?"complete":e?"partial":"empty",loading:sp(l),networkStatus:l,partial:!o.complete}),u=e=>cu({kind:"N",value:d(e),source:"cache"});return(o.complete||i)&&this.getDocumentInfo(e).hasForcedResolvers?(s(),lu(this.localState.execute({client:this.client,document:e,remoteResult:c?{data:c}:void 0,context:a,variables:t,onlyRunForcedResolvers:!0,returnPartialData:!0,fetchPolicy:n}).then(e=>({kind:"N",value:d(e.data||void 0),source:"cache"})))):"none"===r&&l===Sm.refetch&&o.missing?u(void 0):u(c||void 0)},f=()=>this.getResultsFromLink({query:e,variables:t,context:a,fetchPolicy:n,errorPolicy:r},{cacheWriteBehavior:o,queryInfo:l,observableQuery:c,exposeExtensions:d}).pipe(Um(),Ed(function(e,t){e.subscribe(Ad(t,function(e){t.next(uu.createNext(e))},function(){t.next(uu.createComplete()),t.complete()},function(e){t.next(uu.createError(e)),t.complete()}))}),hu(e=>({...e,source:"network"})));switch(n){default:case"cache-first":{const e=u();return e.complete?{fromLink:!1,observable:h(e,Sm.ready)}:i?{fromLink:!0,observable:pu(h(e,Sm.loading),f())}:{fromLink:!0,observable:f()}}case"cache-and-network":{const e=u();return e.complete||i?{fromLink:!0,observable:pu(h(e,Sm.loading),f())}:{fromLink:!0,observable:f()}}case"cache-only":return{fromLink:!1,observable:pu(h(u(),Sm.ready))};case"network-only":case"no-cache":return{fromLink:!0,observable:f()};case"standby":return{fromLink:!1,observable:Zd}}}};function Um(){let e=!1;return wu({next(){e=!0},complete(){Pu(e,100)}})}function Wm(e){return Xl(e,{FragmentSpread:e=>{if(!e.directives?.some(e=>"unmask"===e.name.value))return{...e,directives:[...e.directives||[],{kind:al,name:{kind:Qs,value:"nonreactive"}}]}}})}function Xm(e){if(null==e.extensions?.[uf])return e;const{extensions:{[uf]:t,...n},...r}=e;return Object.keys(n).length>0&&(r.extensions=n),r}var Hm=class{link;cache;disableNetworkFetches;set prioritizeCacheValues(e){this.queryManager.prioritizeCacheValues=e}get prioritizeCacheValues(){return this.queryManager.prioritizeCacheValues}version;queryDeduplication;defaultOptions;devtoolsConfig;refetchEventManager;queryManager;devToolsHookCb;resetStoreCallbacks=[];clearStoreCallbacks=[];constructor(e){const{cache:t,documentTransform:n,ssrMode:r=!1,ssrForceFetchDelay:i=0,queryDeduplication:a=!0,defaultOptions:o,defaultContext:s,assumeImmutableResults:l=t.assumeImmutableResults,localState:c,devtools:d,dataMasking:u,link:h,incrementalHandler:f=new Gf,experiments:p=[],refetchEventManager:m}=e;this.link=h,this.cache=t,this.queryDeduplication=a,this.defaultOptions=o||{},this.devtoolsConfig={...d,enabled:d?.enabled??!1},this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.watchFragment=this.watchFragment.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.refetchObservableQueries=this.refetchObservableQueries.bind(this),this.version=Su,this.queryManager=new Zm({client:this,defaultOptions:this.defaultOptions,defaultContext:s,documentTransform:n,queryDeduplication:a,ssrMode:r,dataMasking:!!u,clientOptions:e,incrementalHandler:f,assumeImmutableResults:l,onBroadcast:this.devtoolsConfig.enabled?()=>{this.devToolsHookCb&&this.devToolsHookCb()}:void 0,localState:c}),this.prioritizeCacheValues=r||i>0,i&&setTimeout(()=>{this.prioritizeCacheValues=!1},i),this.devtoolsConfig.enabled&&this.connectToDevTools(),p.forEach(t=>t.call(this,e)),this.refetchEventManager=m,this.refetchEventManager?.connect(this)}connectToDevTools(){if("undefined"==typeof window)return;const e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this}get documentTransform(){return this.queryManager.documentTransform}get localState(){return this.queryManager.localState}set localState(e){this.queryManager.localState=e}stop(){this.queryManager.stop(),this.refetchEventManager?.disconnect(this)}watchQuery(e){const{refetchOn:t}=e;if(this.defaultOptions.watchQuery){const n=this.defaultOptions.watchQuery.refetchOn;let r;t&&"object"==typeof t&&("object"==typeof n?r={...n,...t}:null!=n&&(r=e=>{const r=t[e.source]??n;return"function"==typeof r?r(e):r})),e=Qh(this.defaultOptions.watchQuery,e),r&&(e.refetchOn=r)}return this.queryManager.watchQuery(e)}query=e=>(this.defaultOptions.query&&(e=Qh(this.defaultOptions.query,e)),this.queryManager.query(e));mutate=e=>{const t=Qh(ch({fetchPolicy:"network-only",errorPolicy:"none"},this.defaultOptions.mutate),e);return sh(t.mutation,Ds),this.queryManager.mutate(t)};subscribe(e){const t={},n=this.queryManager.startGraphQLSubscription(e),r=n.pipe(hu(n=>({...n,data:this.queryManager.maskOperation({document:e.query,data:n.data,fetchPolicy:e.fetchPolicy,cause:t})})));return Object.assign(r,{restart:n.restart})}readQuery(e,t=!!e.optimistic){return this.cache.readQuery({...e,query:this.transform(e.query)},t)}watchFragment(e){const t=this.queryManager.dataMasking;return this.cache.watchFragment({...e,fragment:this.transform(e.fragment,t)})}readFragment(e,t=!!e.optimistic){return this.cache.readFragment({...e,fragment:this.transform(e.fragment)},t)}writeQuery(e){const t=this.cache.writeQuery(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t}writeFragment(e){const t=this.cache.writeFragment(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t}__actionHookForDevTools(e){this.devToolsHookCb=e}__requestRaw(e){return Jf(this.link,e,{client:this})}resetStore(){return Promise.resolve().then(()=>this.queryManager.clearStore({discardWatches:!1})).then(()=>Promise.all(this.resetStoreCallbacks.map(e=>e()))).then(()=>this.refetchObservableQueries())}clearStore(){return Promise.resolve().then(()=>this.queryManager.clearStore({discardWatches:!0})).then(()=>Promise.all(this.clearStoreCallbacks.map(e=>e())))}onResetStore(e){return this.resetStoreCallbacks.push(e),()=>{this.resetStoreCallbacks=this.resetStoreCallbacks.filter(t=>t!==e)}}onClearStore(e){return this.clearStoreCallbacks.push(e),()=>{this.clearStoreCallbacks=this.clearStoreCallbacks.filter(t=>t!==e)}}reFetchObservableQueries;refetchObservableQueries(e){return this.queryManager.refetchObservableQueries(e)}refetchQueries(e){const t=this.queryManager.refetchQueries(e),n=[],r=[];t.forEach((e,t)=>{n.push(t),r.push(e)});const i=Promise.all(r);return i.queries=n,i.results=r,i.catch(e=>{}),i}getObservableQueries(e="active"){return this.queryManager.getObservableQueries(e)}extract(e){return this.cache.extract(e)}restore(e){return this.cache.restore(e)}setLink(e){this.link=e}get defaultContext(){return this.queryManager.defaultContext}maskedFragmentTransform=new tp(Zh);transform(e,t=!1){const n=this.queryManager.transform(e);return t?this.maskedFragmentTransform.transformDocument(n):n}},{hasOwnProperty:Ym}=Object.prototype;var _m={http:{includeQuery:!0,includeExtensions:!0,preserveHeaderCase:!1},headers:{accept:"application/graphql-response+json,application/json;q=0.9","content-type":"application/json"},options:{method:"POST"}},Gm=(e,t)=>t(e);function Km(e,t,...n){let r={},i={};n.forEach(e=>{r={...r,...e.options,headers:{...r.headers,...e.headers}},e.credentials&&(r.credentials=e.credentials),r.headers.accept=(e.http?.accept||[]).concat(r.headers.accept).join(","),i={...i,...e.http}}),r.headers=function(e,t){if(!t){const t={};return Object.keys(Object(e)).forEach(n=>{t[n.toLowerCase()]=e[n]}),t}const n={};Object.keys(Object(e)).forEach(t=>{n[t.toLowerCase()]={originalName:t,value:e[t]}});const r={};return Object.keys(n).forEach(e=>{r[n[e].originalName]=n[e].value}),r}(r.headers,i.preserveHeaderCase);const{operationName:a,extensions:o,variables:s,query:l}=e,c={operationName:a,variables:s};return i.includeExtensions&&Object.keys(o||{}).length&&(c.extensions=o),i.includeQuery&&(c.query=t(l,np)),{options:r,body:c}}var Jm=/* @__PURE__ */new Map,$m=/* @__PURE__ */new Map,eg=!1;function tg(e){return e.replace(/[\s,]+/g," ").trim()}function ng(e){var t,n,r,i=tg(e);if(!Jm.has(i)){var a=function(e,t){return function(e){if(null==e)return!1;const t=e.hasSubscribers;if(void 0!==t)return t;for(const n of ac)if(e[n].hasSubscribers)return!0;return!1}(ic)?ic.traceSync(()=>Xc(e,t),{source:e}):Xc(e,t)}(e,{experimentalFragmentVariables:eg,allowLegacyFragmentVariables:eg,experimentalFragmentArguments:eg});if(!a||"Document"!==a.kind)throw new Error("Not a valid GraphQL document.");Jm.set(i,function(e){var t=new Set(e.definitions);t.forEach(function(e){e.loc&&delete e.loc,Object.keys(e).forEach(function(n){var r=e[n];r&&"object"==typeof r&&t.add(r)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}((t=a,n=/* @__PURE__ */new Set,r=[],t.definitions.forEach(function(e){if("FragmentDefinition"===e.kind){var t=e.name.value,i=tg((o=e.loc).source.body.substring(o.start,o.end)),a=$m.get(t);a&&!a.has(i)||a||$m.set(t,a=/* @__PURE__ */new Set),a.add(i),n.has(i)||(n.add(i),r.push(e))}else r.push(e);var o}),Jc(Jc({},t),{definitions:r}))))}return Jm.get(i)}function rg(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];"string"==typeof e&&(e=[e]);var r=e[0];return t.forEach(function(t,n){t&&"Document"===t.kind?r+=t.loc.source.body:r+=t,r+=e[n+1]}),ng(r)}var ig,ag=rg;function og(e){if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=og(e);return n!==e&&(t=!0),n});return t?n:e}if("object"==typeof e&&e){let t={},n=!1;for(let r in e){if("__typename"===r){n=!0;continue}let i=e[r],a=og(i);a!==i&&(n=!0),t[r]=a}return n?t:e}return e}(ig=rg||(rg={})).gql=ag,ig.resetCaches=function(){Jm.clear(),$m.clear()},ig.disableFragmentWarnings=function(){},ig.enableExperimentalFragmentVariables=function(){eg=!0},ig.disableExperimentalFragmentVariables=function(){eg=!1},rg.default=rg;var sg=()=>new Kf((e,t)=>new zd(n=>{let r=t(e).subscribe({next:e=>{n.next(e.data?{...e,data:og(e.data)}:e)},error:e=>n.error(e),complete:()=>n.complete()});return()=>{r.unsubscribe()}})),lg=({id:e="",source:t,name:n,fields:r=[]})=>{let{useStoreSetter:i}=qi(),a=i(),o=k(()=>`${e}_${fa(8)}`,[e]);y(()=>{if(t)return a(`sources.${o}`,{id:o,meta:{id:e,source:t,name:n,fields:r}}),()=>a(`sources.${o}`,void 0,{unmount:!0})},[o,t]),y(()=>{t&&a(`sources.${o}.meta.fields`,r)},[r,t,o,a])},cg={action:"arrayMap",title:"Array Map",type:"utility",params:{keys:{defaultValue:'[{"from": "", "to": ""}]',type:"textarea"}},preview:{sourceParsed:""},callback:(e,t)=>{let{keys:n}=t;if(!Array.isArray(e))return e;try{"string"==typeof n&&(n=JSON.parse(n))}catch{return e}return e.map(e=>{let t={};return n.forEach(n=>{"object"==typeof n&&n.from&&n.to&&re(t,n.to,ne(e,n.from,""))}),t})}},dg={action:"capitalize",title:"Capitalize",type:"utility",params:{},preview:{content:""},callback:e=>"string"==typeof e?he(e):e},ug={action:"dateConverter",title:"Date Converter",type:"utility",params:{format:{defaultValue:"dd/MM/yyyy",type:"text"},asAge:{defaultValue:!1,type:"checkbox"},isUnix:{defaultValue:!0,type:"checkbox"},isUtc:{defaultValue:!1,type:"checkbox"},locale:{defaultValue:"en",type:"select",options:[{label:"en",value:"en"},{label:"es",value:"es"},{label:"pt",value:"pt"}]}},preview:{format:"",asAge:"",isUnix:"",isUtc:"",locale:""},callback:(e,{format:t="dd/MM/yyyy",asAge:n=!1,isUnix:r=!0,isUtc:i=!1,locale:a="en"})=>{if("string"!=typeof e&&"number"!=typeof e)return e;try{let o=Ga(r?Number(e):e);return isNaN(o.getTime())?e:n?eo(o,a,{addSuffix:!0}):i?Ja(o,t,a):Ka(o,t,a)}catch{return e}}},hg={action:"styleSelector",title:"Style Selector",type:"utility",params:{originalSelector:{label:"Original Selector",description:"This will append the original selector (require append option enabled)",defaultValue:!1,disabled:({append:e})=>!e,type:"checkbox"},append:{label:"Append Selector",defaultValue:!1,type:"checkbox"},selector:{label:"Selector",defaultValue:"",type:"select",options:(e,t,n)=>{let r=n?.stylePlatform;return r?Object.keys(r).map(e=>({label:e,options:Object.values(r[e]).filter(e=>"class"===e.type).map(e=>({label:e.name,value:e.name}))})):[]}}},preview:{append:"",originalSelector:"",selector:""},callback:(e,t,n,r={})=>{let{originalSelector:i,append:a,selector:o}=t,s=[];if(a&&!i&&r.sourceTo)s.push(r.sourceTo,o);else if(i&&a){let e=ne(n,"definition.styleSelectors.base","");e?s.push(e,o):s.push(o)}return s.length?1===s.length?s[0]:s.join(" "):""}},fg={action:"styleVariant",title:"Style Variant",type:"utility",params:{key:{label:"Selector Key",defaultValue:"",type:"select",options:(e,t)=>{let n=t?.definition?.styleSelectors;if(!t||!t.definition||!n)return[];let r=t.definition.type;return(e=>{let t=e.reduce((e,{groupLabel:t,option:n})=>(t in e||(e[t]=[]),e[t].push(n),e),{});return Object.entries(t).map(([e,t])=>({label:e,options:t}))})(Object.entries(n).flatMap(([e,t])=>(t?[r,...t.split(" ")]:[r]).map(t=>({groupLabel:e,option:{value:`${t}.${e}`,label:`${t} (${e})`}}))))}},variant:{label:"Variant",defaultValue:"",type:"select",options:(e,t,n)=>{let r=t?.definition?.styleSelectors,i=e.key||"";if(!(t&&t.definition&&r&&n?.stylePlatform&&i.includes(".")))return[];let a=t.definition.type,o=i.split(".").pop()||"",s=r[o];if(!s)return[];let l=[],c=[a,...s.split(" ").filter(Boolean)];return Object.entries(n.stylePlatform).forEach(([e,t])=>{c.forEach(n=>{let r=t[n];if(!r)return;let i=r.attributes[o];Object.keys(i.variants||{}).forEach(t=>{l.push({value:t,label:`${e}: ${t}`})})})}),l}},append:{label:"Append to Variant",description:"Merge with existing variant values instead of replacing",defaultValue:!1,type:"checkbox"}},preview:{key:"",variant:"",append:""},callback:(e,t,n,r={})=>{let{key:i,variant:a,append:o}=t;if(!i)return r.sourceTo??{};let s=i||"base",l=a||e;return"object"!=typeof l||Array.isArray(l)?re(o?{...r.sourceTo}:{},s,l):l}},pg={action:"twigTemplate",title:"Twig Template",type:"utility",params:{template:{label:"Template",defaultValue:"Tokens {{source}} from the value selected to bind previously, {{sourceTo}} is your original value, other tokens via autocomplete",type:"codemirror-text"}},preview:{template:""},callback:(e,t,n,r={})=>{let{template:i}=t,a=e;try{let t=us(i,{source:e,...r});("string"==typeof t||"object"==typeof t&&t)&&(a=t)}catch{a=e}return a}},mg={twigTemplate:pg,dateConverter:ug,staticValue:{action:"staticValue",title:"Static Value",type:"utility",params:{valueType:{label:"Value Type",defaultValue:"text",type:"select",options:[{label:"Text",value:"text"},{label:"Long Text",value:"textarea"},{label:"Boolean",value:"select"}]},value:{defaultValue:"",type:({valueType:e})=>e,options:[{label:"True",value:"true"},{label:"False",value:"false"}]}},preview:{valueType:"",value:""},callback:(e,t)=>{let{valueType:n,value:r}=t;return"select"===n?"true"===r:r}},capitalize:dg,arrayMap:cg,stringToArray:{action:"stringToArray",title:"Text to List",type:"utility",params:{separator:{label:"Separator",defaultValue:",",type:"text"}},preview:{valueType:"",value:""},callback:(e,t)=>{let{separator:n}=t;return"string"==typeof e?e.split(n).map(e=>e.trim()):e}},styleSelector:hg,styleVariant:fg},gg=Object.values(mg).map(({title:e,action:t})=>({label:e,value:t})),vg=l({theme:{components:{}},colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{}});vg.displayName="ThemeContext";var bg=({children:e,components:t,defaultColorMode:n="light",colorModeStorageKey:r,applyColorModeClass:i=!0,colorModeRoot:a})=>{let o="system"===n,[s,l]=z(()=>((e,t)=>{if(e&&typeof localStorage<"u")try{let t=localStorage.getItem(e);if("dark"===t||"light"===t)return t}catch{}return"system"===t?(()=>{if(typeof window>"u")return"light";try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}})():t})(r,n));y(()=>{if(!o||typeof window>"u")return;let e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>l(e.matches?"dark":"light");return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[o]),y(()=>{if(!i||typeof document>"u")return;let e=a??document.documentElement;"dark"===s?e.classList.add("dark"):e.classList.remove("dark")},[s,i,a]);let c=g(()=>{o||l(e=>{let t="dark"===e?"light":"dark";if(r)try{localStorage.setItem(r,t)}catch{}return t})},[o,r]),d=g(e=>{if(!o&&(l(e),r))try{localStorage.setItem(r,e)}catch{}},[o,r]);/* @__PURE__ */
9
9
  return P(vg,{value:k(()=>({theme:{components:t&&Object.keys(t).length>0?t:{}},colorMode:s,toggleColorMode:c,setColorMode:d}),[t,s,c,d]),children:e})},yg=(e,t)=>Object.getOwnPropertyDescriptor(e,t)?.enumerable,xg=(e,t,n="soft",r={})=>{let{skip:i=[],skipFunctions:a=!1}=r;if(e===t&&"soft"===n)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;let a,o,s=[];if(Array.isArray(e)){if(a=e.length,a!=t.length)return!1;for(o=a;0!==o--;)if(!xg(e[o],t[o],n,r))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o of e.values())if(!t.has(o))return!1;for(o of e.entries())if(!xg(o[1],t.get(o[0]),n,r))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o of e.entries())if(!t.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(a=e.length,a!=t.length)return!1;for(o=a;0!==o--;)if(e[o]!==t[o])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline&&e.unicode===t.unicode&&e.lastIndex===t.lastIndex&&e.sticky===t.sticky;if((e.valueOf!==Object.prototype.valueOf||t.valueOf!==Object.prototype.valueOf)&&"function"==typeof e.valueOf&&"function"==typeof t.valueOf)return e.valueOf()===t.valueOf();if((e.toString!==Object.prototype.toString||t.toString!==Object.prototype.toString)&&"function"==typeof e.toString&&"function"==typeof t.toString)return e.toString()===t.toString();if(s="soft"===n?Object.keys(e):Object.getOwnPropertyNames(e),a=s.length,a!==("soft"===n?Object.keys(t).length:Object.getOwnPropertyNames(t).length))return!1;for(o=a;0!==o--;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=a;0!==o--;){let a=s[o];if("_owner"===a&&e.$$typeof)continue;let l="soft"===n||yg(e,a)||!i.includes(a);if(!xg(e[a],t[a],n,r)&&l)return!1}return!0}return!!("hard"===n&&e===t||a&&"function"==typeof e&&"function"==typeof t)||e!=e&&t!=t},wg=xg,Og=(e,t="soft",n={})=>{let r=C(e);return wg(r.current,e,t,n)?r.current:(r.current=e,e)},kg=(e=/* @__PURE__ */new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Sg="-",Cg=[],zg=e=>{const t=Ag(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Eg(e);const n=e.split(Sg),r=""===n[0]&&n.length>1?1:0;return Ng(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],i=n[e];return t?i?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(i,t):t:i||Cg}return n[e]||Cg}}},Ng=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],i=n.nextPart.get(r);if(i){const n=Ng(e,t+1,i);if(n)return n}const a=n.validators;if(null===a)return;const o=0===t?e.join(Sg):e.slice(t).join(Sg),s=a.length;for(let l=0;l<s;l++){const e=a[l];if(e.validator(o))return e.classGroupId}},Eg=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),Ag=e=>{const{theme:t,classGroups:n}=e;return Tg(n,t)},Tg=(e,t)=>{const n=kg();for(const r in e){const i=e[r];Pg(i,n,r,t)}return n},Pg=(e,t,n,r)=>{const i=e.length;for(let a=0;a<i;a++){const i=e[a];Mg(i,t,n,r)}},Mg=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?Dg(e,t,n,r):Rg(e,t,n,r):Ig(e,t,n)},Ig=(e,t,n)=>{(""===e?t:Lg(t,e)).classGroupId=n},Rg=(e,t,n,r)=>{Vg(e)?Pg(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},Dg=(e,t,n,r)=>{const i=Object.entries(e),a=i.length;for(let o=0;o<a;o++){const[e,a]=i[o];Pg(a,Lg(t,e),n,r)}},Lg=(e,t)=>{let n=e;const r=t.split(Sg),i=r.length;for(let a=0;a<i;a++){const e=r[a];let t=n.nextPart.get(e);t||(t=kg(),n.nextPart.set(e,t)),n=t}return n},Vg=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Qg=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(i(e,t),t):void 0},set(e,t){e in n?n[e]=t:i(e,t)}}},jg=[],Fg=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Bg=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,i=0,a=0;const o=e.length;for(let d=0;d<o;d++){const o=e[d];if(0===r&&0===i){if(":"===o){t.push(e.slice(a,d)),a=d+1;continue}if("/"===o){n=d;continue}}"["===o?r++:"]"===o?r--:"("===o?i++:")"===o&&i--}const s=0===t.length?e:e.slice(a);let l=s,c=!1;return s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0),Fg(t,c,l,n&&n>a?n-a:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Fg(jg,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},qg=e=>{const t=/* @__PURE__ */new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let i=0;i<e.length;i++){const a=e[i],o="["===a[0],s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Zg=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},Ug=/\s+/,Wg=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Wg(e[r]))&&(n&&(n+=" "),n+=t);return n},Xg=(e,...t)=>{let n,r,i,a;const o=e=>{const t=r(e);if(t)return t;const a=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],l=e.trim().split(Ug);let c="";for(let d=l.length-1;d>=0;d-=1){const e=l[d],{isExternal:t,modifiers:u,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=n(e);if(t){c=e+(c.length>0?" "+c:c);continue}let m,g=!!p;if(g){m=r(f.substring(0,p));const e=m&&o[m]?r(f):void 0;e&&e!==m&&(m=e,g=!1)}else m=r(f);if(!m){if(!g){c=e+(c.length>0?" "+c:c);continue}if(m=r(f),!m){c=e+(c.length>0?" "+c:c);continue}g=!1}const v=0===u.length?"":1===u.length?u[0]:a(u).join(":"),b=h?v+"!":v,y=b+m;if(s.indexOf(y)>-1)continue;s.push(y);const x=i(m,g);for(let n=0;n<x.length;++n){const e=x[n];s.push(b+e)}c=e+(c.length>0?" "+c:c)}return c})(e,n);return i(e,a),a};return a=s=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:Qg(e.cacheSize),parseClassName:Bg(e),sortModifiers:qg(e),postfixLookupClassGroupIds:Zg(e),...zg(e)}))(l),r=n.cache.get,i=n.cache.set,a=o,o(s)},(...e)=>a(((...e)=>{let t,n,r=0,i="";for(;r<e.length;)(t=e[r++])&&(n=Wg(t))&&(i&&(i+=" "),i+=n);return i})(...e))},Hg=[],Yg=e=>{const t=t=>t[e]||Hg;return t.isThemeGetter=!0,t},_g=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Gg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kg=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Jg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$g=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ev=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rv=e=>Kg.test(e),iv=e=>!!e&&!Number.isNaN(Number(e)),av=e=>!!e&&Number.isInteger(Number(e)),ov=e=>e.endsWith("%")&&iv(e.slice(0,-1)),sv=e=>Jg.test(e),lv=()=>!0,cv=e=>$g.test(e)&&!ev.test(e),dv=()=>!1,uv=e=>tv.test(e),hv=e=>nv.test(e),fv=e=>!gv(e)&&!Sv(e),pv=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),mv=e=>Mv(e,Lv,dv),gv=e=>_g.test(e),vv=e=>Mv(e,Vv,cv),bv=e=>Mv(e,Qv,iv),yv=e=>Mv(e,Fv,lv),xv=e=>Mv(e,jv,dv),wv=e=>Mv(e,Rv,dv),Ov=e=>Mv(e,Dv,hv),kv=e=>Mv(e,Bv,uv),Sv=e=>Gg.test(e),Cv=e=>Iv(e,Vv),zv=e=>Iv(e,jv),Nv=e=>Iv(e,Rv),Ev=e=>Iv(e,Lv),Av=e=>Iv(e,Dv),Tv=e=>Iv(e,Bv,!0),Pv=e=>Iv(e,Fv,!0),Mv=(e,t,n)=>{const r=_g.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},Iv=(e,t,n=!1)=>{const r=Gg.exec(e);return!!r&&(r[1]?t(r[1]):n)},Rv=e=>"position"===e||"percentage"===e,Dv=e=>"image"===e||"url"===e,Lv=e=>"length"===e||"size"===e||"bg-size"===e,Vv=e=>"length"===e,Qv=e=>"number"===e,jv=e=>"family-name"===e,Fv=e=>"number"===e||"weight"===e,Bv=e=>"shadow"===e,qv=/*#__PURE__*/Xg(()=>{const e=Yg("color"),t=Yg("font"),n=Yg("text"),r=Yg("font-weight"),i=Yg("tracking"),a=Yg("leading"),o=Yg("breakpoint"),s=Yg("container"),l=Yg("spacing"),c=Yg("radius"),d=Yg("shadow"),u=Yg("inset-shadow"),h=Yg("text-shadow"),f=Yg("drop-shadow"),p=Yg("blur"),m=Yg("perspective"),g=Yg("aspect"),v=Yg("ease"),b=Yg("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Sv,gv],x=()=>[Sv,gv,l],w=()=>[rv,"full","auto",...x()],O=()=>[av,"none","subgrid",Sv,gv],k=()=>["auto",{span:["full",av,Sv,gv]},av,Sv,gv],S=()=>[av,"auto",Sv,gv],C=()=>["auto","min","max","fr",Sv,gv],z=()=>["auto",...x()],N=()=>[rv,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],E=()=>[rv,"screen","full","dvw","lvw","svw","min","max","fit",...x()],A=()=>[rv,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],T=()=>[e,Sv,gv],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Nv,wv,{position:[Sv,gv]}],M=()=>["auto","cover","contain",Ev,mv,{size:[Sv,gv]}],I=()=>[ov,Cv,vv],R=()=>["","none","full",c,Sv,gv],D=()=>["",iv,Cv,vv],L=()=>[iv,ov,Nv,wv],V=()=>["","none",p,Sv,gv],Q=()=>["none",iv,Sv,gv],j=()=>["none",iv,Sv,gv],F=()=>[iv,Sv,gv],B=()=>[rv,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sv],breakpoint:[sv],color:[lv],container:[sv],"drop-shadow":[sv],ease:["in","out","in-out"],font:[fv],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sv],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sv],shadow:[sv],spacing:["px",iv],text:[sv],"text-shadow":[sv],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",rv,gv,Sv,g]}],container:["container"],"container-type":[{"@container":["","normal","size",Sv,gv]}],"container-named":[pv],columns:[{columns:[iv,gv,Sv,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[av,"auto",Sv,gv]}],basis:[{basis:[rv,"full","auto",s,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[iv,rv,"auto","initial","none",gv]}],grow:[{grow:["",iv,Sv,gv]}],shrink:[{shrink:["",iv,Sv,gv]}],order:[{order:[av,"first","last","none",Sv,gv]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":C()}],"auto-rows":[{"auto-rows":C()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],"inline-size":[{inline:["auto",...E()]}],"min-inline-size":[{"min-inline":["auto",...E()]}],"max-inline-size":[{"max-inline":["none",...E()]}],"block-size":[{block:["auto",...A()]}],"min-block-size":[{"min-block":["auto",...A()]}],"max-block-size":[{"max-block":["none",...A()]}],w:[{w:[s,"screen",...N()]}],"min-w":[{"min-w":[s,"screen","none",...N()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",n,Cv,vv]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Pv,yv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ov,gv]}],"font-family":[{font:[zv,xv,t]}],"font-features":[{"font-features":[gv]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Sv,gv]}],"line-clamp":[{"line-clamp":[iv,"none",Sv,bv]}],leading:[{leading:[a,...x()]}],"list-image":[{"list-image":["none",Sv,gv]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Sv,gv]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[iv,"from-font","auto",Sv,vv]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[iv,"auto",Sv,gv]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[av,Sv,gv]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Sv,gv]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Sv,gv]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},av,Sv,gv],radial:["",Sv,gv],conic:[av,Sv,gv]},Av,Ov]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-bs":[{"border-bs":D()}],"border-w-be":[{"border-be":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[iv,Sv,gv]}],"outline-w":[{outline:["",iv,Cv,vv]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",d,Tv,kv]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",u,Tv,kv]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[iv,vv]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,Tv,kv]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[iv,Sv,gv]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[iv]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[Sv,gv]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[iv]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Sv,gv]}],filter:[{filter:["","none",Sv,gv]}],blur:[{blur:V()}],brightness:[{brightness:[iv,Sv,gv]}],contrast:[{contrast:[iv,Sv,gv]}],"drop-shadow":[{"drop-shadow":["","none",f,Tv,kv]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",iv,Sv,gv]}],"hue-rotate":[{"hue-rotate":[iv,Sv,gv]}],invert:[{invert:["",iv,Sv,gv]}],saturate:[{saturate:[iv,Sv,gv]}],sepia:[{sepia:["",iv,Sv,gv]}],"backdrop-filter":[{"backdrop-filter":["","none",Sv,gv]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[iv,Sv,gv]}],"backdrop-contrast":[{"backdrop-contrast":[iv,Sv,gv]}],"backdrop-grayscale":[{"backdrop-grayscale":["",iv,Sv,gv]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[iv,Sv,gv]}],"backdrop-invert":[{"backdrop-invert":["",iv,Sv,gv]}],"backdrop-opacity":[{"backdrop-opacity":[iv,Sv,gv]}],"backdrop-saturate":[{"backdrop-saturate":[iv,Sv,gv]}],"backdrop-sepia":[{"backdrop-sepia":["",iv,Sv,gv]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Sv,gv]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[iv,"initial",Sv,gv]}],ease:[{ease:["linear","initial",v,Sv,gv]}],delay:[{delay:[iv,Sv,gv]}],animate:[{animate:["none",b,Sv,gv]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Sv,gv]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:j()}],"scale-x":[{"scale-x":j()}],"scale-y":[{"scale-y":j()}],"scale-z":[{"scale-z":j()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Sv,gv,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:B()}],"translate-x":[{"translate-x":B()}],"translate-y":[{"translate-y":B()}],"translate-z":[{"translate-z":B()}],"translate-none":["translate-none"],zoom:[{zoom:[av,Sv,gv]}],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Sv,gv]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Sv,gv]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[iv,Cv,vv,bv]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}),Zv=function(e,{componentKey:t,className:n,variants:r}){let{theme:i}=m(vg);e=Og(e);let a=Og(n),o=g((t,n={},r="")=>(n={...n,className:r},"string"==typeof e?ne(i.components[e],t,void 0)?.(n)??r:e.map(e=>ne(i.components[e],t,void 0)?.(n)).filter(Boolean).join(" ")||r),[i.components,e]);return t=k(()=>void 0!==t?t:e&&"string"==typeof e?Object.keys(i.components[e]):Array.isArray(e)&&e.length>0?e.map(e=>Object.keys(i.components[e])).flat():void 0,[e,i.components]),k(()=>{if(t&&"string"==typeof t)return qv(o(t,r,a&&"object"==typeof a?ne(a,t,""):a));if(t&&Array.isArray(t)){let e={};return t.forEach((t,n)=>{let i;"object"==typeof a?i=ne(a,t):"string"==typeof a&&0===n&&(i=a);let s=qv(o(t,r,i));t.split(".").length>1?re(e,t.split(".").slice(1).join("."),s):re(e,t,s)}),e}return""},[t,a,o,r])},Uv={root:we("flex",{variants:{direction:{column:"flex-col",row:"","row-reverse":"flex-row-reverse","col-reverse":"flex-col-reverse"},grow:{true:"grow",false:""},basis:{0:"basis-0",1:"basis-1",2:"basis-2",3:"basis-3",4:"basis-4",5:"basis-5",6:"basis-6",7:"basis-7",8:"basis-8",9:"basis-9",10:"basis-10",11:"basis-11",12:"basis-12",14:"basis-14",16:"basis-16",20:"basis-20",24:"basis-24",28:"basis-28",32:"basis-32",36:"basis-36",40:"basis-40",44:"basis-44",48:"basis-48",52:"basis-52",56:"basis-56",60:"basis-60",64:"basis-64",72:"basis-72",80:"basis-80",96:"basis-96",auto:"",px:"basis-px",.5:"basis-0.5",1.5:"basis-1.5",2.5:"basis-2.5",3.5:"basis-3.5","1/2":"basis-1/2","1/3":"basis-1/3","2/3":"basis-2/3","1/4":"basis-1/4","2/4":"basis-2/4","3/4":"basis-3/4","1/5":"basis-1/5","2/5":"basis-2/5","3/5":"basis-3/5","4/5":"basis-4/5","1/6":"basis-1/6","2/6":"basis-2/6","3/6":"basis-3/6","4/6":"basis-4/6","5/6":"basis-5/6","1/12":"basis-1/12","2/12":"basis-2/12","3/12":"basis-3/12","4/12":"basis-4/12","5/12":"basis-5/12","6/12":"basis-6/12","7/12":"basis-7/12","8/12":"basis-8/12","9/12":"basis-9/12","10/12":"basis-10/12","11/12":"basis-11/12",full:"basis-full"},wrap:{wrap:"flex-wrap",nowrap:"","wrap-reverse":"flex-wrap-reverse"},items:{start:"",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"},justify:{normal:"justify-normal",start:"",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly",stretch:"justify-stretch"},gap:{0:"",1:"gap-1",1.5:"gap-1.5",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6",7:"gap-7",8:"gap-8",9:"gap-9",10:"gap-10",11:"gap-11",12:"gap-12",14:"gap-14",16:"gap-16"},shrink:{1:"shrink",0:""},alignItems:{start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:""}},compoundVariants:[],defaultVariants:{alignItems:"stretch",direction:"row",wrap:"nowrap",justify:"start",items:"start",basis:"auto",gap:0,shrink:0,grow:!1}})},Wv=({ref:e,className:t,children:n,testId:r,direction:i,wrap:a,items:o,gap:s,justify:l,grow:c,basis:d,alignItems:u,shrink:h,...f})=>(t=Zv("Flex",{className:t,componentKey:"root",variants:{direction:i,wrap:a,items:o,gap:s,justify:l,grow:c,basis:d,shrink:h,alignItems:u}}),/* @__PURE__ */P("div",{...f,"data-testid":r,className:t,ref:e,children:n})),Xv={root:we("flex items-center justify-center",{variants:{intent:{primary:"text-zinc-700 dark:text-zinc-300 hover:text-primary-ui",primaryActive:"text-primary-ui",secondary:"text-zinc-700 dark:text-zinc-300 hover:text-secondary-500 dark:hover:text-secondary-400",secondaryActive:"text-secondary-500 dark:text-secondary-400",tertiary:"hover:bg-grayviolet-200 dark:hover:bg-zinc-700 text-gray-500 dark:text-zinc-400",tertiaryActive:"text-black dark:text-white",disabled:"text-gray-400 dark:text-zinc-500",danger:"text-red-500 hover:text-red-400",success:"text-green-500 hover:text-green-400",custom:""},cursor:{pointer:"cursor-pointer",disabled:"cursor-not-allowed",custom:""},size:{xs:"text-xs",sm:"text-sm",md:"",lg:"text-lg",xl:"text-xl","2xl":"text-2xl","3xl":"text-3xl","4xl":"text-4xl","5xl":"text-5xl","6xl":"text-6xl","7xl":"text-7xl","8xl":"text-8xl","9xl":"text-9xl",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}})},Hv=(e,t,n="primary")=>e?"disabled":t&&"primary"===n?"primaryActive":t&&"secondary"===n?"secondaryActive":t&&"tertiary"===n?"tertiaryActive":n,Yv=({className:e,children:t,icon:r,active:i=!1,disabled:a=!1,testId:o,intent:l,size:c,cursor:d,title:u,...f})=>{let p=Zv("Icon",{className:e,componentKey:"root",variants:{intent:Hv(a,i,l),size:c,cursor:a?"disabled":d}}),{iconChildren:m}=k(()=>{let e={iconChildren:void 0};return n.forEach(t,t=>{h(t)&&(e.iconChildren=s(t,{...f,className:ge({"h-[1em] w-[1em]":"custom"!==c},p,t.props.className),title:u}))}),e},[t,p,f,c,u]);return m||/* @__PURE__ */P("i",{...f,title:u,"data-testid":o,className:ge(r,p)})},_v=l(void 0);_v.displayName="AccordionContext";var Gv=()=>{let e=m(_v);if(!e)throw Error("Accordion components must be used inside <Accordion>");return e},Kv={root:xe("overflow-auto",{variants:{intent:{default:[]}},compoundVariants:[],defaultVariants:{intent:"default"}}),item:xe("border-b border-gray-100 dark:border-zinc-800 last:border-b-0"),itemHeader:xe("flex items-center justify-between font-semibold cursor-pointer select-none transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-zinc-800/60 text-zinc-800 dark:text-zinc-200",{variants:{size:{xs:"px-2 py-1 text-xs h-7",sm:"px-2.5 py-1.5 text-sm h-8",md:"px-3 py-2 text-sm h-10",lg:"px-3 py-2.5 text-base h-12",custom:""}},compoundVariants:[],defaultVariants:{size:"lg"}}),itemHeaderSlot:xe("min-w-0 truncate"),itemHeaderIcon:xe("flex items-center justify-center w-4 h-4 shrink-0 text-zinc-400 dark:text-zinc-500 transition-transform duration-150"),itemHeaderIconError:xe("flex items-center justify-center text-red-500 dark:text-red-400"),itemHeaderIconWarning:xe("flex items-center justify-center text-orange-500 dark:text-orange-400"),itemContent:xe("flex",{variants:{grow:{true:"overflow-auto basis-0 grow",false:""}},compoundVariants:[],defaultVariants:{grow:!0}}),itemDivider:xe("h-1 bg-primary-400 cursor-row-resize w-full opacity-0 hover:opacity-100 transition-opacity duration-200 translate-y-1/2")},Jv=({className:e,children:t,testId:n="",grow:r})=>(e=Zv("Accordion",{componentKey:"itemContent",className:e,variants:{grow:r}}),/* @__PURE__ */P("div",{"data-testid":n?`${n}accordion-item-content`:void 0,className:e,children:t})),$v=/* @__PURE__ */P(Yv,{icon:"fa-solid fa-chevron-right",intent:"custom"}),eb=/* @__PURE__ */P(Yv,{icon:"fa-solid fa-chevron-down",intent:"custom"}),tb=({className:e,title:t="Accordion Item Title",isOpen:n=!1,isError:r=!1,isWarning:i=!1,iconCollapsed:a=$v,iconExpanded:o=eb,testId:s="",children:l,intent:c,direction:d="row",wrap:u,items:h="center",justify:f="between",gap:p=4,grow:m=!1,basis:g=0,size:v,onClick:b})=>{let y=Zv("Accordion",{componentKey:["itemHeader","itemHeaderIcon","itemHeaderIconError","itemHeaderSlot","itemHeaderIconWarning"],className:e,variants:{intent:c,size:v}});/* @__PURE__ */
10
10
  return M(Wv,{testId:s?`${s}-accordion-item-header`:void 0,className:y.itemHeader,direction:d,wrap:u,items:h,justify:f,gap:p,basis:g,grow:m,onClick:b,draggable:!1,children:[/* @__PURE__ */M("div",{className:ge("flex items-center gap-4",{"flex-row-reverse":"row-reverse"===d}),children:[a&&o&&/* @__PURE__ */M("div",{className:y.itemHeaderIcon,children:[!n&&a,n&&o]}),t]}),/* @__PURE__ */M(Wv,{items:"center",gap:2,direction:d,className:y.itemHeaderSlot,children:[r&&/* @__PURE__ */P("div",{className:y.itemHeaderIconError,children:/* @__PURE__ */P(Yv,{intent:"custom",icon:"fa-solid fa-triangle-exclamation"})}),i&&/* @__PURE__ */P("div",{className:y.itemHeaderIconWarning,children:/* @__PURE__ */P(Yv,{intent:"custom",icon:"fa-solid fa-triangle-exclamation"})}),l]})]})},nb=({className:e,id:t,children:r,testId:i="",isOpen:a,resizable:o=!0,minSize:l,maxSize:c,intent:d,direction:u="column",wrap:f,items:p,justify:m,gap:v=0,grow:b,shrink:w=1,basis:O=0,size:S,onClick:z})=>{let N=x(),E=t||`accordion-item-${N}`,A=C(void 0),{accordionManager:T,intent:I,size:R,testId:D}=Gv(),L=i||D,V=Zv("Accordion",{componentKey:["item","itemDivider"],className:e,variants:{intent:d??I,size:S??R}});y(()=>(T.register(E,A,{minSize:l,maxSize:c}),()=>T.unregister(E)),[T,E,c,l]);let Q=void 0===a?T.isOpen(E):a,j=g(e=>{z?.(e),T.toggle(E)},[z,T,E]),{header:F,content:B}=k(()=>{let e={header:void 0,content:void 0};return n.forEach(r,t=>{if(h(t))if(t.type===tb){let n=t.props;e.header=s(t,{intent:I,size:R,isOpen:Q,...n,testId:L?`${L}-${E}`:void 0,onClick:j})}else if(t.type===Jv){let n=t.props;e.content=s(t,{intent:I,size:R,grow:b??Q,...n,testId:L?`${L}-${E}`:void 0})}}),e},[r,I,R,Q,L,E,j,b]),q=k(()=>o&&Q&&T.canResize(E),[E,Q,T.lastUpdateActive,T,o]);/* @__PURE__ */
@@ -83,10 +83,10 @@ return P("div",{className:ge(c.items,"file-list"),children:Array.isArray(d)&&d.m
83
83
  /* @__PURE__ */P("input",{type:"file",onChange:F,accept:SF(p),name:s,ref:T,multiple:u,disabled:h,className:"hidden"}),
84
84
  /* @__PURE__ */M("div",{className:"flex flex-col grow items-center justify-center overflow-hidden w-full",children:[
85
85
  /* @__PURE__ */P(Yv,{icon:"fa-solid fa-file-circle-plus",size:b&&"md"!==b?"sm"===b?"2xl":"xl":"3xl",disabled:h,intent:x&&!j?"danger":"primary"}),
86
- /* @__PURE__ */P(TF,{label:m,disabled:h,hasFiles:I&&f,error:j?void 0:x,intent:v,size:b,canDragAndDrop:r}),p.length>0&&/* @__PURE__ */P(NF,{className:E.subLabel,types:p,minSize:c,maxSize:d})]}),I&&f&&/* @__PURE__ */P(AF,{value:l,intent:v,size:b,disabled:h,error:x,clearable:a,canDragAndDrop:r,onRemove:Q})]}):/* @__PURE__ */P(Tb,{ref:A,className:E,id:i,label:m,loading:o,clearable:a,value:l,disabled:h,error:x,intent:v,size:b,onClear:L,children:/* @__PURE__ */M("div",{className:"flex flex-col w-full gap-2",children:[/* @__PURE__ */P("input",{type:"file",onChange:F,accept:SF(p),disabled:h,name:s,ref:T,multiple:u,className:E.input}),I&&Array.isArray(e.value)&&e.value.length>1&&f&&/* @__PURE__ */P(AF,{value:l,intent:v,size:b,disabled:h,error:x,canDragAndDrop:r,onRemove:Q,clearable:a})]})})}),RF=IF,DF=e=>"checkbox"===e.type,LF=e=>e instanceof Date,VF=e=>null==e,QF=e=>"object"==typeof e,jF=e=>!VF(e)&&!Array.isArray(e)&&QF(e)&&!LF(e),FF=e=>jF(e)&&e.target?DF(e.target)?e.target.checked:e.target.value:e,BF=(e,t)=>t.split(".").some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join("."))),qF=e=>{const t=e.constructor&&e.constructor.prototype;return jF(t)&&t.hasOwnProperty("isPrototypeOf")},ZF="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function UF(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(ZF&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!(n||jF(e)&&qF(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=UF(e[i]));return r}var WF="blur",XF="trigger",HF="onChange",YF="onSubmit",_F="all",GF="pattern",KF="required",JF="validate",$F="root",eB=["__proto__","constructor","prototype"],tB=/^\w*$/,nB=e=>tB.test(e),rB=e=>void 0===e,iB=/[.[\]'"]/,aB=e=>e.split(iB).filter(Boolean),oB=(e,t,n)=>{if(!t||!jF(e))return n;const r=nB(t)?[t]:aB(t);if(r.some(e=>eB.includes(e)))return n;const i=r.reduce((e,t)=>VF(e)?void 0:e[t],e);return rB(i)||i===e?rB(e[t])?n:e[t]:i},sB=e=>"boolean"==typeof e,lB=e=>"function"==typeof e,cB=(e,t,n)=>{let r=-1;const i=nB(t)?[t]:aB(t),a=i.length,o=a-1;for(;++r<a;){const t=i[r];let a=n;if(r!==o){const n=e[t];a=jF(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(eB.includes(t))return;e[t]=a,e=e[t]}},dB=t.createContext(null);dB.displayName="HookFormControlContext";var uB=()=>t.useContext(dB),hB=(e,t,n,r=!0)=>{const i={};for(const a in e)Object.defineProperty(i,a,{get:()=>{const i=a;return t._proxyFormState[i]!==_F&&(t._proxyFormState[i]=!r||_F),n&&(n[i]=!0),e[i]}});return i},fB=ZF?t.useLayoutEffect:t.useEffect,pB=e=>"string"==typeof e,mB=(e,t,n,r,i)=>pB(e)?(r&&t.watch.add(e),oB(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),oB(n,e))):(r&&(t.watchAll=!0),n),gB=e=>VF(e)||!QF(e),vB=(e,t)=>0===t.length&&!Array.isArray(e)&&!qF(e);function bB(e,t,n=/* @__PURE__ */new WeakMap){if(e===t)return!0;if(gB(e)||gB(t))return Object.is(e,t);if(LF(e)&&LF(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(vB(e,r)||vB(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;const a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{const r=/* @__PURE__ */new WeakSet;r.add(t),n.set(e,r)}for(const o of r){const r=e[o];if(!(o in t))return!1;if("ref"!==o){const e=t[o];if(LF(r)&&LF(e)||(jF(r)||Array.isArray(r))&&(jF(e)||Array.isArray(e))?!bB(r,e,n):!Object.is(r,e))return!1}}return!0}function yB(e){const n=uB(),{control:r=n,name:i,defaultValue:a,disabled:o,exact:s,compute:l}=e||{},c=t.useRef(a),d=t.useRef(l),u=t.useRef(void 0),h=t.useRef(r),f=t.useRef(i);d.current=l;const[p,m]=t.useState(()=>{const e=r._getWatch(i,c.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=mB(i,r._names,e||r._formValues,!1,c.current);return d.current?d.current(t):t},[r._formValues,r._names,i]),v=t.useCallback(e=>{if(!o){const t=mB(i,r._names,e||r._formValues,!1,c.current);if(d.current){const e=d.current(t);bB(e,u.current)||(m(e),u.current=e)}else m(t)}},[r._formValues,r._names,o,i]);fB(()=>(h.current===r&&bB(f.current,i)||(h.current=r,f.current=i,v()),r._subscribe({name:i,formState:{values:!0},exact:s,callback:e=>{v(e.values)}})),[r,s,i,v]),t.useEffect(()=>r._removeUnmounted());const b=h.current!==r,y=f.current,x=t.useMemo(()=>{if(o)return null;const e=!b&&!bB(y,i);return b||e?g():null},[o,b,i,y,g]);return null!==x?x:p}var xB=e=>e.render(function(e){const n=uB(),{name:r,disabled:i,control:a=n,shouldUnregister:o,defaultValue:s,exact:l=!0}=e,c=BF(a._names.array,r),d=yB({control:a,name:r,defaultValue:t.useMemo(()=>oB(a._formValues,r,oB(a._defaultValues,r,s)),[a,r,s]),exact:l}),u=function(e){const n=uB(),{control:r=n,disabled:i,name:a,exact:o}=e||{},[s,l]=t.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return fB(()=>r._subscribe({name:a,formState:c.current,exact:o,callback:e=>{!i&&l({...r._formState,...e,defaultValues:r._defaultValues})}}),[a,i,o]),t.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),t.useMemo(()=>hB(s,r,c.current,!1),[s,r])}({control:a,name:r,exact:l}),h=t.useRef(e),f=t.useRef(null),p=t.useRef(a.register(r,{...e.rules,value:d,...sB(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const m=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!oB(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!oB(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!oB(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!oB(u.validatingFields,r)},error:{enumerable:!0,get:()=>oB(u.errors,r)}}),[u,r]),g=t.useCallback(e=>{const t=FF(e);return oB(a._fields,r)||(p.current=a.register(r,{...h.current.rules,value:t})),p.current.onChange({target:{value:FF(e),name:r},type:"change"})},[r,a]),v=t.useCallback(()=>p.current.onBlur({target:{value:oB(a._formValues,r),name:r},type:WF}),[r,a._formValues]),b=t.useCallback(e=>{e&&(f.current={focus:()=>lB(e.focus)&&e.focus(),select:()=>lB(e.select)&&e.select(),setCustomValidity:t=>lB(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>lB(e.reportValidity)&&e.reportValidity()});const t=oB(a._fields,r);t&&t._f&&e&&(t._f.ref=f.current)},[a._fields,r]),y=t.useMemo(()=>({name:r,value:d,...sB(i)||u.disabled?{disabled:u.disabled||i}:{},onChange:g,onBlur:v,ref:b}),[r,i,u.disabled,g,v,b,d]);return t.useEffect(()=>{const e=a._options.shouldUnregister||o;a.register(r,{...h.current.rules,...sB(h.current.disabled)?{disabled:h.current.disabled}:{}});const t=(e,t)=>{const n=oB(a._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=UF(oB(o?a._defaultValues:a._options.values||a._defaultValues,r,oB(a._options.defaultValues,r,h.current.defaultValue)));cB(a._defaultValues,r,e),rB(oB(a._formValues,r))&&cB(a._formValues,r,e)}if(!c&&a.register(r),f.current){const e=oB(a._fields,r);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!a._state.action:e)?a.unregister(r):t(r,!1)}},[r,a,c,o]),t.useEffect(()=>{a._setDisabledField({disabled:i,name:r})},[i,r,a]),t.useMemo(()=>({field:y,formState:u,fieldState:m}),[y,u,m])}(e)),wB=()=>{if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();const e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(16*Math.random()+e)%16|0;return("x"==t?n:3&n|8).toString(16)})},OB=(e,t,n={})=>n.shouldFocus||rB(n.shouldFocus)?n.focusName||`${e}.${rB(n.focusIndex)?t:n.focusIndex}.`:"",kB=e=>({isOnSubmit:!e||e===YF,isOnBlur:"onBlur"===e,isOnChange:e===HF,isOnAll:e===_F,isOnTouch:"onTouched"===e}),SB=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const r of t.watch)if(e.startsWith(r)&&"."===e.charAt(r.length))return!0;return!1},CB=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const n=oB(e,i);if(n){const{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(CB(a,t))break}else if(jF(a)&&CB(a,t))break}}},zB=(e,t,n)=>{const r=oB(e,n),i=Array.isArray(r)?r:[];return cB(i,$F,t[n]),cB(e,n,i),e},NB=e=>jF(e)&&!Object.keys(e).length,EB=e=>"file"===e.type,AB=e=>{if(!ZF)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},TB=e=>"radio"===e.type,PB=e=>e instanceof RegExp,MB=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},IB={value:!1,isValid:!1},RB={value:!0,isValid:!0},DB=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!rB(e[0].attributes.value)?rB(e[0].value)||""===e[0].value?RB:{value:e[0].value,isValid:!0}:RB:IB}return IB},LB={isValid:!1,value:null},VB=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,LB):LB;function QB(e,t,n="validate"){if(pB(e)||Array.isArray(e)&&e.every(pB)||sB(e)&&!e)return{type:n,message:pB(e)?e:"",ref:t}}var jB=e=>jF(e)&&!PB(e)?e:{value:e,message:""},FB=async(e,t,n,r,i,a)=>{const{ref:o,refs:s,required:l,maxLength:c,minLength:d,min:u,max:h,pattern:f,validate:p,name:m,valueAsNumber:g,mount:v}=e._f,b=oB(n,m);if(!v||t.has(m))return{};const y=s?s[0]:o,x=e=>{if(i&&y.reportValidity){const t=sB(e)?"":e||"";s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},w={},O=TB(o),k=DF(o),S=O||k,C=(g||EB(o))&&rB(o.value)&&rB(b)||AB(o)&&""===o.value||""===b||Array.isArray(b)&&!b.length,z=MB.bind(null,m,r,w),N=(e,t,n,r="maxLength",i="minLength")=>{const a=e?t:n;w[m]={type:e?r:i,message:a,ref:o,...z(e?r:i,a)}};if(a?!Array.isArray(b)||!b.length:l&&(!S&&(C||VF(b))||sB(b)&&!b||k&&!DB(s).isValid||O&&!VB(s).isValid)){const{value:e,message:t}=pB(l)?{value:!!l,message:l}:jB(l);if(e&&(w[m]={type:KF,message:t,ref:y,...z(KF,t)},!r))return x(t),w}if(!(C||VF(u)&&VF(h))){let e,t;const n=jB(h),i=jB(u);if(VF(b)||isNaN(b)){const r=o.valueAsDate||new Date(b),a=e=>/* @__PURE__ */new Date(/* @__PURE__ */(new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;pB(n.value)&&b&&(e=s?a(b)>a(n.value):l?b>n.value:r>new Date(n.value)),pB(i.value)&&b&&(t=s?a(b)<a(i.value):l?b<i.value:r<new Date(i.value))}else{const r=o.valueAsNumber||(b?+b:b);VF(n.value)||(e=r>n.value),VF(i.value)||(t=r<i.value)}if((e||t)&&(N(!!e,n.message,i.message,"max","min"),!r))return x(w[m].message),w}if((c||d)&&!C&&(pB(b)||a&&Array.isArray(b))){const e=jB(c),t=jB(d),n=!VF(e.value)&&b.length>+e.value,i=!VF(t.value)&&b.length<+t.value;if((n||i)&&(N(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!C&&pB(b)){const{value:e,message:t}=jB(f);if(PB(e)&&!b.match(e)&&(w[m]={type:GF,message:t,ref:o,...z(GF,t)},!r))return x(t),w}if(p)if(lB(p)){const e=QB(await p(b,n),y);if(e&&(w[m]={...e,...z(JF,e.message)},!r))return x(e.message),w}else if(jF(p)){let e={};for(const t in p){if(!NB(e)&&!r)break;const i=QB(await p[t](b,n),y,t);i&&(e={...i,...z(t,i.message)},x(i.message),r&&(w[m]=e))}if(!NB(e)&&(w[m]={ref:y,...e},!r))return w}return x(!0),w},BB=e=>Array.isArray(e)?e:[e],qB=(e,t)=>[...e,...BB(t)],ZB=e=>Array.isArray(e)?e.map(()=>{}):void 0;function UB(e,t,n){return[...e.slice(0,t),...BB(n),...e.slice(t)]}var WB=(e,t,n)=>Array.isArray(e)?(rB(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],XB=(e,t)=>[...BB(t),...BB(e)],HB=e=>Array.isArray(e)?e.filter(Boolean):[],YB=(e,t)=>rB(t)?[]:function(e,t){let n=0;const r=[...e];for(const i of t)r.splice(i-n,1),n++;return HB(r).length?r:[]}(e,BB(t).sort((e,t)=>e-t)),_B=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]};function GB(e,t){if(pB(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:nB(t)?[t]:aB(t);if(n.some(e=>eB.includes(String(e))))return e;const r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;){if(VF(e)){e=void 0;break}e=e[t[r]],r++}return e}(e,n),i=n.length-1,a=n[i];return r&&delete r[a],0!==i&&(jF(r)&&NB(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!rB(e[t]))return!1;return!0}(r))&&GB(e,n.slice(0,-1)),e}var KB=(e,t,n)=>(e[t]=n,e),JB=e=>{const t={};for(const n of Object.keys(e))if(QF(e[n])&&null!==e[n]&&!LF(e[n])){const r=JB(e[n]);for(const e of Object.keys(r))t[`${n}.${e}`]=r[e]}else t[n]=e[n];return t},$B=t.createContext(null);$B.displayName="HookFormContext";var eq=()=>t.useContext($B),tq=({children:e,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:l,trigger:c,formState:d,resetField:u,reset:h,resetDefaultValues:f,handleSubmit:p,unregister:m,control:g,register:v,setFocus:b,subscribe:y})=>{const x=t.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:l,trigger:c,formState:d,resetField:u,reset:h,resetDefaultValues:f,handleSubmit:p,unregister:m,control:g,register:v,setFocus:b,subscribe:y}),[o,g,d,i,r,p,v,h,f,u,a,b,s,l,y,c,m,n]);return t.createElement($B.Provider,{value:x},t.createElement(dB.Provider,{value:x.control},e))},nq=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function rq(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],a=t[r];if(i&&jF(i)&&a){const e=rq(i,a);jF(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var iq=e=>"select-multiple"===e.type,aq=e=>AB(e)&&e.isConnected;function oq(e){return Array.isArray(e)||jF(e)&&!(e=>{for(const t in e)if(lB(e[t]))return!0;return!1})(e)}function sq(e){return!(!e||!("_f"in e))}function lq(e){return Array.isArray(e)?!e.some(e=>!rB(e)):!Object.keys(e).length}function cq(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function dq(e,t={},n){for(const r in e){const i=e[r],a=n&&n[r];!oq(i)||Array.isArray(i)&&sq(a)?rB(i)||(t[r]=!0):(t[r]=Array.isArray(i)?[]:{},dq(i,t[r],a),lq(t[r])&&cq(t,r))}return t}function uq(e,t,n,r){n||(n=dq(t,{},r));for(const i in e){const a=e[i],o=r&&r[i];!oq(a)||Array.isArray(a)&&sq(o)?bB(a,t[i])?cq(n,i):n[i]=!0:(rB(t)||gB(n[i])?n[i]=dq(a,Array.isArray(a)?[]:{},o):uq(a,VF(t)?{}:t[i],n[i],o),lq(n[i])&&cq(n,i))}return n}var hq=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>rB(e)?e:t?""===e?NaN:e?+e:e:n&&pB(e)?new Date(e):r?r(e):e;function fq(e){const t=e.ref;return EB(t)?t.files:TB(t)?VB(e.refs).value:iq(t)?[...t.selectedOptions].map(({value:e})=>e):DF(t)?DB(e.refs).value:hq(rB(t.value)?e.ref.value:t.value,e)}var pq=e=>rB(e)?e:PB(e)?e.source:jF(e)?PB(e.value)?e.value.source:e.value:e,mq="AsyncFunction",gq=e=>{if(!e||!e.validate)return!1;if(lB(e.validate))return e.validate.constructor.name===mq;if(jF(e.validate))for(const t in e.validate)if(e.validate[t].constructor.name===mq)return!0;return!1};function vq(e,t,n){const r=oB(e,n);if(r||nB(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),a=oB(t,r),o=oB(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var bq={mode:YF,reValidateMode:HF,shouldFocusError:!0},yq="form",xq={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function wq(e={}){let t={...bq,...e},n={...UF(xq),isLoading:lB(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(jF(t.defaultValues)||jF(t.values))&&UF(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:UF(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:/* @__PURE__ */new Set,disabled:/* @__PURE__ */new Set,unMount:/* @__PURE__ */new Set,array:/* @__PURE__ */new Set,watch:/* @__PURE__ */new Set,registerName:/* @__PURE__ */new Set};const l={},c={};let d=0,u=kB(t.mode),h=kB(t.reValidateMode);const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={...f};let m={...p};const g={array:nq(),state:nq()};let v=0;const b=t.criteriaMode===_F,y=(e,t)=>n=>{clearTimeout(c[e]),c[e]=setTimeout(t,n)},x=async e=>{if(!o.keepIsValid&&!t.disabled&&(p.isValid||m.isValid||e)){const e=++v;let i;t.resolver?(i=NB((await z()).errors),e===v&&w()):i=await E({fields:r,onlyCheckValid:!0,eventType:"valid"}),e===v&&i!==n.isValid&&g.state.next({isValid:i})}},w=(e,r)=>{!t.disabled&&(p.isValidating||p.validatingFields||m.isValidating||m.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?cB(n.validatingFields,e,r):GB(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!NB(n.validatingFields)}))},O=()=>{n.dirtyFields=uq(i,a,void 0,r)},k=(e,t)=>{cB(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},S=(t,l,c,d)=>{const u=oB(r,t);if(u){if((e=>{const t=nB(e)?[e]:aB(e);let n=a,r=i;for(let i=0;i<t.length-1;i++){const e=t[i];if(n=VF(n)?n:n[e],r=VF(r)?r:r[e],null===n&&null!==r)return!0}return!1})(t))return;const r=rB(oB(a,t)),h=oB(a,t,rB(c)?oB(i,t):c);rB(h)||d&&d.defaultChecked||l?cB(a,t,l?h:fq(u._f)):P(t,h),o.mount&&!o.action&&(x(),r&&n.isDirty&&(p.isDirty||m.isDirty)&&(A()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!rB(oB(a,t))&&SB(t,s)&&(o.watch=!0))}},C=(e,o,s,l,c)=>{let d=!1,u=!1;const h={name:e};if(!t.disabled||!0===l){if(!s||l){const t=bB(oB(i,e),o);(p.isDirty||m.isDirty)&&(u=n.isDirty,n.isDirty=h.isDirty=!t||A(),d=u!==h.isDirty),u=!!oB(n.dirtyFields,e),t!==n.isDirty?n.dirtyFields=uq(i,a,void 0,r):t?GB(n.dirtyFields,e):cB(n.dirtyFields,e,!0),h.dirtyFields=n.dirtyFields,d=d||(p.dirtyFields||m.dirtyFields)&&u!==!t}if(s){const t=oB(n.touchedFields,e);t||(cB(n.touchedFields,e,s),h.touchedFields=n.touchedFields,d=d||(p.touchedFields||m.touchedFields)&&t!==s)}d&&c&&g.state.next(h)}return d?h:{}},z=async e=>(w(e,!0),await t.resolver(a,t.context,((e,t,n,r)=>{const i={};for(const a of e){const e=oB(t,a);e&&cB(i,a,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),N=async({name:t,eventType:r})=>{if(e.validate){const i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(jF(i))for(const e in i){const t=i[e];t&&F(`${yq}.${e}`,{message:pB(t.message)?t.message:"",type:t.type||JF})}else pB(i)||!i?F(yq,{message:i||"",type:JF}):j(yq);return i}return!0},E=async({fields:r,onlyCheckValid:i,name:o,eventType:l,context:c={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(c.runRootValidation=!0,!(await N({name:o,eventType:l}))&&(c.valid=!1,i)))return c.valid;for(const d in r){const o=r[d];if(o){const{_f:r,...u}=o;if(r){const l=s.array.has(r.name),d=o._f&&gq(o._f),u=p.validatingFields||p.isValidating||m.validatingFields||m.isValidating;d&&u&&w([r.name],!0);const h=await FB(o,s.disabled,a,b,t.shouldUseNativeValidation&&!i,l);if(d&&u&&w([r.name]),h[r.name]&&(c.valid=!1,i))break;if(!i&&(oB(h,r.name)?l?zB(n.errors,h,r.name):cB(n.errors,r.name,h[r.name]):GB(n.errors,r.name)),e.shouldUseNativeValidation&&h[r.name])break}!NB(u)&&await E({context:c,onlyCheckValid:i,fields:u,name:d,eventType:l})}}return c.valid},A=(e,t)=>(e&&t&&cB(a,e,t),!bB(o.mount?a:i,i)),T=(e,t,n)=>mB(e,s,{...o.mount?a:rB(t)?i:pB(e)?{[e]:t}:t},n,t),P=(e,t,n={},i=!1,o=!1)=>{const s=oB(r,e);let l=t;if(s){const n=s._f;n&&(!n.disabled&&cB(a,e,hq(t,n)),l=AB(n.ref)&&VF(t)?"":t,iq(n.ref)?[...n.ref.options].forEach(e=>e.selected=l.includes(e.value)):n.refs?DF(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(l)?e.checked=!!l.find(t=>t===e.value):e.checked=l===e.value||!!l)}):n.refs.forEach(e=>e.checked=e.value===l):EB(n.ref)?n.ref.value="":(n.ref.value=l,n.ref.type||o||g.state.next({name:e,values:i?a:UF(a)})))}(n.shouldDirty||n.shouldTouch)&&C(e,l,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&V(e,{delayError:n.delayError})},M=(e,t,n,i=!1,a=!1)=>{for(const o in t){if(!t.hasOwnProperty(o))return;const l=t[o],c=e+"."+o,d=oB(r,c);(s.array.has(e)||jF(l)||d&&!d._f)&&!LF(l)?M(c,l,n,i,a):P(c,l,n,i,a)}},I=(e,t,i,l,c=!1)=>{const d=oB(r,e),u=s.array.has(e),h=l?t:UF(t),f=bB(oB(a,e),h);if(f||cB(a,e,h),u)g.array.next({name:e,values:l?a:UF(a)}),(p.isDirty||p.dirtyFields||m.isDirty||m.dirtyFields)&&i.shouldDirty&&(O(),c||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:A(e,h)}));else{const t=Array.isArray(h)&&!h.length||NB(h);!d||d._f||VF(h)||t?P(e,h,i,l,c):M(e,h,i,l,c)}if(!f&&!c){const t=SB(e,s),r=l?a:UF(a);g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r})}},R=(e,t,n={})=>I(e,t,n,!1),D=async i=>{o.mount=!0;const f=i.target;let v=f.name,O=!0;const S=oB(r,v),A=e=>{O=Number.isNaN(e)||LF(e)&&isNaN(e.getTime())||bB(e,oB(a,v,e))};if(S){let o,P;const M=f.type?fq(S._f):FF(i),I=i.type===WF||"focusout"===i.type,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||e.validate||t.resolver||oB(n.errors,v)||S._f.deps),D=R||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(I,oB(n.touchedFields,v),n.isSubmitted,h,u),L=SB(v,s,I);if(cB(a,v,M),I){if(!f||!f.readOnly){S._f.onBlur&&S._f.onBlur(i);const e=l[v];e&&e(0)}}else S._f.onChange&&S._f.onChange(i);const Q=C(v,M,I),j=!NB(Q)||L;if(!I&&g.state.next({name:v,type:i.type,...d?{values:UF(a)}:{}}),D)return R&&n.isValid||!p.isValid&&!m.isValid||("onBlur"===t.mode?I&&x():I||x()),j&&g.state.next({name:v,...L?{}:Q});if(!t.resolver&&e.validate&&await N({name:v,eventType:i.type}),!I&&L&&g.state.next({...n}),t.resolver){const{errors:e}=await z([v]);if(w([v]),A(M),!O)return void(!NB(Q)&&g.state.next(Q));const t=vq(n.errors,r,v),i=vq(e,r,t.name||v);o=i.error,v=i.name,P=NB(e)}else w([v],!0),o=(await FB(S,s.disabled,a,b,t.shouldUseNativeValidation))[v],w([v]),A(M),O&&(o?P=!1:(p.isValid||m.isValid)&&(P=await E({fields:r,onlyCheckValid:!0,name:v,eventType:i.type})));O&&(S._f.deps&&(!Array.isArray(S._f.deps)||S._f.deps.length>0)&&V(S._f.deps),((e,r,i,a)=>{const o=oB(n.errors,e),s=(p.isValid||m.isValid)&&sB(r)&&n.isValid!==r;if(t.delayError&&i?(l[e]=y(e,()=>k(e,i)),l[e](t.delayError)):(clearTimeout(c[e]),delete l[e],i?cB(n.errors,e,i):GB(n.errors,e),n.errors={...n.errors}),(i?!bB(o,i):o)||!NB(a)||s){const t={...a,...s&&sB(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},g.state.next(t)}})(v,P,o,Q))}var T},L=(e,t)=>{if(oB(n.errors,t)&&e.focus)return e.focus(),1},V=async(e,i={})=>{let a,o;const d=BB(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await z(e);if(w(e),e){for(const r of e){const e=oB(t,r);e?s.array.has(r)&&jF(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?zB(n.errors,{[r]:e},r):cB(n.errors,r,e):GB(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t})(rB(e)?e:d);a=NB(t),o=e?!d.some(e=>oB(t,e)):a}else e?(o=(await Promise.all(d.map(async e=>{const t=oB(r,e);return await E({fields:t&&t._f?{[e]:t}:t,eventType:XF})}))).every(Boolean),(o||n.isValid)&&x()):o=a=await E({fields:r,name:e,eventType:XF});if(i.delayError&&t.delayError&&pB(e)){const r=oB(n.errors,e);r?(GB(n.errors,e),l[e]=y(e,()=>k(e,r)),l[e](t.delayError)):(clearTimeout(c[e]),delete l[e])}return g.state.next({...!pB(e)||(p.isValid||m.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&CB(r,L,e?d:s.mount),o},Q=(e,t)=>({invalid:!!oB((t||n).errors,e),isDirty:!!oB((t||n).dirtyFields,e),error:oB((t||n).errors,e),isValidating:!!oB(n.validatingFields,e),isTouched:!!oB((t||n).touchedFields,e)}),j=e=>{const t=e?BB(e):void 0;null==t||t.forEach(e=>GB(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):g.state.next({errors:{}})},F=(e,t,i)=>{const a=(oB(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:l,...c}=oB(n.errors,e)||{};cB(n.errors,e,{...c,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},B=e=>{var t;const r=!!(null===(t=e.formState)||void 0===t?void 0:t.values);r&&d++;const{unsubscribe:o}=g.state.subscribe({next:t=>{if(r=e.name,o=t.name,s=e.exact,(!r||!o||r===o||BB(r).some(e=>e&&(s?e===o||e.startsWith(o+"."):e.startsWith(o)||o.startsWith(e))))&&((e,t,n,r)=>{n(e);const{name:i,...a}=e,o=Object.keys(a);return!o.length||r&&o.length>=Object.keys(t).length||o.find(e=>t[e]===(!r||_F))})(t,e.formState||p,_,e.reRenderRoot)){const r={...a};e.callback({values:r,...n,...t,defaultValues:i})}var r,o,s}});if(!r)return o;let s=!1;return()=>{s||(s=!0,d--,o())}},q=(e,o={})=>{for(const l of e?BB(e):s.mount)s.mount.delete(l),s.array.delete(l),o.keepValue||(GB(r,l),GB(a,l)),!o.keepError&&GB(n.errors,l),!o.keepDirty&&GB(n.dirtyFields,l),!o.keepTouched&&GB(n.touchedFields,l),!o.keepIsValidating&&GB(n.validatingFields,l),!t.shouldUnregister&&!o.keepDefaultValue&&GB(i,l);g.state.next({values:UF(a)}),g.state.next({...n,...o.keepDirty?{isDirty:A()}:{}}),!o.keepIsValid&&x()},Z=({disabled:e,name:t})=>{if(sB(e)&&o.mount||e||s.disabled.has(t)){const n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&x()}},U=(e,n={})=>{let a=oB(r,e);const l=sB(n.disabled)||sB(t.disabled),c=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return cB(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!c?Z({disabled:sB(n.disabled)?n.disabled:t.disabled,name:e}):S(e,!0,n.value),{...l?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:pq(n.min),max:pq(n.max),minLength:pq(n.minLength),maxLength:pq(n.maxLength),pattern:pq(n.pattern)}:{},name:e,onChange:D,onBlur:D,ref:l=>{if(l){s.registerName.add(e),U(e,n),s.registerName.delete(e),a=oB(r,e);const t=rB(l.value)&&l.querySelectorAll&&l.querySelectorAll("input,select,textarea")[0]||l,o=(e=>TB(e)||DF(e))(t),c=a._f.refs||[];if(o?c.find(e=>e===t):t===a._f.ref)return;cB(r,e,{_f:{...a._f,...o?{refs:[...c.filter(aq),t,...Array.isArray(oB(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),S(e,!1,void 0,t)}else a=oB(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!BF(s.array,e)||!o.action)&&s.unMount.add(e)}}},W=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&CB(r,L,s.mount),X=(e,i)=>async o=>{let l;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let c=UF(a);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await z();w(),n.errors=e,c=UF(t)}else await E({fields:r,eventType:"submit"});if(s.disabled.size)for(const e of s.disabled)GB(c,e);if(GB(n.errors,$F),NB(n.errors)){g.state.next({errors:{}});try{await e(c,o)}catch(d){l=d}}else i&&await i({...n.errors},o),W(),setTimeout(W);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:NB(n.errors)&&!l,submitCount:n.submitCount+1,errors:n.errors}),l)throw l},H=(e,l={})=>{const c=e?UF(e):i,d=UF(c),u=NB(e),h=d,f=r;if(l.keepDefaultValues||(i=c),!l.keepValues){if(l.keepDirtyValues){const e=/* @__PURE__ */new Set([...s.mount,...Object.keys(uq(i,a,void 0,f))]);for(const t of Array.from(e)){const e=oB(n.dirtyFields,t),r=oB(a,t),i=oB(h,t);e&&!rB(r)?cB(h,t,r):e||rB(i)||R(t,i)}}else{if(ZF&&rB(e))for(const e of s.mount){const t=oB(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(AB(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(l.keepFieldsRef)for(const e of s.mount)R(e,oB(h,e));else r={}}if(t.shouldUnregister){if(a=l.keepDefaultValues?UF(i):{},l.keepFieldsRef)for(const e of s.mount)cB(a,e,oB(h,e))}else a=UF(h);g.array.next({values:{...h}}),g.state.next({name:void 0,type:void 0,values:{...h}})}s={mount:l.keepDirtyValues?s.mount:/* @__PURE__ */new Set,unMount:/* @__PURE__ */new Set,array:/* @__PURE__ */new Set,registerName:/* @__PURE__ */new Set,disabled:/* @__PURE__ */new Set,watch:/* @__PURE__ */new Set,watchAll:!1,focus:""},o.mount=!p.isValid||!!l.keepIsValid||!!l.keepDirtyValues||!t.shouldUnregister&&!NB(h),o.watch=!!t.shouldUnregister,o.keepIsValid=!!l.keepIsValid,o.action=!1,l.keepErrors||(n.errors={}),g.state.next({submitCount:l.keepSubmitCount?n.submitCount:0,isDirty:!u&&(l.keepDirty?n.isDirty:l.keepValues?A():!(!l.keepDefaultValues||bB(e,i))),isSubmitted:!!l.keepIsSubmitted&&n.isSubmitted,dirtyFields:u?{}:l.keepDirtyValues?l.keepDefaultValues&&a?uq(i,a,void 0,f):n.dirtyFields:l.keepDefaultValues&&e?uq(i,e,void 0,f):l.keepDirty?n.dirtyFields:{},touchedFields:l.keepTouched?n.touchedFields:{},errors:l.keepErrors?n.errors:{},isSubmitSuccessful:!!l.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:i})},Y=(e,n)=>H(lB(e)?e(a):e,{...t.resetOptions,...n}),_=e=>{const{name:t,type:r,values:i,...a}=e;n={...n,...a}},G={control:{register:U,unregister:q,getFieldState:Q,handleSubmit:X,setError:F,_subscribe:B,_runSchema:z,_updateIsValidating:w,_focusError:W,_getWatch:T,_getDirty:A,_setValid:x,_setFieldArray:(e,i=[],s,l,c=!0,d=!0)=>{if(l&&s&&!t.disabled){if(o.action=!0,d&&Array.isArray(oB(r,e))){const t=s(oB(r,e),l.argA,l.argB);c&&cB(r,e,t)}if(d&&Array.isArray(oB(n.errors,e))){const t=s(oB(n.errors,e),l.argA,l.argB);c&&cB(n.errors,e,t),((e,t)=>{!HB(oB(e,t)).length&&GB(e,t)})(n.errors,e)}if((p.touchedFields||m.touchedFields)&&d&&Array.isArray(oB(n.touchedFields,e))){const t=s(oB(n.touchedFields,e),l.argA,l.argB);c&&cB(n.touchedFields,e,t)}(p.dirtyFields||m.dirtyFields)&&O(),g.state.next({name:e,isDirty:A(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else cB(a,e,i)},_setDisabledField:Z,_setErrors:e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>HB(oB(o.mount?a:i,e,t.shouldUnregister?oB(i,e,[]):[])),_reset:H,_resetDefaultValues:()=>lB(t.defaultValues)&&t.defaultValues().then(e=>{Y(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of s.unMount){const t=oB(r,e);t&&(t._f.refs?t._f.refs.every(e=>!aq(e)):!aq(t._f.ref))&&q(e)}s.unMount=/* @__PURE__ */new Set},_disableForm:e=>{sB(e)&&(g.state.next({disabled:e}),CB(r,(t,n)=>{const i=oB(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},_subjects:g,_proxyFormState:p,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},u=kB(t.mode),h=kB(t.reValidateMode)}},subscribe:e=>(o.mount=!0,m={...m,...e.formState},B({...e,formState:{...f,...e.formState}})),trigger:V,register:U,handleSubmit:X,watch:(e,t)=>{if(lB(e)){d++;const{unsubscribe:n}=g.state.subscribe({next:n=>"values"in n&&e(n.values||T(void 0,t),n)});let r=!1;return{unsubscribe:()=>{r||(r=!0,d--,n())}}}return T(e,t,!0)},setValue:R,setValues:(e,t={})=>{const r=lB(e)?e(a):e;if(!bB(a,r)){a={...a,...r};const e=JB(r);for(const n of s.mount)n in e&&I(n,e[n],t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...d?{values:a}:{}}),t.shouldValidate&&x()}},getValues:(e,t)=>{let r={...o.mount?a:i};return t&&(r=rq(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),rB(e)?r:pB(e)?oB(r,e):e.map(e=>oB(r,e))},reset:Y,resetField:(e,t={})=>{oB(r,e)&&(rB(t.defaultValue)?R(e,UF(oB(i,e))):(R(e,t.defaultValue),cB(i,e,UF(t.defaultValue))),t.keepTouched||GB(n.touchedFields,e),t.keepDirty||(GB(n.dirtyFields,e),n.isDirty=t.defaultValue?A(e,UF(oB(i,e))):A()),t.keepError||(GB(n.errors,e),p.isValid&&x()),g.state.next({...n}))},resetDefaultValues:(e,t={})=>{if(i=UF(e),!t.keepDirty){const e=uq(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!NB(e)}t.keepIsValid||x(),g.state.next({...n,defaultValues:i})},clearErrors:j,unregister:q,setError:F,setFocus:(e,t={})=>{const n=oB(r,e),i=n&&n._f;if(i){const e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&lB(e.select)&&e.select()})}},getFieldState:Q};return{...G,formControl:G}}function Oq(e={}){const n=t.useRef(void 0),r=t.useRef(void 0),i=t.useRef(e.formControl),[a,o]=t.useState(()=>({...UF(xq),isLoading:lB(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:lB(e.defaultValues)?void 0:e.defaultValues}));if(!n.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!lB(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...r}=wq(e);n.current={...r,formState:a}}const s=n.current.control;return s._options=e,fB(()=>{const e=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState,defaultValues:s._defaultValues}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),t.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),t.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),t.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),t.useEffect(()=>{if(s._proxyFormState.isDirty){const e=s._getDirty();e!==a.isDirty&&s._subjects.state.next({isDirty:e})}},[s,a.isDirty]),t.useEffect(()=>{var t;e.values&&!bB(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),(null===(t=s._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||s._setValid(),r.current=e.values,o(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),t.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),n.current.formState=t.useMemo(()=>hB(a,s),[s,a]),n.current}var kq,Sq=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
86
+ /* @__PURE__ */P(TF,{label:m,disabled:h,hasFiles:I&&f,error:j?void 0:x,intent:v,size:b,canDragAndDrop:r}),p.length>0&&/* @__PURE__ */P(NF,{className:E.subLabel,types:p,minSize:c,maxSize:d})]}),I&&f&&/* @__PURE__ */P(AF,{value:l,intent:v,size:b,disabled:h,error:x,clearable:a,canDragAndDrop:r,onRemove:Q})]}):/* @__PURE__ */P(Tb,{ref:A,className:E,id:i,label:m,loading:o,clearable:a,value:l,disabled:h,error:x,intent:v,size:b,onClear:L,children:/* @__PURE__ */M("div",{className:"flex flex-col w-full gap-2",children:[/* @__PURE__ */P("input",{type:"file",onChange:F,accept:SF(p),disabled:h,name:s,ref:T,multiple:u,className:E.input}),I&&Array.isArray(e.value)&&e.value.length>1&&f&&/* @__PURE__ */P(AF,{value:l,intent:v,size:b,disabled:h,error:x,canDragAndDrop:r,onRemove:Q,clearable:a})]})})}),RF=IF,DF=e=>"checkbox"===e.type,LF=e=>"file"===e.type,VF=e=>e instanceof Date,QF=e=>null==e,jF=e=>"object"==typeof e,FF=e=>!QF(e)&&!Array.isArray(e)&&jF(e)&&!VF(e),BF=e=>FF(e)&&e.target?DF(e.target)?e.target.checked:LF(e.target)?e.target.files:e.target.value:e,qF=(e,t)=>t.split(".").some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join("."))),ZF=e=>{const t=e.constructor&&e.constructor.prototype;return FF(t)&&t.hasOwnProperty("isPrototypeOf")},UF="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function WF(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(UF&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!(n||FF(e)&&ZF(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=WF(e[i]));return r}var XF="blur",HF="trigger",YF="onChange",_F="onSubmit",GF="all",KF="pattern",JF="required",$F="validate",eB="root",tB=["__proto__","constructor","prototype"],nB=/^\w*$/,rB=e=>nB.test(e),iB=e=>void 0===e,aB=/[.[\]'"]/,oB=e=>e.split(aB).filter(Boolean),sB=(e,t,n)=>{if(!t||!FF(e))return n;const r=rB(t)?[t]:oB(t);if(r.some(e=>tB.includes(e)))return n;const i=r.reduce((e,t)=>QF(e)?void 0:e[t],e);return iB(i)||i===e?iB(e[t])?n:e[t]:i},lB=e=>"boolean"==typeof e,cB=e=>"function"==typeof e,dB=(e,t,n)=>{let r=-1;const i=rB(t)?[t]:oB(t),a=i.length,o=a-1;for(;++r<a;){const t=i[r];let a=n;if(r!==o){const n=e[t];a=FF(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(tB.includes(t))return;e[t]=a,e=e[t]}},uB=t.createContext(null);uB.displayName="HookFormControlContext";var hB=()=>t.useContext(uB),fB=(e,t,n,r=!0)=>{const i={};for(const a in e)Object.defineProperty(i,a,{get:()=>{const i=a;return t._proxyFormState[i]!==GF&&(t._proxyFormState[i]=!r||GF),n&&(n[i]=!0),e[i]}});return i},pB=UF?t.useLayoutEffect:t.useEffect,mB=e=>"string"==typeof e,gB=(e,t,n,r,i)=>mB(e)?(r&&t.watch.add(e),sB(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),sB(n,e))):(r&&(t.watchAll=!0),n),vB=e=>QF(e)||!jF(e),bB=(e,t)=>0===t.length&&!Array.isArray(e)&&!ZF(e);function yB(e,t,n=/* @__PURE__ */new WeakMap){if(e===t)return!0;if(vB(e)||vB(t))return Object.is(e,t);if(VF(e)&&VF(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(bB(e,r)||bB(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;const a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{const r=/* @__PURE__ */new WeakSet;r.add(t),n.set(e,r)}for(const o of r){const r=e[o];if(!(o in t))return!1;if("ref"!==o){const e=t[o];if(VF(r)&&VF(e)||(FF(r)||Array.isArray(r))&&(FF(e)||Array.isArray(e))?!yB(r,e,n):!Object.is(r,e))return!1}}return!0}function xB(e){const n=hB(),{control:r=n,name:i,defaultValue:a,disabled:o,exact:s,compute:l}=e||{},c=t.useRef(a),d=t.useRef(l),u=t.useRef(void 0),h=t.useRef(r),f=t.useRef(i);d.current=l;const[p,m]=t.useState(()=>{const e=r._getWatch(i,c.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=gB(i,r._names,e||r._formValues,!1,c.current);return d.current?d.current(t):t},[r._formValues,r._names,i]),v=t.useCallback(e=>{if(!o){const t=gB(i,r._names,e||r._formValues,!1,c.current);if(d.current){const e=d.current(t);yB(e,u.current)||(m(e),u.current=e)}else m(t)}},[r._formValues,r._names,o,i]);pB(()=>(h.current===r&&yB(f.current,i)||(h.current=r,f.current=i,v()),r._subscribe({name:i,formState:{values:!0},exact:s,callback:e=>{v(e.values)}})),[r,s,i,v]),t.useEffect(()=>r._removeUnmounted());const b=h.current!==r,y=f.current,x=t.useMemo(()=>{if(o)return null;const e=!b&&!yB(y,i);return b||e?g():null},[o,b,i,y,g]);return null!==x?x:p}var wB=e=>e.render(function(e){const n=hB(),{name:r,disabled:i,control:a=n,shouldUnregister:o,defaultValue:s,exact:l=!0}=e,c=qF(a._names.array,r),d=xB({control:a,name:r,defaultValue:t.useMemo(()=>sB(a._formValues,r,sB(a._defaultValues,r,s)),[a,r,s]),exact:l}),u=function(e){const n=hB(),{control:r=n,disabled:i,name:a,exact:o}=e||{},[s,l]=t.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return pB(()=>r._subscribe({name:a,formState:c.current,exact:o,callback:e=>{!i&&l({...r._formState,...e,defaultValues:r._defaultValues})}}),[a,i,o]),t.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),t.useMemo(()=>fB(s,r,c.current,!1),[s,r])}({control:a,name:r,exact:l}),h=t.useRef(e),f=t.useRef(null),p=t.useRef(a.register(r,{...e.rules,value:d,...lB(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const m=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!sB(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!sB(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!sB(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!sB(u.validatingFields,r)},error:{enumerable:!0,get:()=>sB(u.errors,r)}}),[u,r]),g=t.useCallback(e=>{const t=BF(e);return sB(a._fields,r)||(p.current=a.register(r,{...h.current.rules,value:t})),p.current.onChange({target:{value:BF(e),name:r},type:"change"})},[r,a]),v=t.useCallback(()=>p.current.onBlur({target:{value:sB(a._formValues,r),name:r},type:XF}),[r,a._formValues]),b=t.useCallback(e=>{e&&(f.current={focus:()=>cB(e.focus)&&e.focus(),select:()=>cB(e.select)&&e.select(),setCustomValidity:t=>cB(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>cB(e.reportValidity)&&e.reportValidity()});const t=sB(a._fields,r);t&&t._f&&e&&(t._f.ref=f.current)},[a._fields,r]),y=t.useMemo(()=>({name:r,value:d,...lB(i)||u.disabled?{disabled:u.disabled||i}:{},onChange:g,onBlur:v,ref:b}),[r,i,u.disabled,g,v,b,d]);return t.useEffect(()=>{const e=a._options.shouldUnregister||o;p.current=a.register(r,{...h.current.rules,...lB(h.current.disabled)?{disabled:h.current.disabled}:{}});const t=(e,t)=>{const n=sB(a._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=WF(sB(o?a._defaultValues:a._options.values||a._defaultValues,r,sB(a._options.defaultValues,r,h.current.defaultValue)));dB(a._defaultValues,r,e),iB(sB(a._formValues,r))&&dB(a._formValues,r,e)}if(!c&&a.register(r),f.current){const e=sB(a._fields,r);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!a._state.action:e)?a.unregister(r):t(r,!1)}},[r,a,c,o]),t.useEffect(()=>{a._setDisabledField({disabled:i,name:r})},[i,r,a]),t.useMemo(()=>({field:y,formState:u,fieldState:m}),[y,u,m])}(e)),OB=()=>{if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();const e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(16*Math.random()+e)%16|0;return("x"==t?n:3&n|8).toString(16)})},kB=(e,t,n={})=>n.shouldFocus||iB(n.shouldFocus)?n.focusName||`${e}.${iB(n.focusIndex)?t:n.focusIndex}.`:"",SB=e=>({isOnSubmit:!e||e===_F,isOnBlur:"onBlur"===e,isOnChange:e===YF,isOnAll:e===GF,isOnTouch:"onTouched"===e}),CB=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const r of t.watch)if(e.startsWith(r)&&"."===e.charAt(r.length))return!0;return!1},zB=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const n=sB(e,i);if(n){const{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(zB(a,t))break}else if(FF(a)&&zB(a,t))break}}},NB=(e,t,n)=>{const r=sB(e,n),i=Array.isArray(r)?r:[];return dB(i,eB,t[n]),dB(e,n,i),e},EB=e=>FF(e)&&!Object.keys(e).length,AB=e=>{if(!UF)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},TB=e=>"radio"===e.type,PB=e=>e instanceof RegExp,MB=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},IB={value:!1,isValid:!1},RB={value:!0,isValid:!0},DB=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!iB(e[0].attributes.value)?iB(e[0].value)||""===e[0].value?RB:{value:e[0].value,isValid:!0}:RB:IB}return IB},LB={isValid:!1,value:null},VB=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,LB):LB;function QB(e,t,n="validate"){if(mB(e)||Array.isArray(e)&&e.every(mB)||lB(e)&&!e)return{type:n,message:mB(e)?e:"",ref:t}}var jB=e=>FF(e)&&!PB(e)?e:{value:e,message:""},FB=async(e,t,n,r,i,a)=>{const{ref:o,refs:s,required:l,maxLength:c,minLength:d,min:u,max:h,pattern:f,validate:p,name:m,valueAsNumber:g,mount:v}=e._f,b=sB(n,m);if(!v||t.has(m))return{};const y=s?s[0]:o,x=e=>{if(i&&y.reportValidity){const t=lB(e)?"":e||"";s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},w={},O=TB(o),k=DF(o),S=O||k,C=(g||LF(o))&&iB(o.value)&&iB(b)||AB(o)&&""===o.value||""===b||Array.isArray(b)&&!b.length,z=MB.bind(null,m,r,w),N=(e,t,n,r="maxLength",i="minLength")=>{const a=e?t:n;w[m]={type:e?r:i,message:a,ref:o,...z(e?r:i,a)}};if(a?!Array.isArray(b)||!b.length:l&&(!S&&(C||QF(b))||lB(b)&&!b||k&&!DB(s).isValid||O&&!VB(s).isValid)){const{value:e,message:t}=mB(l)?{value:!!l,message:l}:jB(l);if(e&&(w[m]={type:JF,message:t,ref:y,...z(JF,t)},!r))return x(t),w}if(!(C||QF(u)&&QF(h))){let e,t;const n=jB(h),i=jB(u);if(QF(b)||isNaN(b)){const r=o.valueAsDate||new Date(b),a=e=>/* @__PURE__ */new Date(/* @__PURE__ */(new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;mB(n.value)&&b&&(e=s?a(b)>a(n.value):l?b>n.value:r>new Date(n.value)),mB(i.value)&&b&&(t=s?a(b)<a(i.value):l?b<i.value:r<new Date(i.value))}else{const r=o.valueAsNumber||(b?+b:b);QF(n.value)||(e=r>n.value),QF(i.value)||(t=r<i.value)}if((e||t)&&(N(!!e,n.message,i.message,"max","min"),!r))return x(w[m].message),w}if((c||d)&&!C&&(mB(b)||a&&Array.isArray(b))){const e=jB(c),t=jB(d),n=!QF(e.value)&&b.length>+e.value,i=!QF(t.value)&&b.length<+t.value;if((n||i)&&(N(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!C&&mB(b)){const{value:e,message:t}=jB(f);if(PB(e)&&!b.match(e)&&(w[m]={type:KF,message:t,ref:o,...z(KF,t)},!r))return x(t),w}if(p)if(cB(p)){const e=QB(await p(b,n),y);if(e&&(w[m]={...e,...z($F,e.message)},!r))return x(e.message),w}else if(FF(p)){let e={};for(const t in p){if(!EB(e)&&!r)break;const i=QB(await p[t](b,n),y,t);i&&(e={...i,...z(t,i.message)},x(i.message),r&&(w[m]=e))}if(!EB(e)&&(w[m]={ref:y,...e},!r))return w}return x(!0),w},BB=e=>Array.isArray(e)?e:[e],qB=(e,t)=>[...e,...BB(t)],ZB=e=>Array.isArray(e)?e.map(()=>{}):void 0;function UB(e,t,n){return[...e.slice(0,t),...BB(n),...e.slice(t)]}var WB=(e,t,n)=>Array.isArray(e)?(iB(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],XB=(e,t)=>[...BB(t),...BB(e)],HB=e=>Array.isArray(e)?e.filter(Boolean):[],YB=(e,t)=>iB(t)?[]:function(e,t){let n=0;const r=[...e];for(const i of t)r.splice(i-n,1),n++;return HB(r).length?r:[]}(e,BB(t).sort((e,t)=>e-t)),_B=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]};function GB(e,t){if(mB(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:rB(t)?[t]:oB(t);if(n.some(e=>tB.includes(String(e))))return e;const r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;){if(QF(e)){e=void 0;break}e=e[t[r]],r++}return e}(e,n),i=n.length-1,a=n[i];return r&&delete r[a],0!==i&&(FF(r)&&EB(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!iB(e[t]))return!1;return!0}(r))&&GB(e,n.slice(0,-1)),e}var KB=(e,t,n)=>(e[t]=n,e),JB=e=>{const t={};for(const n of Object.keys(e))if(jF(e[n])&&null!==e[n]&&!VF(e[n])){const r=JB(e[n]);for(const e of Object.keys(r))t[`${n}.${e}`]=r[e]}else t[n]=e[n];return t},$B=t.createContext(null);$B.displayName="HookFormContext";var eq=()=>t.useContext($B),tq=({children:e,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:l,trigger:c,formState:d,resetField:u,reset:h,resetDefaultValues:f,handleSubmit:p,unregister:m,control:g,register:v,setFocus:b,subscribe:y})=>{const x=t.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:l,trigger:c,formState:d,resetField:u,reset:h,resetDefaultValues:f,handleSubmit:p,unregister:m,control:g,register:v,setFocus:b,subscribe:y}),[o,g,d,i,r,p,v,h,f,u,a,b,s,l,y,c,m,n]);return t.createElement($B.Provider,{value:x},t.createElement(uB.Provider,{value:x.control},e))},nq=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function rq(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],a=t[r];if(i&&FF(i)&&a){const e=rq(i,a);FF(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var iq=e=>"select-multiple"===e.type,aq=e=>AB(e)&&e.isConnected;function oq(e){return Array.isArray(e)||FF(e)&&!(e=>{for(const t in e)if(cB(e[t]))return!0;return!1})(e)}function sq(e){return!(!e||!("_f"in e))}function lq(e){return Array.isArray(e)?!e.some(e=>!iB(e)):!Object.keys(e).length}function cq(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function dq(e,t={},n){for(const r in e){const i=e[r],a=n&&n[r];!oq(i)||Array.isArray(i)&&sq(a)?iB(i)||(t[r]=!0):(t[r]=Array.isArray(i)?[]:{},dq(i,t[r],a),lq(t[r])&&cq(t,r))}return t}function uq(e,t,n,r){n||(n=dq(t,{},r));for(const i in e){const a=e[i],o=r&&r[i];!oq(a)||Array.isArray(a)&&sq(o)?yB(a,t[i])?cq(n,i):n[i]=!0:(iB(t)||vB(n[i])?n[i]=dq(a,Array.isArray(a)?[]:{},o):uq(a,QF(t)?{}:t[i],n[i],o),lq(n[i])&&cq(n,i))}return n}var hq=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>iB(e)?e:t?""===e?NaN:e?+e:e:n&&mB(e)?new Date(e):r?r(e):e;function fq(e){const t=e.ref;return LF(t)?t.files:TB(t)?VB(e.refs).value:iq(t)?[...t.selectedOptions].map(({value:e})=>e):DF(t)?DB(e.refs).value:hq(iB(t.value)?e.ref.value:t.value,e)}var pq=e=>iB(e)?e:PB(e)?e.source:FF(e)?PB(e.value)?e.value.source:e.value:e,mq="AsyncFunction",gq=e=>{if(!e||!e.validate)return!1;if(cB(e.validate))return e.validate.constructor.name===mq;if(FF(e.validate))for(const t in e.validate)if(e.validate[t].constructor.name===mq)return!0;return!1};function vq(e,t,n){const r=sB(e,n);if(r||rB(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),a=sB(t,r),o=sB(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var bq={mode:_F,reValidateMode:YF,shouldFocusError:!0},yq="form",xq={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function wq(e={}){let t={...bq,...e},n={...WF(xq),isLoading:cB(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(FF(t.defaultValues)||FF(t.values))&&WF(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:WF(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:/* @__PURE__ */new Set,disabled:/* @__PURE__ */new Set,unMount:/* @__PURE__ */new Set,array:/* @__PURE__ */new Set,watch:/* @__PURE__ */new Set,registerName:/* @__PURE__ */new Set};const l={},c={};let d=0,u=SB(t.mode),h=SB(t.reValidateMode);const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={...f};let m={...p};const g={array:nq(),state:nq()};let v=0;const b=t.criteriaMode===GF,y=(e,t)=>n=>{clearTimeout(c[e]),c[e]=setTimeout(t,n)},x=async e=>{if(!o.keepIsValid&&!t.disabled&&(p.isValid||m.isValid||e)){const e=++v;let i;t.resolver?(i=EB((await z()).errors),e===v&&w()):i=await E({fields:r,onlyCheckValid:!0,eventType:"valid"}),e===v&&i!==n.isValid&&g.state.next({isValid:i})}},w=(e,r)=>{!t.disabled&&(p.isValidating||p.validatingFields||m.isValidating||m.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?dB(n.validatingFields,e,r):GB(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!EB(n.validatingFields)}))},O=()=>{n.dirtyFields=uq(i,a,void 0,r)},k=(e,t)=>{dB(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},S=(t,l,c,d)=>{const u=sB(r,t);if(u){if((e=>{const t=rB(e)?[e]:oB(e);let n=a,r=i;for(let i=0;i<t.length-1;i++){const e=t[i];if(n=QF(n)?n:n[e],r=QF(r)?r:r[e],null===n&&null!==r)return!0}return!1})(t))return;const r=iB(sB(a,t)),h=sB(a,t,iB(c)?sB(i,t):c);iB(h)||d&&d.defaultChecked||l?dB(a,t,l?h:fq(u._f)):P(t,h),o.mount&&!o.action&&(x(),r&&n.isDirty&&(p.isDirty||m.isDirty)&&(A()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!iB(sB(a,t))&&CB(t,s)&&(o.watch=!0))}},C=(e,o,s,l,c)=>{let d=!1,u=!1;const h={name:e};if(!t.disabled||!0===l){if(!s||l){const t=yB(sB(i,e),o);(p.isDirty||m.isDirty)&&(u=n.isDirty,n.isDirty=h.isDirty=!t||A(),d=u!==h.isDirty),u=!!sB(n.dirtyFields,e),t!==n.isDirty?((e,t)=>{for(const n in e)n in t||delete e[n];Object.assign(e,t)})(n.dirtyFields,uq(i,a,void 0,r)):t?GB(n.dirtyFields,e):dB(n.dirtyFields,e,!0),h.dirtyFields=n.dirtyFields,d=d||(p.dirtyFields||m.dirtyFields)&&u!==!t}if(s){const t=sB(n.touchedFields,e);t||(dB(n.touchedFields,e,s),h.touchedFields=n.touchedFields,d=d||(p.touchedFields||m.touchedFields)&&t!==s)}d&&c&&g.state.next(h)}return d?h:{}},z=async e=>(w(e,!0),await t.resolver(a,t.context,((e,t,n,r)=>{const i={};for(const a of e){const e=sB(t,a);e&&dB(i,a,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),N=async({name:t,eventType:r})=>{if(e.validate){const i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(FF(i))for(const e in i){const t=i[e];t&&F(`${yq}.${e}`,{message:mB(t.message)?t.message:"",type:t.type||$F})}else mB(i)||!i?F(yq,{message:i||"",type:$F}):j(yq);return i}return!0},E=async({fields:r,onlyCheckValid:i,name:o,eventType:l,context:c={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(c.runRootValidation=!0,!(await N({name:o,eventType:l}))&&(c.valid=!1,i)))return c.valid;for(const d in r){const o=r[d];if(o){const{_f:r,...u}=o;if(r){const l=s.array.has(r.name),d=o._f&&gq(o._f),u=p.validatingFields||p.isValidating||m.validatingFields||m.isValidating;d&&u&&w([r.name],!0);const h=await FB(o,s.disabled,a,b,t.shouldUseNativeValidation&&!i,l);if(d&&u&&w([r.name]),h[r.name]&&(c.valid=!1,i))break;if(!i&&(sB(h,r.name)?l?NB(n.errors,h,r.name):dB(n.errors,r.name,h[r.name]):GB(n.errors,r.name)),e.shouldUseNativeValidation&&h[r.name])break}!EB(u)&&await E({context:c,onlyCheckValid:i,fields:u,name:d,eventType:l})}}return c.valid},A=(e,t)=>(e&&t&&dB(a,e,t),!yB(o.mount?a:i,i)),T=(e,t,n)=>gB(e,s,{...o.mount?a:iB(t)?i:mB(e)?{[e]:t}:t},n,t),P=(e,t,n={},i=!1,o=!1)=>{const s=sB(r,e);let l=t;if(s){const n=s._f;n&&(!n.disabled&&dB(a,e,hq(t,n)),l=AB(n.ref)&&QF(t)?"":t,iq(n.ref)?[...n.ref.options].forEach(e=>e.selected=l.includes(e.value)):n.refs?DF(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(l)?e.checked=!!l.find(t=>t===e.value):e.checked=l===e.value||!!l)}):n.refs.forEach(e=>e.checked=e.value===l):LF(n.ref)?n.ref.value="":(n.ref.value=l,n.ref.type||o||g.state.next({name:e,values:i?a:WF(a)})))}(n.shouldDirty||n.shouldTouch)&&C(e,l,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&V(e,{delayError:n.delayError})},M=(e,t,n,i=!1,a=!1)=>{for(const o in t){if(!t.hasOwnProperty(o))return;const l=t[o],c=e+"."+o,d=sB(r,c);(s.array.has(e)||FF(l)||d&&!d._f)&&!VF(l)?M(c,l,n,i,a):P(c,l,n,i,a)}},I=(e,t,i,l,c=!1)=>{const d=sB(r,e),u=s.array.has(e),h=l?t:WF(t),f=yB(sB(a,e),h);if(f||dB(a,e,h),u)g.array.next({name:e,values:l?a:WF(a)}),(p.isDirty||p.dirtyFields||m.isDirty||m.dirtyFields)&&i.shouldDirty&&(O(),c||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:A(e,h)}));else{const t=Array.isArray(h)&&!h.length||EB(h);!d||d._f||QF(h)||t?P(e,h,i,l,c):M(e,h,i,l,c)}if(!f&&!c){const t=CB(e,s),r=l?a:WF(a);g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r})}},R=(e,t,n={})=>I(e,t,n,!1),D=async i=>{o.mount=!0;const f=i.target;let v=f.name,O=!0;const S=sB(r,v),A=e=>{O=Number.isNaN(e)||VF(e)&&isNaN(e.getTime())||yB(e,sB(a,v,e))};if(S){let o,P;const M=f.type?fq(S._f):BF(i),I=i.type===XF||"focusout"===i.type,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||e.validate||t.resolver||sB(n.errors,v)||S._f.deps),D=R||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(I,sB(n.touchedFields,v),n.isSubmitted,h,u),L=CB(v,s,I);if(dB(a,v,M),I){if(!f||!f.readOnly){S._f.onBlur&&S._f.onBlur(i);const e=l[v];e&&e(0)}}else S._f.onChange&&S._f.onChange(i);const Q=C(v,M,I),j=!EB(Q)||L;if(!I&&g.state.next({name:v,type:i.type,...d?{values:WF(a)}:{}}),D)return R&&n.isValid||!p.isValid&&!m.isValid||("onBlur"===t.mode?I&&x():I||x()),j&&g.state.next({name:v,...L?{}:Q});if(!t.resolver&&e.validate&&await N({name:v,eventType:i.type}),!I&&L&&g.state.next({...n}),t.resolver){const{errors:e}=await z([v]);if(w([v]),A(M),!O)return void(!EB(Q)&&g.state.next(Q));const t=vq(n.errors,r,v),i=vq(e,r,t.name||v);o=i.error,v=i.name,P=EB(e)}else w([v],!0),o=(await FB(S,s.disabled,a,b,t.shouldUseNativeValidation))[v],w([v]),A(M),O&&(o?P=!1:(p.isValid||m.isValid)&&(P=await E({fields:r,onlyCheckValid:!0,name:v,eventType:i.type})));O&&(S._f.deps&&(!Array.isArray(S._f.deps)||S._f.deps.length>0)&&V(S._f.deps),((e,r,i,a)=>{const o=sB(n.errors,e),s=(p.isValid||m.isValid)&&lB(r)&&n.isValid!==r;if(t.delayError&&i?(l[e]=y(e,()=>k(e,i)),l[e](t.delayError)):(clearTimeout(c[e]),delete l[e],i?dB(n.errors,e,i):GB(n.errors,e),n.errors={...n.errors}),(i?!yB(o,i):o)||!EB(a)||s){const t={...a,...s&&lB(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},g.state.next(t)}})(v,P,o,Q))}var T},L=(e,t)=>{if(sB(n.errors,t)&&e.focus)return e.focus(),1},V=async(e,i={})=>{let a,o;const d=BB(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await z(e);if(w(e),e){for(const r of e){const e=sB(t,r);e?s.array.has(r)&&FF(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?NB(n.errors,{[r]:e},r):dB(n.errors,r,e):GB(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t})(iB(e)?e:d);a=EB(t),o=e?!d.some(e=>sB(t,e)):a}else e?(o=(await Promise.all(d.map(async e=>{const t=sB(r,e);return await E({fields:t&&t._f?{[e]:t}:t,eventType:HF})}))).every(Boolean),(o||n.isValid)&&x()):o=a=await E({fields:r,name:e,eventType:HF});if(i.delayError&&t.delayError&&mB(e)){const r=sB(n.errors,e);r?(GB(n.errors,e),l[e]=y(e,()=>k(e,r)),l[e](t.delayError)):(clearTimeout(c[e]),delete l[e])}return g.state.next({...!mB(e)||(p.isValid||m.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&zB(r,L,e?d:s.mount),o},Q=(e,t)=>({invalid:!!sB((t||n).errors,e),isDirty:!!sB((t||n).dirtyFields,e),error:sB((t||n).errors,e),isValidating:!!sB(n.validatingFields,e),isTouched:!!sB((t||n).touchedFields,e)}),j=e=>{const t=e?BB(e):void 0;null==t||t.forEach(e=>GB(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):(n.errors={},g.state.next({errors:n.errors}))},F=(e,t,i)=>{const a=(sB(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:l,...c}=sB(n.errors,e)||{};dB(n.errors,e,{...c,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},B=e=>{var t;const r=!!(null===(t=e.formState)||void 0===t?void 0:t.values);r&&d++;const{unsubscribe:o}=g.state.subscribe({next:t=>{if(r=e.name,o=t.name,s=e.exact,(!r||!o||r===o||BB(r).some(e=>e&&(s?e===o||e.startsWith(o+"."):e.startsWith(o)||o.startsWith(e))))&&((e,t,n,r)=>{n(e);const{name:i,...a}=e,o=Object.keys(a);return!o.length||r&&o.length>=Object.keys(t).length||o.find(e=>t[e]===(!r||GF))})(t,e.formState||p,_,e.reRenderRoot)){const r={...a};e.callback({values:r,...n,...t,defaultValues:i})}var r,o,s}});if(!r)return o;let s=!1;return()=>{s||(s=!0,d--,o())}},q=(e,o={})=>{for(const l of e?BB(e):s.mount)s.mount.delete(l),s.array.delete(l),o.keepValue||(GB(r,l),GB(a,l)),!o.keepError&&GB(n.errors,l),!o.keepDirty&&GB(n.dirtyFields,l),!o.keepTouched&&GB(n.touchedFields,l),!o.keepIsValidating&&GB(n.validatingFields,l),!t.shouldUnregister&&!o.keepDefaultValue&&GB(i,l);g.state.next({values:WF(a)}),g.state.next({...n,...o.keepDirty?{isDirty:A()}:{}}),!o.keepIsValid&&x()},Z=({disabled:e,name:t})=>{if(lB(e)&&o.mount||e||s.disabled.has(t)){const n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&x()}},U=(e,n={})=>{let a=sB(r,e);const l=lB(n.disabled)||lB(t.disabled),c=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return dB(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!c?Z({disabled:lB(n.disabled)?n.disabled:t.disabled,name:e}):S(e,!0,n.value),{...l?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:pq(n.min),max:pq(n.max),minLength:pq(n.minLength),maxLength:pq(n.maxLength),pattern:pq(n.pattern)}:{},name:e,onChange:D,onBlur:D,ref:l=>{if(l){s.registerName.add(e),U(e,n),s.registerName.delete(e),a=sB(r,e);const t=iB(l.value)&&l.querySelectorAll&&l.querySelectorAll("input,select,textarea")[0]||l,o=(e=>TB(e)||DF(e))(t),c=a._f.refs||[];if(o?c.find(e=>e===t):t===a._f.ref)return;const d={...a._f};o?(d.refs=[...c.filter(aq),t,...Array.isArray(sB(i,e))?[{}]:[]],d.ref={type:t.type,name:e}):(d.ref=t,delete d.refs),dB(r,e,{_f:d}),S(e,!1,void 0,t)}else a=sB(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!qF(s.array,e)||!o.action)&&s.unMount.add(e)}}},W=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&zB(r,L,s.mount),X=(e,i)=>async o=>{let l;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let c=WF(a);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await z();w(),n.errors=e,c=WF(t)}else await E({fields:r,eventType:"submit"});if(s.disabled.size)for(const e of s.disabled)GB(c,e);if(GB(n.errors,eB),EB(n.errors)){g.state.next({errors:{}});try{await e(c,o)}catch(d){l=d}}else i&&await i({...n.errors},o),W(),setTimeout(W);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:EB(n.errors)&&!l,submitCount:n.submitCount+1,errors:n.errors}),l)throw l},H=(e,l={})=>{const c=e?WF(e):i,d=WF(c),u=EB(e),h=d,f=r;if(l.keepDefaultValues||(i=c),!l.keepValues){if(l.keepDirtyValues){const e=/* @__PURE__ */new Set([...s.mount,...Object.keys(uq(i,a,void 0,f))]);for(const t of Array.from(e)){const e=sB(n.dirtyFields,t),r=sB(a,t),i=sB(h,t);e&&!iB(r)?dB(h,t,r):e||iB(i)||R(t,i)}}else{if(UF&&iB(e))for(const e of s.mount){const t=sB(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(AB(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(l.keepFieldsRef)for(const e of s.mount)R(e,sB(h,e));else r={}}if(t.shouldUnregister){if(a=l.keepDefaultValues?WF(i):{},l.keepFieldsRef)for(const e of s.mount)dB(a,e,sB(h,e))}else a=WF(h);g.array.next({values:{...h}}),g.state.next({name:void 0,type:void 0,values:{...h}})}s={mount:l.keepDirtyValues?s.mount:/* @__PURE__ */new Set,unMount:/* @__PURE__ */new Set,array:/* @__PURE__ */new Set,registerName:/* @__PURE__ */new Set,disabled:/* @__PURE__ */new Set,watch:/* @__PURE__ */new Set,watchAll:!1,focus:""},o.mount=!p.isValid||!!l.keepIsValid||!!l.keepDirtyValues||!t.shouldUnregister&&!EB(h),o.watch=!!t.shouldUnregister,o.keepIsValid=!!l.keepIsValid,o.action=!1,l.keepErrors||(n.errors={}),g.state.next({submitCount:l.keepSubmitCount?n.submitCount:0,isDirty:!u&&(l.keepDirty?n.isDirty:l.keepValues?A():!(!l.keepDefaultValues||yB(e,i))),isSubmitted:!!l.keepIsSubmitted&&n.isSubmitted,dirtyFields:u?{}:l.keepDirtyValues?l.keepDefaultValues&&a?uq(i,a,void 0,f):n.dirtyFields:l.keepDefaultValues&&e?uq(i,e,void 0,f):l.keepDirty?n.dirtyFields:{},touchedFields:l.keepTouched?n.touchedFields:{},errors:l.keepErrors?n.errors:{},isSubmitSuccessful:!!l.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:i})},Y=(e,n)=>H(cB(e)?e(a):e,{...t.resetOptions,...n}),_=e=>{const{name:t,type:r,values:i,...a}=e;n={...n,...a}},G={control:{register:U,unregister:q,getFieldState:Q,handleSubmit:X,setError:F,_subscribe:B,_runSchema:z,_updateIsValidating:w,_focusError:W,_getWatch:T,_getDirty:A,_setValid:x,_setFieldArray:(e,i=[],s,l,c=!0,d=!0)=>{if(l&&s&&!t.disabled){if(o.action=!0,d&&Array.isArray(sB(r,e))){const t=s(sB(r,e),l.argA,l.argB);c&&dB(r,e,t)}if(d&&Array.isArray(sB(n.errors,e))){const t=s(sB(n.errors,e),l.argA,l.argB);c&&dB(n.errors,e,t),((e,t)=>{!HB(sB(e,t)).length&&GB(e,t)})(n.errors,e)}if((p.touchedFields||m.touchedFields)&&d&&Array.isArray(sB(n.touchedFields,e))){const t=s(sB(n.touchedFields,e),l.argA,l.argB);c&&dB(n.touchedFields,e,t)}(p.dirtyFields||m.dirtyFields)&&O(),g.state.next({name:e,isDirty:A(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else dB(a,e,i)},_setDisabledField:Z,_setErrors:e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>HB(sB(o.mount?a:i,e,t.shouldUnregister?sB(i,e,[]):[])),_reset:H,_resetDefaultValues:()=>cB(t.defaultValues)&&t.defaultValues().then(e=>{Y(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of s.unMount){const t=sB(r,e);t&&(t._f.refs?t._f.refs.every(e=>!aq(e)):!aq(t._f.ref))&&q(e)}s.unMount=/* @__PURE__ */new Set},_disableForm:e=>{lB(e)&&(g.state.next({disabled:e}),zB(r,(t,n)=>{const i=sB(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},_subjects:g,_proxyFormState:p,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},u=SB(t.mode),h=SB(t.reValidateMode)}},subscribe:e=>(o.mount=!0,m={...m,...e.formState},B({...e,formState:{...f,...e.formState}})),trigger:V,register:U,handleSubmit:X,watch:(e,t)=>{if(cB(e)){d++;const{unsubscribe:n}=g.state.subscribe({next:n=>"values"in n&&e(n.values||T(void 0,t),n)});let r=!1;return{unsubscribe:()=>{r||(r=!0,d--,n())}}}return T(e,t,!0)},setValue:R,setValues:(e,t={})=>{const r=cB(e)?e(a):e;if(!yB(a,r)){a={...a,...r};const e=JB(r);for(const n of s.mount)n in e&&I(n,e[n],t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...d?{values:a}:{}}),t.shouldValidate&&x()}},getValues:(e,t)=>{let r={...o.mount?a:i};return t&&(r=rq(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),iB(e)?r:mB(e)?sB(r,e):e.map(e=>sB(r,e))},reset:Y,resetField:(e,t={})=>{sB(r,e)&&(iB(t.defaultValue)?R(e,WF(sB(i,e))):(R(e,t.defaultValue),dB(i,e,WF(t.defaultValue))),t.keepTouched||GB(n.touchedFields,e),t.keepDirty||(GB(n.dirtyFields,e),n.isDirty=t.defaultValue?A(e,WF(sB(i,e))):A()),t.keepError||(GB(n.errors,e),p.isValid&&x()),g.state.next({...n}))},resetDefaultValues:(e,t={})=>{if(i=WF(e),!t.keepDirty){const e=uq(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!EB(e)}t.keepIsValid||x(),g.state.next({...n,defaultValues:i})},clearErrors:j,unregister:q,setError:F,setFocus:(e,t={})=>{const n=sB(r,e),i=n&&n._f;if(i){const e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&cB(e.select)&&e.select()})}},getFieldState:Q};return{...G,formControl:G}}function Oq(e={}){const n=t.useRef(void 0),r=t.useRef(void 0),i=t.useRef(e.formControl),[a,o]=t.useState(()=>({...WF(xq),isLoading:cB(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:cB(e.defaultValues)?void 0:e.defaultValues}));if(!n.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!cB(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...r}=wq(e);n.current={...r,formState:a}}const s=n.current.control;return s._options=e,pB(()=>{const e=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState,defaultValues:s._defaultValues}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),t.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),t.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),t.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),t.useEffect(()=>{if(s._proxyFormState.isDirty){const e=s._getDirty();e!==a.isDirty&&s._subjects.state.next({isDirty:e})}},[s,a.isDirty]),t.useEffect(()=>{var t;e.values&&!yB(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),(null===(t=s._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||s._setValid(),r.current=e.values,o(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),t.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),n.current.formState=t.useMemo(()=>fB(a,s),[s,a]),n.current}var kq,Sq=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
87
87
  return P(Lj,{...e,ref:t,value:n,name:a,error:o?.message,onChange:s})},[e,r]);/* @__PURE__ */
88
- return P(xB,{control:e.control??t,name:e.name,render:i})},Cq=({control:e,when:t,is:n,children:r})=>{let{control:i}=eq(),a=yB({control:e||i,name:t});return k(()=>"function"==typeof n?n(a):Array.isArray(n)?n.includes(a):a===n,[a,n])?r:void 0},zq=e=>{let{control:t}=eq(),n=Og(e.render,"soft");/* @__PURE__ */
89
- return P(xB,{control:e.control??t,name:e.name,render:n})},Nq={root:we("flex flex-col",{variants:{intent:{primary:"",custom:""},disabled:{true:"opacity-60 pointer-events-none",false:""},size:{md:"gap-1.5",sm:"gap-1 text-sm",xs:"gap-1 text-xs",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}}),inputContainer:we("flex items-center border relative transition-colors duration-150 focus-within:ring-2 focus-within:ring-offset-0",{variants:{intent:{primary:"bg-white text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",custom:""},error:{true:"border-red-500 focus-within:ring-red-500/30",false:"border-gray-300 dark:border-zinc-700 focus-within:ring-primary-500/30 dark:focus-within:ring-primary-400/30 hover:border-gray-400 dark:hover:border-zinc-500"},disabled:{true:"cursor-not-allowed opacity-60 pointer-events-none",false:""},size:{md:"py-2 px-3 gap-2 rounded-lg",sm:"py-1.5 px-2.5 gap-1.5 rounded",xs:"py-1 px-2 gap-1 rounded-sm",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",error:!1,disabled:!1,size:"md"}}),input:we("p-0 border-0 outline-none focus:ring-0 w-full bg-transparent",{variants:{intent:{primary:"text-zinc-900 placeholder:text-zinc-400 dark:text-zinc-200 dark:placeholder:text-zinc-500"},error:{true:"",false:""},disabled:{true:"cursor-not-allowed",false:""},size:{md:"text-sm",sm:"text-sm",xs:"text-xs",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md",disabled:!1,error:!1}}),label:we("text-sm font-medium text-zinc-700 dark:text-zinc-300",{variants:{inline:{true:"flex select-none items-center",false:""},disabled:{true:"",false:""},size:{md:"",sm:"text-sm",xs:"text-xs",custom:""}},compoundVariants:[{inline:!0,disabled:!0,className:"cursor-not-allowed"},{inline:!0,disabled:!1,className:"cursor-pointer"},{inline:!0,size:"md",className:"gap-2"},{inline:!0,size:"sm",className:"gap-1.5"},{inline:!0,size:"xs",className:"gap-1"}],defaultVariants:{inline:!1,disabled:!1,size:"md"}}),iconFloatingContainer:we("flex items-center justify-center",{variants:{intent:{primary:""},size:{md:"gap-2",sm:"gap-1.5",xs:"gap-1",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}}),icon:we("border-r border-gray-300 dark:border-zinc-700 text-zinc-400 dark:text-zinc-500 shrink-0",{variants:{intent:{primary:""},error:{true:"text-red-500 dark:text-red-400",false:""},size:{md:"pr-2.5 mr-0.5",sm:"pr-2 mr-0.5",xs:"pr-1.5 mr-0.5",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}}),iconError:we("",{variants:{intent:{primary:""},error:{true:"text-red-500 dark:text-red-400",false:""}},compoundVariants:[],defaultVariants:{intent:"primary"}}),iconClear:we("cursor-pointer text-zinc-400 dark:text-zinc-500 hover:text-zinc-600 dark:hover:text-zinc-300 transition-colors duration-150"),iconLoading:we("text-zinc-400 dark:text-zinc-500")},Eq=Object.assign(p(({ref:e,children:t,className:n="",id:r,label:i="",placeholder:a="",loading:o=!1,disabled:s=!1,clearable:l=!1,inline:c=!1,prefix:d="",type:u="text",size:h,intent:f="primary",value:p="",error:m=!1,containerProps:v,onChange:b,...y})=>{let x=Zv("Input",{className:n&&"object"==typeof n?n.input:"",componentKey:"input",variants:{intent:f,size:h,disabled:s||o,error:!!m,inline:c}}),w=g(e=>b?.(e.target.value),[b]);/* @__PURE__ */
88
+ return P(wB,{control:e.control??t,name:e.name,render:i})},Cq=({control:e,when:t,is:n,children:r})=>{let{control:i}=eq(),a=xB({control:e||i,name:t});return k(()=>"function"==typeof n?n(a):Array.isArray(n)?n.includes(a):a===n,[a,n])?r:void 0},zq=e=>{let{control:t}=eq(),n=Og(e.render,"soft");/* @__PURE__ */
89
+ return P(wB,{control:e.control??t,name:e.name,render:n})},Nq={root:we("flex flex-col",{variants:{intent:{primary:"",custom:""},disabled:{true:"opacity-60 pointer-events-none",false:""},size:{md:"gap-1.5",sm:"gap-1 text-sm",xs:"gap-1 text-xs",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}}),inputContainer:we("flex items-center border relative transition-colors duration-150 focus-within:ring-2 focus-within:ring-offset-0",{variants:{intent:{primary:"bg-white text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",custom:""},error:{true:"border-red-500 focus-within:ring-red-500/30",false:"border-gray-300 dark:border-zinc-700 focus-within:ring-primary-500/30 dark:focus-within:ring-primary-400/30 hover:border-gray-400 dark:hover:border-zinc-500"},disabled:{true:"cursor-not-allowed opacity-60 pointer-events-none",false:""},size:{md:"py-2 px-3 gap-2 rounded-lg",sm:"py-1.5 px-2.5 gap-1.5 rounded",xs:"py-1 px-2 gap-1 rounded-sm",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",error:!1,disabled:!1,size:"md"}}),input:we("p-0 border-0 outline-none focus:ring-0 w-full bg-transparent",{variants:{intent:{primary:"text-zinc-900 placeholder:text-zinc-400 dark:text-zinc-200 dark:placeholder:text-zinc-500"},error:{true:"",false:""},disabled:{true:"cursor-not-allowed",false:""},size:{md:"text-sm",sm:"text-sm",xs:"text-xs",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md",disabled:!1,error:!1}}),label:we("text-sm font-medium text-zinc-700 dark:text-zinc-300",{variants:{inline:{true:"flex select-none items-center",false:""},disabled:{true:"",false:""},size:{md:"",sm:"text-sm",xs:"text-xs",custom:""}},compoundVariants:[{inline:!0,disabled:!0,className:"cursor-not-allowed"},{inline:!0,disabled:!1,className:"cursor-pointer"},{inline:!0,size:"md",className:"gap-2"},{inline:!0,size:"sm",className:"gap-1.5"},{inline:!0,size:"xs",className:"gap-1"}],defaultVariants:{inline:!1,disabled:!1,size:"md"}}),iconFloatingContainer:we("flex items-center justify-center",{variants:{intent:{primary:""},size:{md:"gap-2",sm:"gap-1.5",xs:"gap-1",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}}),icon:we("border-r border-gray-300 dark:border-zinc-700 text-zinc-400 dark:text-zinc-500 shrink-0",{variants:{intent:{primary:""},error:{true:"text-red-500 dark:text-red-400",false:""},size:{md:"pr-2.5 mr-0.5",sm:"pr-2 mr-0.5",xs:"pr-1.5 mr-0.5",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}}),iconError:we("",{variants:{intent:{primary:""},error:{true:"text-red-500 dark:text-red-400",false:""}},compoundVariants:[],defaultVariants:{intent:"primary"}}),iconClear:we("cursor-pointer text-zinc-400 dark:text-zinc-500 hover:text-zinc-600 dark:hover:text-zinc-300 transition-colors duration-150"),iconLoading:we("text-zinc-400 dark:text-zinc-500")},Eq=Object.assign(p(({ref:e,children:t,className:n="",id:r,label:i="",placeholder:a="",loading:o=!1,disabled:s=!1,clearable:l=!1,inline:c=!1,prefix:d="",type:u="text",size:h,intent:f="primary",value:p="",error:m=!1,containerProps:v,onChange:b,...y})=>{let x=Zv("Input",{className:n&&"object"==typeof n?n.input:"",componentKey:"input",variants:{intent:f,size:h,disabled:s||o,error:!!m,inline:c}}),w=g(e=>b?.(e.target.value),[b]);/* @__PURE__ */
90
90
  return M(Tb,{className:n,id:r,label:i,loading:o,clearable:l,value:p,prefix:d,disabled:s,error:m,intent:f,size:h,onClear:g(()=>b?.(""),[b]),...v,children:[t,/* @__PURE__ */P("input",{ref:e,id:r,type:u,placeholder:a,className:x,disabled:s||o,value:p,onChange:w,...y})]})}),{Icon:Yv}),Aq=Eq,Tq={input:we("py-0 pl-0 border-0 outline-none focus:ring-0 w-full truncate",{variants:{intent:{primary:"bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-200",custom:""},error:{true:"",false:""},disabled:{true:"cursor-not-allowed",false:""},size:{md:"text-base pr-8 bg-size-[1.75rem_1.75rem] bg-position-[right_0rem_center]",sm:"text-sm pr-6 bg-size-[1.5rem_1.5rem] bg-position-[right_0rem_center]",xs:"text-xs pr-4 bg-size-[1.25rem_1.25rem] bg-position-[right_0rem_center]",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md",error:!1,disabled:!1}})},Pq=({children:e,value:t})=>/* @__PURE__ */P("option",{value:t,children:e}),Mq=Object.assign(p(({ref:e,children:t,id:r,label:i="",placeholder:a="",value:o="",className:l="",error:c="",size:d,intent:u,loading:f=!1,disabled:p=!1,clearable:m=!1,onChange:v,...b})=>{let y=Zv("Select",{className:l&&"object"==typeof l?l.input:"",componentKey:"input",variants:{intent:u,size:d,error:!!c,disabled:p}}),x=g(e=>v?.(e.target.value),[v]),w=g(()=>v?.(""),[v]),{optionsChildren:O,othersChildren:S}=k(()=>{let e={optionsChildren:[],othersChildren:[]};return n.forEach(t,(t,n)=>{h(t)&&(t.type===Pq||"option"===t.type||"optgroup"===t.type?e.optionsChildren.push(s(t,{...t.props,key:n})):e.othersChildren.push(t))}),e},[t]);/* @__PURE__ */
91
91
  return M(Tb,{className:l,id:r,label:i,error:c,disabled:p,intent:u,size:d,loading:f,clearable:m,value:o,onClear:w,children:[S,/* @__PURE__ */M("select",{ref:e,className:y,id:r,disabled:p||f,value:o,onChange:x,...b,children:[a&&/* @__PURE__ */P("option",{value:"",children:a},"select-placeholder"),O]})]})}),{Icon:Yv,Option:Pq}),Iq=Mq,Rq={root:we("flex flex-col",{variants:{size:{md:"gap-1.5",sm:"gap-1 text-sm",xs:"gap-1 text-xs",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),inputContainer:we("flex items-center relative",{variants:{size:{md:"",sm:"",xs:"",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),trigger:we("w-full"),placeholder:we("text-zinc-400 dark:text-zinc-500 select-none"),value:we("text-zinc-700 dark:text-zinc-300"),searchInput:we(""),list:we("max-h-60 overflow-y-auto"),listPopup:we("flex flex-col w-full",{variants:{size:{md:"p-1.5 gap-2",sm:"p-1 gap-1.5",xs:"p-1 gap-1",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),listPopupInner:we("flex flex-col w-full",{variants:{size:{md:"gap-2",sm:"gap-1.5",xs:"gap-1",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),listMessage:we("text-zinc-400 dark:text-zinc-500 flex items-center justify-center shrink-0",{variants:{size:{md:"py-2",sm:"py-1.5 text-sm",xs:"py-1 text-xs",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),listGroup:we("[&:not(:last-child)]:border-b [&:not(:last-child)]:border-gray-200 dark:[&:not(:last-child)]:border-zinc-700",{variants:{size:{md:"[&:not(:last-child)]:pb-1.5 not-last:mb-1.5",sm:"[&:not(:last-child)]:pb-1 not-last:mb-1",xs:"[&:not(:last-child)]:pb-1 not-last:mb-1",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),listGroupLabel:we("flex items-center cursor-default select-none truncate text-xs font-semibold uppercase tracking-wide text-zinc-400 dark:text-zinc-500",{variants:{disabled:{true:"text-zinc-300 dark:text-zinc-600 opacity-50",false:""},size:{md:"px-2.5 py-1.5 gap-2",sm:"px-2 py-1 gap-1.5",xs:"px-1.5 py-1 gap-1",custom:""}},compoundVariants:[],defaultVariants:{size:"md",disabled:!1}}),listItem:we("group flex items-center justify-between shrink-0 transition-colors duration-100 cursor-pointer select-none rounded-md",{variants:{selected:{true:"bg-primary-50 text-primary-600 dark:bg-primary-900/30 dark:text-primary-400",false:"text-zinc-700 hover:bg-gray-100 dark:text-zinc-300 dark:hover:bg-zinc-700/60"},disabled:{true:"text-zinc-300 dark:text-zinc-600 cursor-not-allowed hover:bg-transparent dark:hover:bg-transparent",false:""},size:{md:"px-2.5 py-2 gap-2 text-sm",sm:"px-2 py-1.5 gap-1.5 text-sm",xs:"px-1.5 py-1 gap-1 text-xs",custom:""}},compoundVariants:[{disabled:!0,selected:!0,className:"text-zinc-300 dark:text-zinc-600 bg-transparent dark:bg-transparent"}],defaultVariants:{size:"md",selected:!1,disabled:!1}}),listItemLabelContainer:we("flex items-center min-w-0 truncate",{variants:{size:{md:"gap-2",sm:"gap-1.5",xs:"gap-1",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),listItemIcon:we("invisible group-hover:visible shrink-0 text-primary-ui")},Dq=e=>!!e&&"object"==typeof e&&"options"in e,Lq=({className:e="",label:t="",icon:n,value:r="",prefix:i="",suffix:a="",option:o,isSelected:s=!1,disabled:l=!1,allowRemoveOptions:c=!1,size:d,onChange:u,onRemove:h})=>{let f=Zv("Select2",{className:e,componentKey:["listItem","listItemLabelContainer","listItemIcon"],variants:{size:d,selected:s,disabled:l}}),p=g(e=>{l&&(e.stopPropagation(),e.preventDefault())},[l]),m=g(e=>{if(e.stopPropagation(),e.preventDefault(),!l){if(o)return void u?.(o);u?.({label:t,value:r})}},[l,o,u,t,r]),v=g(e=>{e.stopPropagation(),e.preventDefault(),o&&h?.(o)},[h,o]),b=k(()=>{let e=[];return i&&e.push(i),t&&e.push(t),a&&e.push(a),e.join(" ")},[t,i,a]);/* @__PURE__ */
92
92
  return M("div",{"data-value":r,className:ge("select2__list-item",f.listItem),onMouseDown:p,onClick:m,children:[/* @__PURE__ */M("div",{className:f.listItemLabelContainer,children:[n,b]}),c&&/* @__PURE__ */P(Yv,{className:f.listItemIcon,intent:"danger",icon:"fa-solid fa-circle-xmark",title:"Remove",onClick:v})]})},Vq=({className:e="",size:t="md",placeholder:n="",value:r="",disabled:i=!1,autoFocus:a=!0,allowCreateOptions:o=!1,onChange:s,onSelect:l})=>{e=Zv("Select2",{className:e,componentKey:"searchInput",variants:{size:t}});let c=C(void 0);y(()=>{a&&c.current.focus()},[a]);let d=g(e=>{e.stopPropagation(),e.preventDefault()},[]),u=k(()=>({onClick:d}),[d]),h=g(e=>s?.(e),[s]),f=g(e=>{"Enter"===e.key&&o?l?.({value:e.target.value,label:e.target.value}):"Enter"!==e.key||o?"Escape"===e.key&&s?.(""):(e.stopPropagation(),e.preventDefault())},[s,l,o]);/* @__PURE__ */
@@ -97,19 +97,19 @@ return M(sQ,{ref:D,containerTopOffset:u?-26:4,containerLeftOffset:0,onOpenChange
97
97
  return M(Tb,{className:k(()=>ce(f,["switch","slide"]),[f]),id:n,label:a,error:d,disabled:o,intent:"custom",size:c,loading:s,inline:!0,value:i,children:[t,/* @__PURE__ */M("div",{className:ge("switch",f.switch),children:[/* @__PURE__ */P("input",{...h,id:n,type:"checkbox",ref:e,value:i,readOnly:!u||h.readOnly,onChange:u,className:f.input,disabled:o}),/* @__PURE__ */P("span",{className:ge("slider",f.slider)})]})]})}),Wq=Uq,Xq={input:we("p-0 border-0 outline-none focus:ring-0 w-full bg-transparent text-zinc-900 placeholder:text-zinc-400 dark:text-zinc-200 dark:placeholder:text-zinc-500",{variants:{intent:{primary:"",custom:""},disabled:{true:"cursor-not-allowed",false:""},error:{true:"",false:""},size:{md:"",sm:"text-sm",xs:"text-xs",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md",disabled:!1,error:!1}}),iconFloatingContainer:we("",{variants:{error:{true:"items-start!",false:""},size:{md:"py-1.5",sm:"py-1",xs:"py-0.5",custom:""}},compoundVariants:[],defaultVariants:{size:"md",error:!1}}),inputContainer:we("",{variants:{error:{true:"items-start!",false:""}},compoundVariants:[],defaultVariants:{error:!1}})},Hq=Object.assign(p(({ref:e,className:t="",id:n,children:r,label:i="",placeholder:a="",loading:o=!1,disabled:s=!1,clearable:l=!1,size:c,intent:d,value:u="",error:h="",onChange:f,...p})=>{let m=Zv("TextArea",{className:t,componentKey:["root","inputContainer","iconFloatingContainer","icon","iconError","iconClear","input"],variants:{intent:d,size:c,disabled:s,error:!!h}}),v=k(()=>ce(m,["input"]),[m]),b=g(e=>{f?.(e.target.value)},[f]);/* @__PURE__ */
98
98
  return M(Tb,{className:v,id:n,label:i,error:h,disabled:s,intent:d,size:c,loading:o,clearable:l,value:u,onClear:g(()=>f?.(""),[f]),children:[r,/* @__PURE__ */P("textarea",{ref:e,id:n,placeholder:a,className:m.input,disabled:s,value:u,onChange:b,...p})]})}),{Icon:Yv}),Yq=Hq,_q=Object.defineProperty,Gq=(e,t)=>{let n={};for(var r in e)_q(n,r,{get:e[r],enumerable:!0});return t||_q(n,Symbol.toStringTag,{value:"Module"}),n},Kq=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
99
99
  return P(Ib,{...e,ref:t,value:n,name:a,error:o?.message,onChange:s})},[e,r]);/* @__PURE__ */
100
- return P(xB,{control:e.control??t,name:e.name,render:i})},Jq=e=>{let{control:t,setError:n,clearErrors:r}=eq(),{multiple:i,name:a,onChange:o}=e,s=g(e=>t=>{e(t),o?.(t),a&&r(a)},[r,i,a,o]),l=g(t=>{t&&n(e.name,{type:"custom",message:t})},[e.name,n]),c=k(()=>function({field:{ref:t,value:n,onChange:r,name:i},fieldState:{error:a}}){let o=k(()=>s(r),[r,s]);/* @__PURE__ */
100
+ return P(wB,{control:e.control??t,name:e.name,render:i})},Jq=e=>{let{control:t,setError:n,clearErrors:r}=eq(),{multiple:i,name:a,onChange:o}=e,s=g(e=>t=>{e(t),o?.(t),a&&r(a)},[r,i,a,o]),l=g(t=>{t&&n(e.name,{type:"custom",message:t})},[e.name,n]),c=k(()=>function({field:{ref:t,value:n,onChange:r,name:i},fieldState:{error:a}}){let o=k(()=>s(r),[r,s]);/* @__PURE__ */
101
101
  return P(RF,{...e,ref:t,value:n,name:i,error:a?.message,onChange:o,onError:l})},[e,s,l]);/* @__PURE__ */
102
- return P(xB,{control:e.control??t,name:e.name,render:c})},$q=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
102
+ return P(wB,{control:e.control??t,name:e.name,render:c})},$q=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
103
103
  return P(Aq,{...e,ref:t,value:n,name:a,error:o?.message,onChange:s})},[e,r]);/* @__PURE__ */
104
- return P(xB,{control:e.control??t,name:e.name,render:i})},eZ=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
104
+ return P(wB,{control:e.control??t,name:e.name,render:i})},eZ=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
105
105
  return P(Iq,{...e,ref:t,value:n,name:a,error:o?.message,onChange:s})},[e,r]);/* @__PURE__ */
106
- return P(xB,{control:e.control??t,name:e.name,render:i})},tZ=e=>{let{control:t}=eq(),{valueAsString:n,onChange:r}=e,i=g(e=>t=>{e(t),r?.(t)},[n,r]),a=k(()=>function({field:{ref:t,value:n,onChange:r,name:a},fieldState:{error:o}}){let s=k(()=>i(r),[r,i]);/* @__PURE__ */
106
+ return P(wB,{control:e.control??t,name:e.name,render:i})},tZ=e=>{let{control:t}=eq(),{valueAsString:n,onChange:r}=e,i=g(e=>t=>{e(t),r?.(t)},[n,r]),a=k(()=>function({field:{ref:t,value:n,onChange:r,name:a},fieldState:{error:o}}){let s=k(()=>i(r),[r,i]);/* @__PURE__ */
107
107
  return P(qq,{...e,ref:t,value:n,name:a,error:o?.message,onChange:s})},[e,i]);/* @__PURE__ */
108
- return P(xB,{control:e.control??t,name:e.name,render:a})},nZ=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t.target.checked),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
108
+ return P(wB,{control:e.control??t,name:e.name,render:a})},nZ=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t.target.checked),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
109
109
  return P(Wq,{...e,ref:t,value:n,name:a,error:o?.message,onChange:s})},[e,r]);/* @__PURE__ */
110
- return P(xB,{control:e.control??t,name:e.name,render:i})},rZ=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
110
+ return P(wB,{control:e.control??t,name:e.name,render:i})},rZ=e=>{let{control:t}=eq(),{onChange:n}=e,r=g(e=>t=>{e(t),n?.(t)},[n]),i=k(()=>function({field:{ref:t,value:n,onChange:i,name:a},fieldState:{error:o}}){let s=k(()=>r(i),[i,r]);/* @__PURE__ */
111
111
  return P(Yq,{...e,ref:t,value:n,name:a,error:o?.message,onChange:s})},[e,r]);/* @__PURE__ */
112
- return P(xB,{control:e.control??t,name:e.name,render:i})},iZ=/* @__PURE__ */Gq({Checkbox:()=>Kq,Color:()=>Sq,Conditional:()=>Cq,Custom:()=>zq,FileUpload:()=>Jq,Input:()=>$q,Select:()=>eZ,Select2:()=>tZ,Switch:()=>nZ,TextArea:()=>rZ}),aZ={root:we("flex flex-col"),header:we("w-full border-b border-gray-200 dark:border-zinc-700 pb-4 mb-4"),body:we("w-full flex flex-col gap-4",{variants:{scrollable:{true:"grow basis-0 overflow-y-auto",false:""}},compoundVariants:[],defaultVariants:{scrollable:!1}}),footer:we("w-full border-t border-gray-200 dark:border-zinc-700 pt-4 mt-4")},oZ=(e,t,n)=>{if(e&&"reportValidity"in e){const r=oB(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},sZ=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?oZ(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>oZ(t,n,e))}},lZ=(e,t)=>{t.shouldUseNativeValidation&&sZ(e,t);const n={};for(const r in e){const i=oB(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(cZ(t.names||Object.keys(e),r)){const e=Object.assign({},oB(n,r));cB(e,"root",a),cB(n,r,e)}else cB(n,r,a)}return n},cZ=(e,t)=>{const n=dZ(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(e=>dZ(e).match(`^${n}\\.\\d+`))};function dZ(e){return e.replace(/[\[\]]/g,"")}function uZ(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:/* @__PURE__ */new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){const t=a[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class a extends i{}function o(e){var t;const i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var hZ=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},fZ=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(kq=globalThis).__zod_globalConfig??(kq.__zod_globalConfig={});var pZ=globalThis.__zod_globalConfig;function mZ(e){return e&&Object.assign(pZ,e),pZ}function gZ(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function vZ(e,t){return"bigint"==typeof t?t.toString():t}function bZ(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function yZ(e){return null==e}function xZ(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var wZ=/* @__PURE__*/Symbol("evaluating");function OZ(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==wZ)return void 0===r&&(r=wZ,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function kZ(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function SZ(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function CZ(e){return JSON.stringify(e)}var zZ="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function NZ(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var EZ=/* @__PURE__*/bZ(()=>{if(pZ.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Eme){return!1}});function AZ(e){if(!1===NZ(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==NZ(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function TZ(e){return AZ(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var PZ=/* @__PURE__*/new Set(["string","number","symbol"]);function MZ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function IZ(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function RZ(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}var DZ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function LZ(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function VZ(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function QZ(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function jZ(e){return"string"==typeof e?e:e?.message}function FZ(e,t,n){const r=e.message?e.message:jZ(e.inst?._zod.def?.error?.(e))??jZ(t?.error?.(e))??jZ(n.customError?.(e))??jZ(n.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=r,t?.reportInput&&(s.input=o),s}function BZ(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function qZ(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}var ZZ=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vZ,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},UZ=uZ("$ZodError",ZZ),WZ=uZ("$ZodError",ZZ,{Parent:Error}),XZ=e=>(t,n,r,i)=>{const a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new hZ;if(o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>FZ(e,a,mZ())));throw zZ(t,i?.callee),t}return o.value},HZ=/* @__PURE__*/XZ(WZ),YZ=e=>async(t,n,r,i)=>{const a=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>FZ(e,a,mZ())));throw zZ(t,i?.callee),t}return o.value},_Z=/* @__PURE__*/YZ(WZ),GZ=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new hZ;return a.issues.length?{success:!1,error:new(e??UZ)(a.issues.map(e=>FZ(e,i,mZ())))}:{success:!0,data:a.value}},KZ=/* @__PURE__*/GZ(WZ),JZ=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>FZ(e,i,mZ())))}:{success:!0,data:a.value}},$Z=/* @__PURE__*/JZ(WZ),eU=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return XZ(e)(t,n,i)},tU=e=>(t,n,r)=>XZ(e)(t,n,r),nU=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return YZ(e)(t,n,i)},rU=e=>async(t,n,r)=>YZ(e)(t,n,r),iU=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return GZ(e)(t,n,i)},aU=e=>(t,n,r)=>GZ(e)(t,n,r),oU=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return JZ(e)(t,n,i)},sU=e=>async(t,n,r)=>JZ(e)(t,n,r),lU=/^[cC][0-9a-z]{6,}$/,cU=/^[0-9a-z]+$/,dU=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uU=/^[0-9a-vA-V]{20}$/,hU=/^[A-Za-z0-9]{27}$/,fU=/^[a-zA-Z0-9_-]{21}$/,pU=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mU=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gU=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,vU=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bU=/^(?:(?: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])$/,yU=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,xU=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,wU=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,OU=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kU=/^[A-Za-z0-9_-]*$/,SU=/^https?$/,CU=/^\+[1-9]\d{6,14}$/,zU="(?:(?:\\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])))",NU=/*@__PURE__*/new RegExp(`^${zU}$`);function EU(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}var AU=/^-?\d+$/,TU=/^-?\d+(?:\.\d+)?$/,PU=/^(?:true|false)$/i,MU=/^[^A-Z]*$/,IU=/^[^a-z]*$/,RU=/*@__PURE__*/uZ("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),DU={number:"number",bigint:"bigint",object:"date"},LU=/*@__PURE__*/uZ("$ZodCheckLessThan",(e,t)=>{RU.init(e,t);const n=DU[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),VU=/*@__PURE__*/uZ("$ZodCheckGreaterThan",(e,t)=>{RU.init(e,t);const n=DU[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),QU=/*@__PURE__*/uZ("$ZodCheckMultipleOf",(e,t)=>{RU.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value!==BigInt(0):0!==function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))&&n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),jU=/*@__PURE__*/uZ("$ZodCheckNumberFormat",(e,t)=>{RU.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,a]=DZ[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=AU)}),e._zod.check=o=>{const s=o.value;if(n){if(!Number.isInteger(s))return void o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),FU=/*@__PURE__*/uZ("$ZodCheckMaxLength",(e,t)=>{var n;RU.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!yZ(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=BZ(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),BU=/*@__PURE__*/uZ("$ZodCheckMinLength",(e,t)=>{var n;RU.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!yZ(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=BZ(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qU=/*@__PURE__*/uZ("$ZodCheckLengthEquals",(e,t)=>{var n;RU.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!yZ(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const a=BZ(r),o=i>t.length;n.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ZU=/*@__PURE__*/uZ("$ZodCheckStringFormat",(e,t)=>{var n,r;RU.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=/* @__PURE__ */new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),UU=/*@__PURE__*/uZ("$ZodCheckRegex",(e,t)=>{ZU.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),WU=/*@__PURE__*/uZ("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=MU),ZU.init(e,t)}),XU=/*@__PURE__*/uZ("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=IU),ZU.init(e,t)}),HU=/*@__PURE__*/uZ("$ZodCheckIncludes",(e,t)=>{RU.init(e,t);const n=MZ(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),YU=/*@__PURE__*/uZ("$ZodCheckStartsWith",(e,t)=>{RU.init(e,t);const n=new RegExp(`^${MZ(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),_U=/*@__PURE__*/uZ("$ZodCheckEndsWith",(e,t)=>{RU.init(e,t);const n=new RegExp(`.*${MZ(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),GU=/*@__PURE__*/uZ("$ZodCheckOverwrite",(e,t)=>{RU.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),KU=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}},JU={major:4,minor:4,patch:3},$U=/*@__PURE__*/uZ("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=JU;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=LZ(e);for(const a of t){if(a._zod.def.when){if(VZ(e))continue;if(!a._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&!1===n?.async)throw new hZ;if(r||o instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=LZ(e,t)))});else{if(e.issues.length===t)continue;i||(i=LZ(e,t))}}return r?r.then(()=>e):e},n=(n,i,a)=>{if(LZ(n))return n.aborted=!0,n;const o=t(i,r,a);if(o instanceof Promise){if(!1===a.async)throw new hZ;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){const t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}const o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new hZ;return o.then(e=>t(e,r,a))}return t(o,r,a)}}OZ(e,"~standard",()=>({validate:t=>{try{const n=KZ(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(Eme){return $Z(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),eW=/*@__PURE__*/uZ("$ZodString",(e,t)=>{var n;$U.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),tW=/*@__PURE__*/uZ("$ZodStringFormat",(e,t)=>{ZU.init(e,t),eW.init(e,t)}),nW=/*@__PURE__*/uZ("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=mU),tW.init(e,t)}),rW=/*@__PURE__*/uZ("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gU(e))}else t.pattern??(t.pattern=gU());tW.init(e,t)}),iW=/*@__PURE__*/uZ("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vU),tW.init(e,t)}),aW=/*@__PURE__*/uZ("$ZodURL",(e,t)=>{tW.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===SU.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(Eme){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),oW=/*@__PURE__*/uZ("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),tW.init(e,t)}),sW=/*@__PURE__*/uZ("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=fU),tW.init(e,t)}),lW=/*@__PURE__*/uZ("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lU),tW.init(e,t)}),cW=/*@__PURE__*/uZ("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=cU),tW.init(e,t)}),dW=/*@__PURE__*/uZ("$ZodULID",(e,t)=>{t.pattern??(t.pattern=dU),tW.init(e,t)}),uW=/*@__PURE__*/uZ("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uU),tW.init(e,t)}),hW=/*@__PURE__*/uZ("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hU),tW.init(e,t)}),fW=/*@__PURE__*/uZ("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=EU({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${zU}T(?:${r})$`)}(t)),tW.init(e,t)}),pW=/*@__PURE__*/uZ("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=NU),tW.init(e,t)}),mW=/*@__PURE__*/uZ("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${EU(t)}$`)),tW.init(e,t)}),gW=/*@__PURE__*/uZ("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pU),tW.init(e,t)}),vW=/*@__PURE__*/uZ("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=bU),tW.init(e,t),e._zod.bag.format="ipv4"}),bW=/*@__PURE__*/uZ("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=yU),tW.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),yW=/*@__PURE__*/uZ("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xU),tW.init(e,t)}),xW=/*@__PURE__*/uZ("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wU),tW.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function wW(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var OW=/*@__PURE__*/uZ("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=OU),tW.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{wW(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),kW=/*@__PURE__*/uZ("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=kU),tW.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!kU.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return wW(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),SW=/*@__PURE__*/uZ("$ZodE164",(e,t)=>{t.pattern??(t.pattern=CU),tW.init(e,t)}),CW=/*@__PURE__*/uZ("$ZodJWT",(e,t)=>{tW.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),zW=/*@__PURE__*/uZ("$ZodNumber",(e,t)=>{$U.init(e,t),e._zod.pattern=e._zod.bag.pattern??TU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(Eme){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),n}}),NW=/*@__PURE__*/uZ("$ZodNumberFormat",(e,t)=>{jU.init(e,t),zW.init(e,t)}),EW=/*@__PURE__*/uZ("$ZodBoolean",(e,t)=>{$U.init(e,t),e._zod.pattern=PU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(Eme){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),AW=/*@__PURE__*/uZ("$ZodAny",(e,t)=>{$U.init(e,t),e._zod.parse=e=>e}),TW=/*@__PURE__*/uZ("$ZodUnknown",(e,t)=>{$U.init(e,t),e._zod.parse=e=>e}),PW=/*@__PURE__*/uZ("$ZodNever",(e,t)=>{$U.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),MW=/*@__PURE__*/uZ("$ZodDate",(e,t)=>{$U.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(o){}const i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),n}});function IW(e,t,n){e.issues.length&&t.issues.push(...QZ(n,e.issues)),t.value[n]=e.value}var RW=/*@__PURE__*/uZ("$ZodArray",(e,t)=>{$U.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const a=[];for(let e=0;e<i.length;e++){const o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>IW(t,n,e))):IW(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function DW(e,t,n,r,i,a){const o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...QZ(n,e.issues))}o||i?void 0===e.value?o&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function LW(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function VW(e,t,n,r,i,a){const o=[],s=i.keySet,l=i.catchall._zod,c=l.def.type,d="optional"===l.optin,u="optional"===l.optout;for(const h in t){if("__proto__"===h)continue;if(s.has(h))continue;if("never"===c){o.push(h);continue}const i=l.run({value:t[h],issues:[]},r);i instanceof Promise?e.push(i.then(e=>DW(e,n,h,t,d,u))):DW(i,n,h,t,d,u)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var QW=/*@__PURE__*/uZ("$ZodObject",(e,t)=>{if($U.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const n=bZ(()=>LW(t));OZ(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */new Set);for(const e of r.values)n[t].add(e)}}return n});const r=NZ,i=t.catchall;let a;e._zod.parse=(t,o)=>{a??(a=n.value);const s=t.value;if(!r(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const l=[],c=a.shape;for(const e of a.keys){const n=c[e],r="optional"===n._zod.optin,i="optional"===n._zod.optout,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?l.push(a.then(n=>DW(n,t,e,s,r,i))):DW(a,t,e,s,r,i)}return i?VW(l,s,t,o,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),jW=/*@__PURE__*/uZ("$ZodObjectJIT",(e,t)=>{QW.init(e,t);const n=e._zod.parse,r=bZ(()=>LW(t));let i;const a=NZ,o=!pZ.jitless,s=o&&EZ.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=r.value);const h=d.value;return a(h)?o&&s&&!1===u?.async&&!0!==u.jitless?(i||(i=(e=>{const t=new KU(["shape","payload","ctx"]),n=r.value,i=e=>{const t=CZ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const a=Object.create(null);let o=0;for(const r of n.keys)a[r]="key_"+o++;t.write("const newResult = {};");for(const r of n.keys){const n=a[r],o=CZ(r),s=e[r],l="optional"===s?._zod?.optin,c="optional"===s?._zod?.optout;t.write(`const ${n} = ${i(r)};`),l&&c?t.write(`\n if (${n}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):l?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${o} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${o}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),d=i(d,u),l?VW([],h,d,u,c,e):d):n(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d)}});function FW(e,t,n,r){for(const a of e)if(0===a.issues.length)return t.value=a.value,t;const i=e.filter(e=>!LZ(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>FZ(e,r,mZ())))}),t)}var BW=/*@__PURE__*/uZ("$ZodUnion",(e,t)=>{$U.init(e,t),OZ(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),OZ(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),OZ(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),OZ(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>xZ(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(0===t.issues.length)return t;o.push(t)}}return a?Promise.all(o).then(t=>FW(t,r,e,i)):FW(o,r,e,i)}}),qW=/*@__PURE__*/uZ("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,BW.init(e,t);const n=e._zod.parse;OZ(e._zod,"propValues",()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=/* @__PURE__ */new Set);for(const r of n)e[t].add(r)}}return e});const r=bZ(()=>{const e=t.options,n=/* @__PURE__ */new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{const o=i.value;if(!NZ(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;const s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||"backward"===a.direction?n(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),ZW=/*@__PURE__*/uZ("$ZodIntersection",(e,t)=>{$U.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>WW(e,t,n)):WW(e,i,a)}});function UW(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(AZ(e)&&AZ(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const a of r){const n=UW(e[a],t[a]);if(!n.valid)return{valid:!1,mergeErrorPath:[a,...n.mergeErrorPath]};i[a]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=UW(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function WW(e,t,n){const r=/* @__PURE__ */new Map;let i;for(const s of t.issues)if("unrecognized_keys"===s.code){i??(i=s);for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(s);for(const s of n.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(s);const a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),LZ(e))return e;const o=UW(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var XW=/*@__PURE__*/uZ("$ZodRecord",(e,t)=>{$U.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!AZ(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const a=[],o=t.keyType._zod.values;if(o){n.value={};const s=/* @__PURE__ */new Set;for(const c of o)if("string"==typeof c||"number"==typeof c||"symbol"==typeof c){s.add("number"==typeof c?c.toString():c);const o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>FZ(e,r,mZ())),input:c,path:[c],inst:e});continue}const l=o.value,d=t.valueType._zod.run({value:i[c],issues:[]},r);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&n.issues.push(...QZ(c,e.issues)),n.value[l]=e.value})):(d.issues.length&&n.issues.push(...QZ(c,d.issues)),n.value[l]=d.value)}let l;for(const e in i)s.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{n.value={};for(const o of Reflect.ownKeys(i)){if("__proto__"===o)continue;if(!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof o&&TU.test(o)&&s.issues.length){const e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?n.value[o]=i[o]:n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>FZ(e,r,mZ())),input:o,path:[o],inst:e});continue}const l=t.valueType._zod.run({value:i[o],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...QZ(o,e.issues)),n.value[s.value]=e.value})):(l.issues.length&&n.issues.push(...QZ(o,l.issues)),n.value[s.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),HW=/*@__PURE__*/uZ("$ZodEnum",(e,t)=>{$U.init(e,t);const n=gZ(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>PZ.has(typeof e)).map(e=>"string"==typeof e?MZ(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const a=t.value;return r.has(a)||t.issues.push({code:"invalid_value",values:n,input:a,inst:e}),t}}),YW=/*@__PURE__*/uZ("$ZodLiteral",(e,t)=>{if($U.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?MZ(e):e?MZ(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const a=r.value;return n.has(a)||r.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),r}}),_W=/*@__PURE__*/uZ("$ZodTransform",(e,t)=>{$U.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new fZ(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new hZ;return n.value=i,n.fallback=!0,n}});function GW(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var KW=/*@__PURE__*/uZ("$ZodOptional",(e,t)=>{$U.init(e,t),e._zod.optin="optional",e._zod.optout="optional",OZ(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,void 0]):void 0),OZ(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${xZ(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>GW(e,r)):GW(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),JW=/*@__PURE__*/uZ("$ZodExactOptional",(e,t)=>{KW.init(e,t),OZ(e._zod,"values",()=>t.innerType._zod.values),OZ(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),$W=/*@__PURE__*/uZ("$ZodNullable",(e,t)=>{$U.init(e,t),OZ(e._zod,"optin",()=>t.innerType._zod.optin),OZ(e._zod,"optout",()=>t.innerType._zod.optout),OZ(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${xZ(e.source)}|null)$`):void 0}),OZ(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),eX=/*@__PURE__*/uZ("$ZodDefault",(e,t)=>{$U.init(e,t),e._zod.optin="optional",OZ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>tX(e,t)):tX(r,t)}});function tX(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var nX=/*@__PURE__*/uZ("$ZodPrefault",(e,t)=>{$U.init(e,t),e._zod.optin="optional",OZ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),rX=/*@__PURE__*/uZ("$ZodNonOptional",(e,t)=>{$U.init(e,t),OZ(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>iX(t,e)):iX(i,e)}});function iX(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var aX=/*@__PURE__*/uZ("$ZodCatch",(e,t)=>{$U.init(e,t),e._zod.optin="optional",OZ(e._zod,"optout",()=>t.innerType._zod.optout),OZ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>FZ(e,n,mZ()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>FZ(e,n,mZ()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),oX=/*@__PURE__*/uZ("$ZodPipe",(e,t)=>{$U.init(e,t),OZ(e._zod,"values",()=>t.in._zod.values),OZ(e._zod,"optin",()=>t.in._zod.optin),OZ(e._zod,"optout",()=>t.out._zod.optout),OZ(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>sX(e,t.in,n)):sX(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>sX(e,t.out,n)):sX(r,t.out,n)}});function sX(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var lX=/*@__PURE__*/uZ("$ZodReadonly",(e,t)=>{$U.init(e,t),OZ(e._zod,"propValues",()=>t.innerType._zod.propValues),OZ(e._zod,"values",()=>t.innerType._zod.values),OZ(e._zod,"optin",()=>t.innerType?._zod?.optin),OZ(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(cX):cX(r)}});function cX(e){return e.value=Object.freeze(e.value),e}var dX,uX=/*@__PURE__*/uZ("$ZodCustom",(e,t)=>{RU.init(e,t),$U.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>hX(t,n,r,e));hX(i,n,r,e)}});function hX(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(qZ(e))}}(dX=globalThis).__zod_globalRegistry??(dX.__zod_globalRegistry=new class{constructor(){this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});var fX=globalThis.__zod_globalRegistry;function pX(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...RZ(t)})}function mX(e,t){return new LU({check:"less_than",...RZ(t),value:e,inclusive:!1})}function gX(e,t){return new LU({check:"less_than",...RZ(t),value:e,inclusive:!0})}function vX(e,t){return new VU({check:"greater_than",...RZ(t),value:e,inclusive:!1})}function bX(e,t){return new VU({check:"greater_than",...RZ(t),value:e,inclusive:!0})}function yX(e,t){return new QU({check:"multiple_of",...RZ(t),value:e})}function xX(e,t){return new FU({check:"max_length",...RZ(t),maximum:e})}function wX(e,t){return new BU({check:"min_length",...RZ(t),minimum:e})}function OX(e,t){return new qU({check:"length_equals",...RZ(t),length:e})}function kX(e){return new GU({check:"overwrite",tx:e})}function SX(e,t){const n=new RU({check:"custom",...RZ(t)});return n._zod.check=e,n}function CX(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??fX,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:/* @__PURE__ */new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function zX(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{const n=o.schema,a=t.processors[i.type];if(!a)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}const a=e._zod.parent;a&&(o.ref||(o.ref=a),zX(a,t,r),t.seen.get(a).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),"input"===t.io&&AX(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function NX(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=/* @__PURE__ */new Map;for(const a of e.seen.entries()){const t=e.metadataRegistry.get(a[0])?.id;if(t){const e=r.get(t);if(e&&e!==a[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,a[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:a}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const a=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=a,{defId:a,ref:`${i("__shared")}#/${r}/${a}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,a=t[1].schema.id??"__schema"+e.counter++;return{defId:a,ref:i+a}})(t);r.def={...r.schema},a&&(r.defId=a);const o=r.schema;for(const e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(const a of e.seen.entries()){const e=a[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const n=a[1];if(t!==a[0]){if(e.external){const n=e.external.registry.get(a[0])?.id;if(t!==a[0]&&n){i(a);continue}}(e.metadataRegistry.get(a[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&i(a)}else i(a)}}function EX(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);const n=e.seen.get(o),s=n.schema;if(!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,s):(i.allOf=i.allOf??[],i.allOf.push(s)),Object.assign(i,a),t._zod.parent===o)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const s=t._zod.parent;if(s&&s!==o){r(s);const t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const l of[...e.seen.entries()].reverse())r(l[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;const o=e.external?.defs??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:TX(t,"input",e.processors),output:TX(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(s){throw new Error("Error converting schema to JSON.")}}function AX(e,t){const n=t??{seen:/* @__PURE__ */new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return AX(r.element,n);if("set"===r.type)return AX(r.valueType,n);if("lazy"===r.type)return AX(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return AX(r.innerType,n);if("intersection"===r.type)return AX(r.left,n)||AX(r.right,n);if("record"===r.type||"map"===r.type)return AX(r.keyType,n)||AX(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||AX(r.in,n)||AX(r.out,n);if("object"===r.type){for(const e in r.shape)if(AX(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(AX(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(AX(e,n))return!0;return!(!r.rest||!AX(r.rest,n))}return!1}var TX=(e,t,n={})=>r=>{const{libraryOptions:i,target:a}=r??{},o=CX({...i??{},target:a,io:t,processors:n});return zX(e,o),NX(o,e),EX(o,e)},PX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},MX=(e,t,n,r)=>{const i=e._zod.def;zX(i.innerType,t,r),t.seen.get(e).ref=i.innerType};function IX(){return IX=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},IX.apply(null,arguments)}function RX(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function DX(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var l=n[o].types,c=l&&l[r.code];n[o]=MB(o,t,n,i,c?[].concat(c,r.message):r.message)}e.shift()}return n}function LX(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("invalid_union"===r.code&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if("invalid_union"===r.code&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(IX({},t,{path:[].concat(r.path,t.path)}))})}),t){var l=n[o].types,c=l&&l[r.code];n[o]=MB(o,t,n,i,c?[].concat(c,r.message):r.message)}e.shift()};e.length;)r();return n}var VX=({defaultValues:e,config:t,errors:n,...r})=>{let i=Og(e),a=Og(t,"hard",{skipFunctions:!0}),o=k(()=>function(e,t,n){if(void 0===n&&(n={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(r,i,a){try{return Promise.resolve(RX(function(){return Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then(function(e){return a.shouldUseNativeValidation&&sZ({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:lZ(DX(e.errors,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)};throw e}))}catch(J){return Promise.reject(J)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(r,i,a){try{return Promise.resolve(RX(function(){return Promise.resolve(("sync"===n.mode?HZ:_Z)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&sZ({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof UZ}(e))return{values:{},errors:lZ(LX(e.issues,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)};throw e}))}catch(J){return Promise.reject(J)}};throw new Error("Invalid input: not a Zod schema")}(a.schema),[a.schema]);return{formMethods:Oq({...r,defaultValues:i,context:void 0,errors:n,resolver:o}),config:a}};function QX(e,t){let[n,r]=z(!1),i=k(()=>t??Object.keys(e.formState.defaultValues??{}),[e.formState.defaultValues,t]),[a,o]=z(()=>{let t=e.getValues();return Array.isArray(i)?i.map(e=>ne(t,e)):t[i]});return y(()=>{let t=e.watch((t,{name:n})=>{("string"==typeof i||n&&i.includes(n))&&o(e.getValues(i))});return n||(o(e.getValues(i)),r(!0)),()=>t.unsubscribe()},[e,n,i]),$V(()=>{o(e.getValues(i))},[e.formState.defaultValues]),a}var jX=({className:e,children:t,scrollable:n,testId:r,direction:i="column",wrap:a,items:o,justify:s,alignItems:l,gap:c=4,...d})=>(e=Zv("Form",{className:e,componentKey:"body",variants:{scrollable:n}}),/* @__PURE__ */P(Wv,{...d,testId:r,className:e,direction:i,wrap:a,items:o,justify:s,gap:c,alignItems:l,children:t})),FX=({className:e,children:t,testId:n,direction:r,wrap:i,items:a,justify:o,alignItems:s,gap:l=2,...c})=>(e=Zv("Form",{className:e,componentKey:"footer"}),/* @__PURE__ */P(Wv,{...c,testId:n,className:e,direction:r,wrap:i,items:a,justify:o,gap:l,alignItems:s,children:t})),BX=({className:e,children:t,testId:n,direction:r,wrap:i,items:a,justify:o,alignItems:s,gap:l=2,...c})=>(e=Zv("Form",{className:e,componentKey:"header"}),/* @__PURE__ */P(Wv,{...c,testId:n,className:e,direction:r,wrap:i,items:a,justify:o,gap:l,alignItems:s,children:t})),qX=Object.assign(({ref:e,children:t,form:r,className:i,scrollable:a,testId:o,onReset:l,onSubmit:c})=>{i=Zv("Form",{className:i,componentKey:"root"});let{header:d,body:u,footer:f}=k(()=>{let e={header:void 0,body:void 0,footer:void 0};return n.forEach(t,t=>{h(t)&&(t.type===BX?e.header=s(t,{testId:o?`${o}-header`:void 0,...t.props}):t.type===jX?e.body=s(t,{testId:o?`${o}-body`:void 0,scrollable:a,...t.props}):t.type===FX&&(e.footer=s(t,{testId:o?`${o}-footer`:void 0,...t.props})))}),e},[t,a,o]),p=g(e=>{c&&r.formMethods.handleSubmit(c)(e)},[r,c]);if(!r)throw Error("form instance is required from useForm");/* @__PURE__ */
112
+ return P(wB,{control:e.control??t,name:e.name,render:i})},iZ=/* @__PURE__ */Gq({Checkbox:()=>Kq,Color:()=>Sq,Conditional:()=>Cq,Custom:()=>zq,FileUpload:()=>Jq,Input:()=>$q,Select:()=>eZ,Select2:()=>tZ,Switch:()=>nZ,TextArea:()=>rZ}),aZ={root:we("flex flex-col"),header:we("w-full border-b border-gray-200 dark:border-zinc-700 pb-4 mb-4"),body:we("w-full flex flex-col gap-4",{variants:{scrollable:{true:"grow basis-0 overflow-y-auto",false:""}},compoundVariants:[],defaultVariants:{scrollable:!1}}),footer:we("w-full border-t border-gray-200 dark:border-zinc-700 pt-4 mt-4")},oZ=(e,t,n)=>{if(e&&"reportValidity"in e){const r=sB(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},sZ=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?oZ(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>oZ(t,n,e))}},lZ=(e,t)=>{t.shouldUseNativeValidation&&sZ(e,t);const n={};for(const r in e){const i=sB(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(cZ(t.names||Object.keys(e),r)){const e=Object.assign({},sB(n,r));dB(e,"root",a),dB(n,r,e)}else dB(n,r,a)}return n},cZ=(e,t)=>{const n=dZ(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(e=>dZ(e).match(`^${n}\\.\\d+`))};function dZ(e){return e.replace(/[\[\]]/g,"")}function uZ(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:/* @__PURE__ */new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){const t=a[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class a extends i{}function o(e){var t;const i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var hZ=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},fZ=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(kq=globalThis).__zod_globalConfig??(kq.__zod_globalConfig={});var pZ=globalThis.__zod_globalConfig;function mZ(e){return e&&Object.assign(pZ,e),pZ}function gZ(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function vZ(e,t){return"bigint"==typeof t?t.toString():t}function bZ(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function yZ(e){return null==e}function xZ(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var wZ=/* @__PURE__*/Symbol("evaluating");function OZ(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==wZ)return void 0===r&&(r=wZ,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function kZ(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function SZ(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function CZ(e){return JSON.stringify(e)}var zZ="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function NZ(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var EZ=/* @__PURE__*/bZ(()=>{if(pZ.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Eme){return!1}});function AZ(e){if(!1===NZ(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==NZ(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function TZ(e){return AZ(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var PZ=/* @__PURE__*/new Set(["string","number","symbol"]);function MZ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function IZ(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function RZ(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}var DZ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function LZ(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function VZ(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function QZ(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function jZ(e){return"string"==typeof e?e:e?.message}function FZ(e,t,n){const r=e.message?e.message:jZ(e.inst?._zod.def?.error?.(e))??jZ(t?.error?.(e))??jZ(n.customError?.(e))??jZ(n.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=r,t?.reportInput&&(s.input=o),s}function BZ(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function qZ(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}var ZZ=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vZ,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},UZ=uZ("$ZodError",ZZ),WZ=uZ("$ZodError",ZZ,{Parent:Error}),XZ=e=>(t,n,r,i)=>{const a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new hZ;if(o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>FZ(e,a,mZ())));throw zZ(t,i?.callee),t}return o.value},HZ=/* @__PURE__*/XZ(WZ),YZ=e=>async(t,n,r,i)=>{const a=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>FZ(e,a,mZ())));throw zZ(t,i?.callee),t}return o.value},_Z=/* @__PURE__*/YZ(WZ),GZ=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new hZ;return a.issues.length?{success:!1,error:new(e??UZ)(a.issues.map(e=>FZ(e,i,mZ())))}:{success:!0,data:a.value}},KZ=/* @__PURE__*/GZ(WZ),JZ=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>FZ(e,i,mZ())))}:{success:!0,data:a.value}},$Z=/* @__PURE__*/JZ(WZ),eU=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return XZ(e)(t,n,i)},tU=e=>(t,n,r)=>XZ(e)(t,n,r),nU=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return YZ(e)(t,n,i)},rU=e=>async(t,n,r)=>YZ(e)(t,n,r),iU=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return GZ(e)(t,n,i)},aU=e=>(t,n,r)=>GZ(e)(t,n,r),oU=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return JZ(e)(t,n,i)},sU=e=>async(t,n,r)=>JZ(e)(t,n,r),lU=/^[cC][0-9a-z]{6,}$/,cU=/^[0-9a-z]+$/,dU=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uU=/^[0-9a-vA-V]{20}$/,hU=/^[A-Za-z0-9]{27}$/,fU=/^[a-zA-Z0-9_-]{21}$/,pU=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mU=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gU=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,vU=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bU=/^(?:(?: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])$/,yU=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,xU=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,wU=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,OU=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kU=/^[A-Za-z0-9_-]*$/,SU=/^https?$/,CU=/^\+[1-9]\d{6,14}$/,zU="(?:(?:\\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])))",NU=/*@__PURE__*/new RegExp(`^${zU}$`);function EU(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}var AU=/^-?\d+$/,TU=/^-?\d+(?:\.\d+)?$/,PU=/^(?:true|false)$/i,MU=/^[^A-Z]*$/,IU=/^[^a-z]*$/,RU=/*@__PURE__*/uZ("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),DU={number:"number",bigint:"bigint",object:"date"},LU=/*@__PURE__*/uZ("$ZodCheckLessThan",(e,t)=>{RU.init(e,t);const n=DU[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),VU=/*@__PURE__*/uZ("$ZodCheckGreaterThan",(e,t)=>{RU.init(e,t);const n=DU[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),QU=/*@__PURE__*/uZ("$ZodCheckMultipleOf",(e,t)=>{RU.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value!==BigInt(0):0!==function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))&&n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),jU=/*@__PURE__*/uZ("$ZodCheckNumberFormat",(e,t)=>{RU.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,a]=DZ[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=AU)}),e._zod.check=o=>{const s=o.value;if(n){if(!Number.isInteger(s))return void o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),FU=/*@__PURE__*/uZ("$ZodCheckMaxLength",(e,t)=>{var n;RU.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!yZ(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=BZ(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),BU=/*@__PURE__*/uZ("$ZodCheckMinLength",(e,t)=>{var n;RU.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!yZ(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=BZ(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qU=/*@__PURE__*/uZ("$ZodCheckLengthEquals",(e,t)=>{var n;RU.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!yZ(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const a=BZ(r),o=i>t.length;n.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ZU=/*@__PURE__*/uZ("$ZodCheckStringFormat",(e,t)=>{var n,r;RU.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=/* @__PURE__ */new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),UU=/*@__PURE__*/uZ("$ZodCheckRegex",(e,t)=>{ZU.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),WU=/*@__PURE__*/uZ("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=MU),ZU.init(e,t)}),XU=/*@__PURE__*/uZ("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=IU),ZU.init(e,t)}),HU=/*@__PURE__*/uZ("$ZodCheckIncludes",(e,t)=>{RU.init(e,t);const n=MZ(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),YU=/*@__PURE__*/uZ("$ZodCheckStartsWith",(e,t)=>{RU.init(e,t);const n=new RegExp(`^${MZ(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),_U=/*@__PURE__*/uZ("$ZodCheckEndsWith",(e,t)=>{RU.init(e,t);const n=new RegExp(`.*${MZ(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=/* @__PURE__ */new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),GU=/*@__PURE__*/uZ("$ZodCheckOverwrite",(e,t)=>{RU.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),KU=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const i of r)this.content.push(i)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}},JU={major:4,minor:4,patch:3},$U=/*@__PURE__*/uZ("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=JU;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=LZ(e);for(const a of t){if(a._zod.def.when){if(VZ(e))continue;if(!a._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&!1===n?.async)throw new hZ;if(r||o instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=LZ(e,t)))});else{if(e.issues.length===t)continue;i||(i=LZ(e,t))}}return r?r.then(()=>e):e},n=(n,i,a)=>{if(LZ(n))return n.aborted=!0,n;const o=t(i,r,a);if(o instanceof Promise){if(!1===a.async)throw new hZ;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){const t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}const o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new hZ;return o.then(e=>t(e,r,a))}return t(o,r,a)}}OZ(e,"~standard",()=>({validate:t=>{try{const n=KZ(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(Eme){return $Z(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),eW=/*@__PURE__*/uZ("$ZodString",(e,t)=>{var n;$U.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),tW=/*@__PURE__*/uZ("$ZodStringFormat",(e,t)=>{ZU.init(e,t),eW.init(e,t)}),nW=/*@__PURE__*/uZ("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=mU),tW.init(e,t)}),rW=/*@__PURE__*/uZ("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gU(e))}else t.pattern??(t.pattern=gU());tW.init(e,t)}),iW=/*@__PURE__*/uZ("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vU),tW.init(e,t)}),aW=/*@__PURE__*/uZ("$ZodURL",(e,t)=>{tW.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===SU.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(Eme){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),oW=/*@__PURE__*/uZ("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),tW.init(e,t)}),sW=/*@__PURE__*/uZ("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=fU),tW.init(e,t)}),lW=/*@__PURE__*/uZ("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lU),tW.init(e,t)}),cW=/*@__PURE__*/uZ("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=cU),tW.init(e,t)}),dW=/*@__PURE__*/uZ("$ZodULID",(e,t)=>{t.pattern??(t.pattern=dU),tW.init(e,t)}),uW=/*@__PURE__*/uZ("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uU),tW.init(e,t)}),hW=/*@__PURE__*/uZ("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hU),tW.init(e,t)}),fW=/*@__PURE__*/uZ("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=EU({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${zU}T(?:${r})$`)}(t)),tW.init(e,t)}),pW=/*@__PURE__*/uZ("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=NU),tW.init(e,t)}),mW=/*@__PURE__*/uZ("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${EU(t)}$`)),tW.init(e,t)}),gW=/*@__PURE__*/uZ("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pU),tW.init(e,t)}),vW=/*@__PURE__*/uZ("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=bU),tW.init(e,t),e._zod.bag.format="ipv4"}),bW=/*@__PURE__*/uZ("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=yU),tW.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),yW=/*@__PURE__*/uZ("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xU),tW.init(e,t)}),xW=/*@__PURE__*/uZ("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wU),tW.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function wW(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var OW=/*@__PURE__*/uZ("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=OU),tW.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{wW(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),kW=/*@__PURE__*/uZ("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=kU),tW.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!kU.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return wW(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),SW=/*@__PURE__*/uZ("$ZodE164",(e,t)=>{t.pattern??(t.pattern=CU),tW.init(e,t)}),CW=/*@__PURE__*/uZ("$ZodJWT",(e,t)=>{tW.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),zW=/*@__PURE__*/uZ("$ZodNumber",(e,t)=>{$U.init(e,t),e._zod.pattern=e._zod.bag.pattern??TU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(Eme){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),n}}),NW=/*@__PURE__*/uZ("$ZodNumberFormat",(e,t)=>{jU.init(e,t),zW.init(e,t)}),EW=/*@__PURE__*/uZ("$ZodBoolean",(e,t)=>{$U.init(e,t),e._zod.pattern=PU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(Eme){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),AW=/*@__PURE__*/uZ("$ZodAny",(e,t)=>{$U.init(e,t),e._zod.parse=e=>e}),TW=/*@__PURE__*/uZ("$ZodUnknown",(e,t)=>{$U.init(e,t),e._zod.parse=e=>e}),PW=/*@__PURE__*/uZ("$ZodNever",(e,t)=>{$U.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),MW=/*@__PURE__*/uZ("$ZodDate",(e,t)=>{$U.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(o){}const i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),n}});function IW(e,t,n){e.issues.length&&t.issues.push(...QZ(n,e.issues)),t.value[n]=e.value}var RW=/*@__PURE__*/uZ("$ZodArray",(e,t)=>{$U.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const a=[];for(let e=0;e<i.length;e++){const o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>IW(t,n,e))):IW(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function DW(e,t,n,r,i,a){const o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...QZ(n,e.issues))}o||i?void 0===e.value?o&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function LW(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function VW(e,t,n,r,i,a){const o=[],s=i.keySet,l=i.catchall._zod,c=l.def.type,d="optional"===l.optin,u="optional"===l.optout;for(const h in t){if("__proto__"===h)continue;if(s.has(h))continue;if("never"===c){o.push(h);continue}const i=l.run({value:t[h],issues:[]},r);i instanceof Promise?e.push(i.then(e=>DW(e,n,h,t,d,u))):DW(i,n,h,t,d,u)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var QW=/*@__PURE__*/uZ("$ZodObject",(e,t)=>{if($U.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const n=bZ(()=>LW(t));OZ(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */new Set);for(const e of r.values)n[t].add(e)}}return n});const r=NZ,i=t.catchall;let a;e._zod.parse=(t,o)=>{a??(a=n.value);const s=t.value;if(!r(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const l=[],c=a.shape;for(const e of a.keys){const n=c[e],r="optional"===n._zod.optin,i="optional"===n._zod.optout,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?l.push(a.then(n=>DW(n,t,e,s,r,i))):DW(a,t,e,s,r,i)}return i?VW(l,s,t,o,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),jW=/*@__PURE__*/uZ("$ZodObjectJIT",(e,t)=>{QW.init(e,t);const n=e._zod.parse,r=bZ(()=>LW(t));let i;const a=NZ,o=!pZ.jitless,s=o&&EZ.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=r.value);const h=d.value;return a(h)?o&&s&&!1===u?.async&&!0!==u.jitless?(i||(i=(e=>{const t=new KU(["shape","payload","ctx"]),n=r.value,i=e=>{const t=CZ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const a=Object.create(null);let o=0;for(const r of n.keys)a[r]="key_"+o++;t.write("const newResult = {};");for(const r of n.keys){const n=a[r],o=CZ(r),s=e[r],l="optional"===s?._zod?.optin,c="optional"===s?._zod?.optout;t.write(`const ${n} = ${i(r)};`),l&&c?t.write(`\n if (${n}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):l?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${o} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${o}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),d=i(d,u),l?VW([],h,d,u,c,e):d):n(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d)}});function FW(e,t,n,r){for(const a of e)if(0===a.issues.length)return t.value=a.value,t;const i=e.filter(e=>!LZ(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>FZ(e,r,mZ())))}),t)}var BW=/*@__PURE__*/uZ("$ZodUnion",(e,t)=>{$U.init(e,t),OZ(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),OZ(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),OZ(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),OZ(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>xZ(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(0===t.issues.length)return t;o.push(t)}}return a?Promise.all(o).then(t=>FW(t,r,e,i)):FW(o,r,e,i)}}),qW=/*@__PURE__*/uZ("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,BW.init(e,t);const n=e._zod.parse;OZ(e._zod,"propValues",()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=/* @__PURE__ */new Set);for(const r of n)e[t].add(r)}}return e});const r=bZ(()=>{const e=t.options,n=/* @__PURE__ */new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{const o=i.value;if(!NZ(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;const s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||"backward"===a.direction?n(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),ZW=/*@__PURE__*/uZ("$ZodIntersection",(e,t)=>{$U.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>WW(e,t,n)):WW(e,i,a)}});function UW(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(AZ(e)&&AZ(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const a of r){const n=UW(e[a],t[a]);if(!n.valid)return{valid:!1,mergeErrorPath:[a,...n.mergeErrorPath]};i[a]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=UW(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function WW(e,t,n){const r=/* @__PURE__ */new Map;let i;for(const s of t.issues)if("unrecognized_keys"===s.code){i??(i=s);for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(s);for(const s of n.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(s);const a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),LZ(e))return e;const o=UW(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var XW=/*@__PURE__*/uZ("$ZodRecord",(e,t)=>{$U.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!AZ(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const a=[],o=t.keyType._zod.values;if(o){n.value={};const s=/* @__PURE__ */new Set;for(const c of o)if("string"==typeof c||"number"==typeof c||"symbol"==typeof c){s.add("number"==typeof c?c.toString():c);const o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>FZ(e,r,mZ())),input:c,path:[c],inst:e});continue}const l=o.value,d=t.valueType._zod.run({value:i[c],issues:[]},r);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&n.issues.push(...QZ(c,e.issues)),n.value[l]=e.value})):(d.issues.length&&n.issues.push(...QZ(c,d.issues)),n.value[l]=d.value)}let l;for(const e in i)s.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{n.value={};for(const o of Reflect.ownKeys(i)){if("__proto__"===o)continue;if(!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof o&&TU.test(o)&&s.issues.length){const e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?n.value[o]=i[o]:n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>FZ(e,r,mZ())),input:o,path:[o],inst:e});continue}const l=t.valueType._zod.run({value:i[o],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...QZ(o,e.issues)),n.value[s.value]=e.value})):(l.issues.length&&n.issues.push(...QZ(o,l.issues)),n.value[s.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),HW=/*@__PURE__*/uZ("$ZodEnum",(e,t)=>{$U.init(e,t);const n=gZ(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>PZ.has(typeof e)).map(e=>"string"==typeof e?MZ(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const a=t.value;return r.has(a)||t.issues.push({code:"invalid_value",values:n,input:a,inst:e}),t}}),YW=/*@__PURE__*/uZ("$ZodLiteral",(e,t)=>{if($U.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?MZ(e):e?MZ(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const a=r.value;return n.has(a)||r.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),r}}),_W=/*@__PURE__*/uZ("$ZodTransform",(e,t)=>{$U.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new fZ(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new hZ;return n.value=i,n.fallback=!0,n}});function GW(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var KW=/*@__PURE__*/uZ("$ZodOptional",(e,t)=>{$U.init(e,t),e._zod.optin="optional",e._zod.optout="optional",OZ(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,void 0]):void 0),OZ(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${xZ(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>GW(e,r)):GW(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),JW=/*@__PURE__*/uZ("$ZodExactOptional",(e,t)=>{KW.init(e,t),OZ(e._zod,"values",()=>t.innerType._zod.values),OZ(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),$W=/*@__PURE__*/uZ("$ZodNullable",(e,t)=>{$U.init(e,t),OZ(e._zod,"optin",()=>t.innerType._zod.optin),OZ(e._zod,"optout",()=>t.innerType._zod.optout),OZ(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${xZ(e.source)}|null)$`):void 0}),OZ(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),eX=/*@__PURE__*/uZ("$ZodDefault",(e,t)=>{$U.init(e,t),e._zod.optin="optional",OZ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>tX(e,t)):tX(r,t)}});function tX(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var nX=/*@__PURE__*/uZ("$ZodPrefault",(e,t)=>{$U.init(e,t),e._zod.optin="optional",OZ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),rX=/*@__PURE__*/uZ("$ZodNonOptional",(e,t)=>{$U.init(e,t),OZ(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>iX(t,e)):iX(i,e)}});function iX(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var aX=/*@__PURE__*/uZ("$ZodCatch",(e,t)=>{$U.init(e,t),e._zod.optin="optional",OZ(e._zod,"optout",()=>t.innerType._zod.optout),OZ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>FZ(e,n,mZ()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>FZ(e,n,mZ()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),oX=/*@__PURE__*/uZ("$ZodPipe",(e,t)=>{$U.init(e,t),OZ(e._zod,"values",()=>t.in._zod.values),OZ(e._zod,"optin",()=>t.in._zod.optin),OZ(e._zod,"optout",()=>t.out._zod.optout),OZ(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>sX(e,t.in,n)):sX(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>sX(e,t.out,n)):sX(r,t.out,n)}});function sX(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var lX=/*@__PURE__*/uZ("$ZodReadonly",(e,t)=>{$U.init(e,t),OZ(e._zod,"propValues",()=>t.innerType._zod.propValues),OZ(e._zod,"values",()=>t.innerType._zod.values),OZ(e._zod,"optin",()=>t.innerType?._zod?.optin),OZ(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(cX):cX(r)}});function cX(e){return e.value=Object.freeze(e.value),e}var dX,uX=/*@__PURE__*/uZ("$ZodCustom",(e,t)=>{RU.init(e,t),$U.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>hX(t,n,r,e));hX(i,n,r,e)}});function hX(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(qZ(e))}}(dX=globalThis).__zod_globalRegistry??(dX.__zod_globalRegistry=new class{constructor(){this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});var fX=globalThis.__zod_globalRegistry;function pX(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...RZ(t)})}function mX(e,t){return new LU({check:"less_than",...RZ(t),value:e,inclusive:!1})}function gX(e,t){return new LU({check:"less_than",...RZ(t),value:e,inclusive:!0})}function vX(e,t){return new VU({check:"greater_than",...RZ(t),value:e,inclusive:!1})}function bX(e,t){return new VU({check:"greater_than",...RZ(t),value:e,inclusive:!0})}function yX(e,t){return new QU({check:"multiple_of",...RZ(t),value:e})}function xX(e,t){return new FU({check:"max_length",...RZ(t),maximum:e})}function wX(e,t){return new BU({check:"min_length",...RZ(t),minimum:e})}function OX(e,t){return new qU({check:"length_equals",...RZ(t),length:e})}function kX(e){return new GU({check:"overwrite",tx:e})}function SX(e,t){const n=new RU({check:"custom",...RZ(t)});return n._zod.check=e,n}function CX(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??fX,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:/* @__PURE__ */new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function zX(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{const n=o.schema,a=t.processors[i.type];if(!a)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}const a=e._zod.parent;a&&(o.ref||(o.ref=a),zX(a,t,r),t.seen.get(a).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),"input"===t.io&&AX(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function NX(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=/* @__PURE__ */new Map;for(const a of e.seen.entries()){const t=e.metadataRegistry.get(a[0])?.id;if(t){const e=r.get(t);if(e&&e!==a[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(t,a[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:a}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const a=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=a,{defId:a,ref:`${i("__shared")}#/${r}/${a}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,a=t[1].schema.id??"__schema"+e.counter++;return{defId:a,ref:i+a}})(t);r.def={...r.schema},a&&(r.defId=a);const o=r.schema;for(const e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(const a of e.seen.entries()){const e=a[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const n=a[1];if(t!==a[0]){if(e.external){const n=e.external.registry.get(a[0])?.id;if(t!==a[0]&&n){i(a);continue}}(e.metadataRegistry.get(a[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&i(a)}else i(a)}}function EX(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);const n=e.seen.get(o),s=n.schema;if(!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,s):(i.allOf=i.allOf??[],i.allOf.push(s)),Object.assign(i,a),t._zod.parent===o)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const s=t._zod.parent;if(s&&s!==o){r(s);const t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const l of[...e.seen.entries()].reverse())r(l[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;const o=e.external?.defs??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:TX(t,"input",e.processors),output:TX(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(s){throw new Error("Error converting schema to JSON.")}}function AX(e,t){const n=t??{seen:/* @__PURE__ */new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return AX(r.element,n);if("set"===r.type)return AX(r.valueType,n);if("lazy"===r.type)return AX(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return AX(r.innerType,n);if("intersection"===r.type)return AX(r.left,n)||AX(r.right,n);if("record"===r.type||"map"===r.type)return AX(r.keyType,n)||AX(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||AX(r.in,n)||AX(r.out,n);if("object"===r.type){for(const e in r.shape)if(AX(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(AX(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(AX(e,n))return!0;return!(!r.rest||!AX(r.rest,n))}return!1}var TX=(e,t,n={})=>r=>{const{libraryOptions:i,target:a}=r??{},o=CX({...i??{},target:a,io:t,processors:n});return zX(e,o),NX(o,e),EX(o,e)},PX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},MX=(e,t,n,r)=>{const i=e._zod.def;zX(i.innerType,t,r),t.seen.get(e).ref=i.innerType};function IX(){return IX=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},IX.apply(null,arguments)}function RX(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function DX(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var l=n[o].types,c=l&&l[r.code];n[o]=MB(o,t,n,i,c?[].concat(c,r.message):r.message)}e.shift()}return n}function LX(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("invalid_union"===r.code&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if("invalid_union"===r.code&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(IX({},t,{path:[].concat(r.path,t.path)}))})}),t){var l=n[o].types,c=l&&l[r.code];n[o]=MB(o,t,n,i,c?[].concat(c,r.message):r.message)}e.shift()};e.length;)r();return n}var VX=({defaultValues:e,config:t,errors:n,...r})=>{let i=Og(e),a=Og(t,"hard",{skipFunctions:!0}),o=k(()=>function(e,t,n){if(void 0===n&&(n={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(r,i,a){try{return Promise.resolve(RX(function(){return Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then(function(e){return a.shouldUseNativeValidation&&sZ({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:lZ(DX(e.errors,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)};throw e}))}catch(J){return Promise.reject(J)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(r,i,a){try{return Promise.resolve(RX(function(){return Promise.resolve(("sync"===n.mode?HZ:_Z)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&sZ({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof UZ}(e))return{values:{},errors:lZ(LX(e.issues,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)};throw e}))}catch(J){return Promise.reject(J)}};throw new Error("Invalid input: not a Zod schema")}(a.schema),[a.schema]);return{formMethods:Oq({...r,defaultValues:i,context:void 0,errors:n,resolver:o}),config:a}};function QX(e,t){let[n,r]=z(!1),i=k(()=>t??Object.keys(e.formState.defaultValues??{}),[e.formState.defaultValues,t]),[a,o]=z(()=>{let t=e.getValues();return Array.isArray(i)?i.map(e=>ne(t,e)):t[i]});return y(()=>{let t=e.watch((t,{name:n})=>{("string"==typeof i||n&&i.includes(n))&&o(e.getValues(i))});return n||(o(e.getValues(i)),r(!0)),()=>t.unsubscribe()},[e,n,i]),$V(()=>{o(e.getValues(i))},[e.formState.defaultValues]),a}var jX=({className:e,children:t,scrollable:n,testId:r,direction:i="column",wrap:a,items:o,justify:s,alignItems:l,gap:c=4,...d})=>(e=Zv("Form",{className:e,componentKey:"body",variants:{scrollable:n}}),/* @__PURE__ */P(Wv,{...d,testId:r,className:e,direction:i,wrap:a,items:o,justify:s,gap:c,alignItems:l,children:t})),FX=({className:e,children:t,testId:n,direction:r,wrap:i,items:a,justify:o,alignItems:s,gap:l=2,...c})=>(e=Zv("Form",{className:e,componentKey:"footer"}),/* @__PURE__ */P(Wv,{...c,testId:n,className:e,direction:r,wrap:i,items:a,justify:o,gap:l,alignItems:s,children:t})),BX=({className:e,children:t,testId:n,direction:r,wrap:i,items:a,justify:o,alignItems:s,gap:l=2,...c})=>(e=Zv("Form",{className:e,componentKey:"header"}),/* @__PURE__ */P(Wv,{...c,testId:n,className:e,direction:r,wrap:i,items:a,justify:o,gap:l,alignItems:s,children:t})),qX=Object.assign(({ref:e,children:t,form:r,className:i,scrollable:a,testId:o,onReset:l,onSubmit:c})=>{i=Zv("Form",{className:i,componentKey:"root"});let{header:d,body:u,footer:f}=k(()=>{let e={header:void 0,body:void 0,footer:void 0};return n.forEach(t,t=>{h(t)&&(t.type===BX?e.header=s(t,{testId:o?`${o}-header`:void 0,...t.props}):t.type===jX?e.body=s(t,{testId:o?`${o}-body`:void 0,scrollable:a,...t.props}):t.type===FX&&(e.footer=s(t,{testId:o?`${o}-footer`:void 0,...t.props})))}),e},[t,a,o]),p=g(e=>{c&&r.formMethods.handleSubmit(c)(e)},[r,c]);if(!r)throw Error("form instance is required from useForm");/* @__PURE__ */
113
113
  return P(tq,{...r.formMethods,children:/* @__PURE__ */M("form",{"data-testid":o,ref:e,className:i,onReset:l,onSubmit:p,children:[d,u,f]})})},{...iZ,Header:BX,Body:jX,Footer:FX}),ZX=qX,UX={root:we("text-zinc-900 dark:text-zinc-100",{variants:{as:{h1:"text-5xl font-extrabold",h2:"text-4xl font-extrabold",h3:"text-3xl font-bold",h4:"text-2xl font-bold",h5:"text-xl font-bold",h6:"text-lg font-bold"}},compoundVariants:[],defaultVariants:{as:"h1"}})},WX=({as:e="h1",className:t="",children:n="Heading",testId:r,...i})=>(t=Zv("Heading",{className:t,componentKey:"root",variants:{as:e}}),/* @__PURE__ */P(Oe,{...i,tag:e,"data-testid":r,className:t,children:n})),XX={root:we("bg-grayviolet-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-200",{variants:{intent:{primary:"",active:"",disabled:"",custom:""},size:{xs:"px-1.5 py-1 rounded-sm",sm:"px-2 py-1.5 rounded",md:"px-2.5 py-2 rounded-lg",lg:"px-2.5 py-2 rounded-lg",xl:"px-2.5 py-2 rounded-lg","2xl":"px-3 py-2 rounded-lg","3xl":"px-3 py-2 rounded-lg","4xl":"px-3 py-2 rounded-lg","5xl":"px-3 py-2 rounded-lg","6xl":"px-3 py-2 rounded-lg","7xl":"px-3 py-2 rounded-lg","8xl":"px-3 py-2 rounded-lg","9xl":"px-3 py-2 rounded-lg",custom:""}},compoundVariants:[],defaultVariants:{intent:"primary",size:"md"}}),separator:we("bg-gray-500 dark:bg-zinc-500",{variants:{intent:{default:""},direction:{column:"w-full",row:"h-full","row-reverse":"h-full","col-reverse":"w-full"}},compoundVariants:[{direction:"column",className:"h-px"},{direction:"col-reverse",className:"h-px"},{direction:"row",className:"w-px"},{direction:"row-reverse",className:"w-px"}],defaultVariants:{intent:"default",direction:"row"}}),icon:we("")},HX=({className:e,intent:t,size:n,direction:r})=>(e=Zv("IconGroup",{className:e,componentKey:"separator",variants:{intent:t,size:n,direction:r}}),/* @__PURE__ */P("div",{className:e})),YX=({className:e,children:t,intent:r,size:i,direction:a,wrap:o,items:l="center",justify:c="between",gap:d=2})=>{let u=Zv("IconGroup",{className:e,componentKey:["root","icon","separator"],variants:{intent:r,size:i,direction:a}}),{icons:f}=k(()=>{let e={icons:[]};return n.forEach(t,(t,n)=>{h(t)&&(t.type===Yv?e.icons.push(s(t,{key:n,className:u.icon,size:i,intent:r,...t.props})):t.type===HX&&e.icons.push(s(t,{key:n,size:i,intent:r,...t.props})))}),e},[t,u,i,r]);/* @__PURE__ */
114
114
  return P(Wv,{className:u.root,direction:a,wrap:o,items:l,gap:d,justify:c,children:f})};YX.Separator=HX,YX.Icon=Yv;var _X=YX,GX=(e,t=!1)=>{let n={};for(let r of e){let e;if(e=2===r.length&&r[0].includes(".")?[...r[0].split("."),r[1]]:r,e.length<2)continue;let i=n;for(let t=0;t<e.length-2;t++){let n=e[t];(!i[n]||"object"!=typeof i[n])&&(i[n]={}),i=i[n]}let a=e[e.length-2],o=e[e.length-1];t?void 0===i[a]?i[a]=o:Array.isArray(i[a])?i[a].push(o):i[a]=[i[a],o]:i[a]=o}return n},KX=(e,t,n)=>{let r=[],i=t??[],a=n??void 0!==t;for(let[o,s]of Object.entries(e))if(s&&"object"==typeof s&&!Array.isArray(s))r.push(...KX(s,[...i,o],a));else{let e=[...i,o];Array.isArray(s)?s.forEach(t=>{a?r.push([e.join("."),String(t)]):r.push([...e,String(t)])}):a?r.push([e.join("."),String(s)]):r.push([...e,String(s)])}return r},JX={item:we("w-full flex gap-1 border border-gray-300 dark:border-zinc-700 p-1 [&:not(:first-child)]:border-t-0",{variants:{size:{md:"first:rounded-t-lg last:rounded-b-lg",sm:"first:rounded-t last:rounded-b",xs:"first:rounded-t-sm last:rounded-b-sm",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),itemActions:we("flex gap-1 items-center justify-center",{variants:{size:{md:"w-18",sm:"w-14",xs:"w-12",custom:""}},compoundVariants:[],defaultVariants:{size:"md"}}),inputContainer:we("p-0 border-none"),rootInputContainer:we(""),rootInput:we("w-full")},$X=p(({id:e,className:t,valueKey:n="",value:r="",disabled:i=!1,clearable:a=!1,isNewRecord:o=!1,size:s="md",required:l=!0,allowAppend:c=!0,allowRemove:d=!0,allowKeyEdit:u=!0,keysAllowed:h,onChange:f,onRemove:p})=>{let m=Zv(["Input","KVInput"],{className:t,componentKey:["item","itemActions","input","rootInputContainer","rootInput"],variants:{size:s}}),[v,b]=z(n),[y,x]=z(r),[w,O]=z(),S=k(()=>!o&&(r!==y||n!==v),[o,r,y,n,v]),C=g(e=>{w?.valueKey?O(ce(w,"valueKey")):""===e&&O(e=>({...e,valueKey:"Key is required"})),b(e)},[w]),N=g(e=>{w?.value?O(ce(w,"value")):""===e&&l&&O(e=>({...e,value:"Value is required"})),x(e)},[w,l]),E=g(()=>p?.(e),[p,e]),A=g(()=>{O(void 0),b(n),x(r)},[n,r]),I=g(()=>{let t={};if(v||(t.valueKey="Key is required"),!y&&l&&(t.value="Value is required"),Object.keys(t).length)return void O(t);let r=f?.(n,v,y,e);r?.success||!r?.errors?(O({}),o&&(b(""),x(""))):O(r.errors)},[v,y,l,f,n,e,o]),R=g(()=>{let t=f?.(n,v,"",e);O(t?.success||!t?.errors?{}:t.errors)},[e,f,v,n]);/* @__PURE__ */
115
115
  return M("div",{className:m.item,children:[/* @__PURE__ */M("div",{className:"flex grow basis-0 gap-2",children:[(!h||!h.length)&&/* @__PURE__ */P(Aq,{size:s,className:{...m,root:m.rootInput,inputContainer:m.rootInputContainer},value:v,disabled:i||!u,required:!0,error:w?.valueKey,placeholder:"Key",onChange:C}),h&&h.length>0&&/* @__PURE__ */P(Iq,{size:s,className:{...m,root:m.rootInput,inputContainer:m.rootInputContainer},value:v,disabled:i||!u,required:l,placeholder:"Value",error:w?.valueKey,onChange:C,children:h.map(e=>/* @__PURE__ */P(Iq.Option,{value:e.value,children:e.label||e.value},e.value))}),
@@ -4330,7 +4330,7 @@ return M("div",{className:"mt-2 overflow-hidden rounded-md border border-zinc-20
4330
4330
  /* @__PURE__ */M("p",{className:"mb-1.5 font-mono text-[10px] text-zinc-600 dark:text-zinc-300",children:["Build ",
4331
4331
  /* @__PURE__ */M("span",{className:"font-semibold",children:['"',t,'"']})," on:"]}),
4332
4332
  /* @__PURE__ */M("div",{className:"mb-2 flex gap-1",children:[/* @__PURE__ */P("button",{onClick:S,className:ge("rounded border px-2 py-0.5 font-mono text-[10px]",{"border-zinc-400 bg-zinc-200 text-zinc-700 dark:border-zinc-500 dark:bg-zinc-700 dark:text-zinc-200":"page"===y,"border-zinc-200 text-zinc-500 hover:border-zinc-300 dark:border-zinc-700 dark:text-zinc-400":"page"!==y}),children:"Current Page"}),h&&/* @__PURE__ */P("button",{onClick:C,className:ge("rounded border px-2 py-0.5 font-mono text-[10px]",{"border-zinc-400 bg-zinc-200 text-zinc-700 dark:border-zinc-500 dark:bg-zinc-700 dark:text-zinc-200":"element"===y,"border-zinc-200 text-zinc-500 hover:border-zinc-300 dark:border-zinc-700 dark:text-zinc-400":"element"!==y}),children:"Selected Element"})]}),"element"===y&&h&&/* @__PURE__ */M("p",{className:"mb-1.5 font-mono text-[10px] text-zinc-400 dark:text-zinc-600",children:["Will be added as children of ",/* @__PURE__ */M("span",{className:"text-orange-500",children:['"',h,'"']})]}),
4333
- /* @__PURE__ */M("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */P("button",{onClick:k,className:"rounded border border-zinc-200 px-2.5 py-1 font-mono text-zinc-500 hover:bg-zinc-100 dark:border-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Cancel"}),/* @__PURE__ */P("button",{onClick:E,className:"rounded bg-zinc-800 px-2.5 py-1 font-mono text-white hover:bg-zinc-700 dark:bg-zinc-200 dark:text-zinc-900 dark:hover:bg-zinc-100",children:"Confirm & Build"})]})]}),!v&&/* @__PURE__ */M("div",{className:"flex items-center justify-end gap-2 border-t border-zinc-100 bg-zinc-50 px-3 py-1 dark:border-zinc-700/60 dark:bg-zinc-900/60",children:[/* @__PURE__ */P("button",{onClick:O,className:"rounded border border-zinc-300 px-2.5 py-1 font-mono text-zinc-600 hover:bg-zinc-100 dark:border-zinc-600 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Apply to Page"}),/* @__PURE__ */P("button",{disabled:!0,title:"Coming soon",className:"cursor-not-allowed rounded border border-zinc-200 px-2.5 py-1 font-mono text-zinc-400 dark:border-zinc-700 dark:text-zinc-600",children:"Save as Template"})]})]})},pNe=({elementId:e,schema:t,style:n})=>{const[r]=oa(`schema.flat.${e}`),i=k(()=>({schema:t,style:n}),[t,n]),a=!!t;if(!a&&!r)/* @__PURE__ */return M("div",{className:"mt-2 overflow-hidden rounded-md border border-gray-200 dark:border-zinc-700",children:[/* @__PURE__ */M("div",{className:"border-b border-gray-100 bg-gray-50 px-3 py-1 font-mono text-xs text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",children:["preview · ",e]}),/* @__PURE__ */M("div",{className:"flex h-20 items-center justify-center font-mono text-xs text-zinc-400 dark:text-zinc-600",children:["element not found · ",e]})]});let o=/* @__PURE__ */P(wde,{id:e,className:"h-full w-full",previewMode:!0});return a&&(o=/* @__PURE__ */P(Fi,{value:i,middlewares:[d9(no("ai-preview"))],children:o})),/* @__PURE__ */M("div",{className:"mt-2 overflow-hidden rounded-md border border-gray-200 dark:border-zinc-700",children:[/* @__PURE__ */M("div",{className:"border-b border-gray-100 bg-gray-50 px-3 py-1 font-mono text-xs text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",children:["preview · ",e]}),/* @__PURE__ */P(Vj,{className:"flex min-h-40 w-full items-center justify-center overflow-hidden bg-white dark:bg-zinc-950",children:o})]})},mNe=({visual:e,mode:t,previewConceptVersion:n,wireframeVersion:r})=>"style_guide"===e.type?/* @__PURE__ */P(iNe,{...e.data,mode:t}):"brand"===e.type?/* @__PURE__ */P(Fze,{...e.data,mode:t}):"color_palette"===e.type?/* @__PURE__ */P(Xze,{...e.data,mode:t}):"wireframe"===e.type?/* @__PURE__ */P(fNe,{...e.data,mode:t,version:r}):"preview_element"===e.type?/* @__PURE__ */P(pNe,{elementId:e.data.elementId,schema:e.data.schema,style:e.data.style}):/* @__PURE__ */P(cNe,{baseElementId:e.data.baseElementId,schema:e.data.schema,style:e.data.style,html:e.data.html,mode:t,version:n}),gNe={plitzi_search:"Searching the space",plitzi_read:"Reading resources",plitzi_validate:"Validating changes",plitzi_apply:"Applying changes",plitzi_preview:"Rendering preview",plitzi_screenshot:"Capturing screenshot",preview_element:"Previewing element",preview_concept:"Previewing concept",sketch_wireframe:"Sketching wireframe",design_color_palette:"Designing color palette",design_brand_identity:"Designing brand identity",design_style_guide:"Designing style guide",get_element_types:"Reading element types",get_style_tokens:"Reading style tokens",ask_question:"Asking a question",flag_irrelevant:"Reviewing relevance"},vNe={get:"Reading",list:"Reading",read:"Reading",create:"Creating",add:"Adding",update:"Updating",set:"Updating",delete:"Deleting",remove:"Removing",move:"Moving",clone:"Duplicating",publish:"Publishing",apply:"Applying",validate:"Validating",search:"Searching",preview:"Previewing",render:"Rendering",sketch:"Sketching",design:"Designing",flag:"Reviewing"},bNe=e=>{const t=gNe[e];if(t)return t;const n=e.split("_"),r=vNe[n[0]],i=(r?n.slice(1):n).join(" ");return r?i?`${r} ${i}`:r:i?i.charAt(0).toUpperCase()+i.slice(1):e},yNe=({name:e,args:t,status:n,result:r,error:i})=>{const[a,o]=z(!1),[s,l]=z(!1),c=i??(r&&"object"==typeof r&&"error"in r?String(r.error):void 0),d="failed"===n||!!c,u=!!t&&Object.keys(t).length>0,h=null!=r&&!c,f=u||h,p=JSON.stringify({tool:e,...u?{args:t}:{},...h?{result:r}:{}},null,2),m=g(()=>{navigator.clipboard.writeText(p).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},[p]);/* @__PURE__ */
4333
+ /* @__PURE__ */M("div",{className:"flex justify-end gap-2",children:[/* @__PURE__ */P("button",{onClick:k,className:"rounded border border-zinc-200 px-2.5 py-1 font-mono text-zinc-500 hover:bg-zinc-100 dark:border-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Cancel"}),/* @__PURE__ */P("button",{onClick:E,className:"rounded bg-zinc-800 px-2.5 py-1 font-mono text-white hover:bg-zinc-700 dark:bg-zinc-200 dark:text-zinc-900 dark:hover:bg-zinc-100",children:"Confirm & Build"})]})]}),!v&&/* @__PURE__ */M("div",{className:"flex items-center justify-end gap-2 border-t border-zinc-100 bg-zinc-50 px-3 py-1 dark:border-zinc-700/60 dark:bg-zinc-900/60",children:[/* @__PURE__ */P("button",{onClick:O,className:"rounded border border-zinc-300 px-2.5 py-1 font-mono text-zinc-600 hover:bg-zinc-100 dark:border-zinc-600 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Apply to Page"}),/* @__PURE__ */P("button",{disabled:!0,title:"Coming soon",className:"cursor-not-allowed rounded border border-zinc-200 px-2.5 py-1 font-mono text-zinc-400 dark:border-zinc-700 dark:text-zinc-600",children:"Save as Template"})]})]})},pNe=({elementId:e,schema:t,style:n})=>{const[r]=oa(`schema.flat.${e}`),i=k(()=>({schema:t,style:n}),[t,n]),a=!!t;if(!a&&!r)/* @__PURE__ */return M("div",{className:"mt-2 overflow-hidden rounded-md border border-gray-200 dark:border-zinc-700",children:[/* @__PURE__ */M("div",{className:"border-b border-gray-100 bg-gray-50 px-3 py-1 font-mono text-xs text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",children:["preview · ",e]}),/* @__PURE__ */M("div",{className:"flex h-20 items-center justify-center font-mono text-xs text-zinc-400 dark:text-zinc-600",children:["element not found · ",e]})]});let o=/* @__PURE__ */P(wde,{id:e,className:"h-full w-full",previewMode:!0});return a&&(o=/* @__PURE__ */P(Fi,{value:i,middlewares:[d9(no("ai-preview"))],children:o})),/* @__PURE__ */M("div",{className:"mt-2 overflow-hidden rounded-md border border-gray-200 dark:border-zinc-700",children:[/* @__PURE__ */M("div",{className:"border-b border-gray-100 bg-gray-50 px-3 py-1 font-mono text-xs text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",children:["preview · ",e]}),/* @__PURE__ */P(Vj,{className:"flex min-h-40 w-full items-center justify-center overflow-hidden bg-white dark:bg-zinc-950",children:o})]})},mNe=({visual:e,mode:t,previewConceptVersion:n,wireframeVersion:r})=>"style_guide"===e.type?/* @__PURE__ */P(iNe,{...e.data,mode:t}):"brand"===e.type?/* @__PURE__ */P(Fze,{...e.data,mode:t}):"color_palette"===e.type?/* @__PURE__ */P(Xze,{...e.data,mode:t}):"wireframe"===e.type?/* @__PURE__ */P(fNe,{...e.data,mode:t,version:r}):"preview_element"===e.type?/* @__PURE__ */P(pNe,{elementId:e.data.elementId,schema:e.data.schema,style:e.data.style}):/* @__PURE__ */P(cNe,{baseElementId:e.data.baseElementId,schema:e.data.schema,style:e.data.style,html:e.data.html,mode:t,version:n}),gNe={plitzi_search:"Searching the space",plitzi_read:"Reading resources",plitzi_validate:"Validating changes",plitzi_apply:"Applying changes",plitzi_preview:"Rendering preview",plitzi_screenshot:"Capturing screenshot",preview_element:"Previewing element",preview_concept:"Previewing concept",sketch_wireframe:"Sketching wireframe",design_color_palette:"Designing color palette",design_brand_identity:"Designing brand identity",design_style_guide:"Designing style guide",ask_question:"Asking a question",flag_irrelevant:"Reviewing relevance"},vNe={get:"Reading",list:"Reading",read:"Reading",create:"Creating",add:"Adding",update:"Updating",set:"Updating",delete:"Deleting",remove:"Removing",move:"Moving",clone:"Duplicating",publish:"Publishing",apply:"Applying",validate:"Validating",search:"Searching",preview:"Previewing",render:"Rendering",sketch:"Sketching",design:"Designing",flag:"Reviewing"},bNe=e=>{const t=gNe[e];if(t)return t;const n=e.split("_"),r=vNe[n[0]],i=(r?n.slice(1):n).join(" ");return r?i?`${r} ${i}`:r:i?i.charAt(0).toUpperCase()+i.slice(1):e},yNe=({name:e,args:t,status:n,result:r,error:i})=>{const[a,o]=z(!1),[s,l]=z(!1),c=i??(r&&"object"==typeof r&&"error"in r?String(r.error):void 0),d="failed"===n||!!c,u=!!t&&Object.keys(t).length>0,h=null!=r&&!c,f=u||h,p=JSON.stringify({tool:e,...u?{args:t}:{},...h?{result:r}:{}},null,2),m=g(()=>{navigator.clipboard.writeText(p).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},[p]);/* @__PURE__ */
4334
4334
  return M("div",{className:"flex min-w-0 flex-col py-0.5 pl-3 font-mono text-[10px]",children:[
4335
4335
  /* @__PURE__ */M("button",{type:"button",disabled:!f,onClick:()=>o(e=>!e),className:ge("group flex min-w-0 items-center gap-2 text-left",{"cursor-pointer":f}),children:[
4336
4336
  /* @__PURE__ */M("span",{className:"shrink-0",children:["running"===n&&/* @__PURE__ */P("span",{className:"animate-spin text-yellow-500 dark:text-yellow-400",children:"⚙"}),"interrupted"===n&&/* @__PURE__ */P("span",{className:"text-amber-500 dark:text-amber-400",children:"⚠"}),("failed"===n||"running"!==n&&"interrupted"!==n&&d)&&/* @__PURE__ */P("span",{className:"text-pink-500 dark:text-pink-400",children:"✗"}),"done"===n&&!c&&/* @__PURE__ */P("span",{className:"text-emerald-500 dark:text-emerald-400",children:"✓"})]}),
@@ -4465,7 +4465,7 @@ return M(Wv,{direction:"column",gap:2,className:"segments w-full p-2",children:[
4465
4465
  return P(zEe,{id:n,identifier:r,name:i,description:a,variables:o,onParentRefresh:u},t)})})]})},EEe=({className:e=""})=>{const{theme:t}=m(o9),[n=da,r]=oa("runtime.state"),[i,a]=z(()=>JSON.stringify(n,null,2)),{addToast:o}=y3(),s=g(e=>a(e),[]),l=g(()=>{try{r(JSON.parse(i)),a(JSON.stringify(JSON.parse(i),null,2))}catch{o("Json Malformed, Please fix it and try again",{appeareance:"error",autoDismiss:!0,placement:"top-right"})}},[r,i,o]);return $V(()=>{a(JSON.stringify(n,null,2))},[n]),/* @__PURE__ */M("div",{className:ge("relative flex h-full w-full flex-col",e),children:[/* @__PURE__ */P(JV,{className:"h-full",value:i,theme:"dark"===t?"dark":"light",lineWrapping:!0,onChange:s,mode:"json"}),/* @__PURE__ */P("div",{className:"absolute top-3 right-3 flex",children:/* @__PURE__ */P(gb,{intent:"custom",size:"custom",className:"mr-2 rounded-sm bg-white p-2 text-zinc-800 shadow dark:bg-zinc-700 dark:text-zinc-200",onClick:l,title:"Save State",children:/* @__PURE__ */P("i",{className:"fa-solid fa-floppy-disk"})})})]})},AEe=({indexLimit:e=0,index:t=0,onClickRemove:n,onClickUp:r,onClickDown:i})=>/* @__PURE__ */M("div",{className:"flex gap-2",children:[
4466
4466
  /* @__PURE__ */P(gb,{intent:"danger",size:"xs",onClick:n,title:"Remove",className:"aspect-square",children:/* @__PURE__ */P("i",{className:"fas fa-trash-alt"})}),t>0&&/* @__PURE__ */P(gb,{size:"xs",className:"aspect-square",title:"Up",onClick:r,children:/* @__PURE__ */P("i",{className:"fa-solid fa-arrow-up"})}),t<e&&/* @__PURE__ */P(gb,{size:"xs",className:"aspect-square",title:"Down",onClick:i,children:/* @__PURE__ */P("i",{className:"fa-solid fa-arrow-down"})})]}),TEe=({valueType:e="text",hasSubValues:t=!1,name:n="value",index:r,indexLimit:i,isSubValue:a=!1,onClickRemove:o,onClickUp:s,onClickDown:l})=>{let c=t?"Fallback Value":"Value",d=t?"Fallback Value":"Value";/* @__PURE__ */
4467
4467
  return M("div",{className:"flex items-end gap-2",children:[["text","email","password","number"].includes(e)&&/* @__PURE__ */P(ZX.Input,{type:e,name:n,label:c,placeholder:d,size:"xs",className:"w-full min-w-0"}),"select"===e&&/* @__PURE__ */P(ZX.Select,{name:n,label:c,placeholder:d,size:"xs",className:"w-full min-w-0"}),"select2"===e&&/* @__PURE__ */P(ZX.Select2,{name:n,label:c,placeholder:d,size:"xs",className:"w-full min-w-0"}),"textarea"===e&&/* @__PURE__ */P(ZX.TextArea,{name:n,label:c,placeholder:d,size:"xs",className:"w-full min-w-0"}),"switch"===e&&/* @__PURE__ */P(ZX.Switch,{name:n,label:c,placeholder:d,size:"xs",className:"w-full min-w-0"}),"checkbox"===e&&/* @__PURE__ */P(ZX.Checkbox,{name:n,label:c,placeholder:d,size:"xs",className:"w-full min-w-0"}),"color"===e&&/* @__PURE__ */P(ZX.Color,{name:n,label:c,placeholder:d,size:"xs",className:"w-full min-w-0"}),a&&/* @__PURE__ */P(AEe,{index:r,indexLimit:i,onClickRemove:o,onClickUp:s,onClickDown:l})]})},PEe=({index:e=0,valueType:t="text",whenData:n,indexLimit:r,onClickRemove:i,onClickUp:a,onClickDown:o})=>{let s=k(()=>ha(n).reduce((e,t)=>({...e,[t]:{name:t,label:t,placeholder:`Enter ${t}`}}),{}),[n]);/* @__PURE__ */
4468
- return M("div",{className:"flex min-w-0 grow basis-0 flex-col gap-3 rounded-sm border border-gray-300 p-2",children:[/* @__PURE__ */P(TEe,{valueType:t,name:`subValues.${e}.value`,isSubValue:!0,index:e,indexLimit:r,onClickRemove:i,onClickUp:a,onClickDown:o}),/* @__PURE__ */P(ZX.Custom,{name:`subValues.${e}.when`,render:({field:{ref:e,value:t,onChange:n},fieldState:{error:r}})=>/* @__PURE__ */M("div",{className:"flex flex-col gap-1",ref:e,children:[/* @__PURE__ */P(WX,{as:"h5",children:"When Happens"}),/* @__PURE__ */P("div",{className:"flex flex-col",children:/* @__PURE__ */P(O5,{direction:"vertical",intent:"gray",className:"w-full",query:t,fields:s,onChange:n,showBranches:!0,error:!!r?.message})})]})})]})},MEe=Bne({name:rne().min(4).regex(/^(?:\w+\s+|)([a-zA-Z_][a-zA-Z0-9_]+)$/i,{message:"Name only can be letters, numbers and _ -"}),category:rne(),type:_ne(["text","number","email","password","select","select2","checkbox","textarea","color","switch"]),value:rne().min(3),subValues:jne(Hne(rne(),Pne())).optional()}),IEe=({name:e="variable",category:n="",value:r="",type:i="text",subValues:a,whenData:o,isNewRecord:s=!1,onSubmit:l,onClose:c})=>{let d=VX({defaultValues:{name:e,value:String(r),category:n,type:i,subValues:a},config:{schema:MEe}}),{fields:u,append:h,remove:f,move:p}=function(e){const n=uB(),{control:r=n,name:i,keyName:a="id",disabled:o,shouldUnregister:s,rules:l}=e,[c,d]=t.useState(r._getFieldArray(i)),u=t.useRef(r._getFieldArray(i).map(wB)),h=t.useRef(!1);o||r._names.array.add(i),t.useMemo(()=>!o&&l&&c.length>=0&&r.register(i,l),[r,i,c.length,l,o]),fB(()=>{if(!o)return r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===i||!t){const n=oB(e,i);Array.isArray(n)?(d(n),u.current=n.map(wB)):t||(d([]),u.current=[])}}}).unsubscribe},[r,i,o]);const f=t.useCallback(e=>{h.current=!0,r._setFieldArray(i,e)},[r,i]);return t.useEffect(()=>{if(o)return;r._state.action=!1,SB(i,r._names)&&r._subjects.state.next({...r._formState});const e=kB(r._options.mode);if(h.current&&(!e.isOnSubmit||r._formState.isSubmitted)&&!kB(r._options.reValidateMode).isOnSubmit&&!e.isOnBlur)if(r._options.resolver)r._runSchema([i]).then(e=>{var t,n;r._updateIsValidating([i]);const a=oB(e.errors,i),o=oB(r._formState.errors,i),s=o&&(o.type||(null===(t=o.root)||void 0===t?void 0:t.type)),l=o&&(o.message||(null===(n=o.root)||void 0===n?void 0:n.message));(o?!a&&s||a&&(s!==a.type||l!==a.message):a&&a.type)&&(a?jF(a)&&!Object.keys(a).some(e=>!Number.isNaN(+e))?zB(r._formState.errors,{[i]:a},i):cB(r._formState.errors,i,a):GB(r._formState.errors,i),r._subjects.state.next({errors:r._formState.errors}))});else{const e=oB(r._fields,i);!e||!e._f||kB(r._options.reValidateMode).isOnSubmit&&kB(r._options.mode).isOnSubmit||FB(e,r._names.disabled,r._formValues,r._options.criteriaMode===_F,r._options.shouldUseNativeValidation,!0).then(e=>!NB(e)&&r._subjects.state.next({errors:zB(r._formState.errors,e,i)}))}h.current&&r._subjects.state.next({name:i,values:UF(r._formValues)}),r._names.focus&&CB(r._fields,(e,t)=>{if(r._names.focus&&t.startsWith(r._names.focus)&&e.focus)return e.focus(),1}),r._names.focus="",r._setValid(),h.current=!1},[c,i,r,o]),t.useEffect(()=>(o||!oB(r._formValues,i)&&r._setFieldArray(i),()=>{if(o)return;const e=!(r._options.shouldUnregister||s);h.current&&e&&r._subjects.state.next({name:i,values:UF(r._formValues)}),e?(e=>{const t=oB(r._fields,e);t&&t._f&&(t._f.mount=!1)})(i):r.unregister(i)}),[i,r,a,s,o]),{swap:t.useCallback((e,t)=>{if(o)return;const n=r._getFieldArray(i);_B(n,e,t),_B(u.current,e,t),f(n),d(n),r._setFieldArray(i,n,_B,{argA:e,argB:t},!1)},[f,i,r,o]),move:t.useCallback((e,t)=>{if(o)return;const n=r._getFieldArray(i);WB(n,e,t),WB(u.current,e,t),f(n),d(n),r._setFieldArray(i,n,WB,{argA:e,argB:t},!1)},[f,i,r,o]),prepend:t.useCallback((e,t)=>{if(o)return;const n=BB(UF(e)),a=XB(r._getFieldArray(i),n);r._names.focus=OB(i,0,t),u.current=XB(u.current,n.map(wB)),f(a),d(a),r._setFieldArray(i,a,XB,{argA:ZB(e)})},[f,i,r,o]),append:t.useCallback((e,t)=>{if(o)return;const n=BB(UF(e)),a=qB(r._getFieldArray(i),n);r._names.focus=OB(i,a.length-1,t),u.current=qB(u.current,n.map(wB)),f(a),d(a),r._setFieldArray(i,a,qB,{argA:ZB(e)})},[f,i,r,o]),remove:t.useCallback(e=>{if(o)return;const t=YB(r._getFieldArray(i),e);u.current=YB(u.current,e),f(t),d(t),!Array.isArray(oB(r._fields,i))&&cB(r._fields,i,void 0),r._setFieldArray(i,t,YB,{argA:e})},[f,i,r,o]),insert:t.useCallback((e,t,n)=>{if(o)return;const a=BB(UF(t)),s=UB(r._getFieldArray(i),e,a);r._names.focus=OB(i,e,n),u.current=UB(u.current,e,a.map(wB)),f(s),d(s),r._setFieldArray(i,s,UB,{argA:e,argB:ZB(t)})},[f,i,r,o]),update:t.useCallback((e,t)=>{if(o)return;const n=UF(t),a=KB(r._getFieldArray(i),e,n);u.current=[...a].map((t,n)=>t&&n!==e?u.current[n]:wB()),f(a),d([...a]),r._setFieldArray(i,a,KB,{argA:e,argB:n},!0,!1)},[f,i,r,o]),replace:t.useCallback(e=>{if(o)return;const t=BB(UF(e));u.current=t.map(wB),f([...t]),d([...t]),r._setFieldArray(i,[...t],e=>e,{},!0,!1)},[f,i,r,o]),fields:t.useMemo(()=>c.map((e,t)=>({...e,...sB(o)?{disabled:o}:{},[a]:u.current[t]||wB()})),[c,a,o])}}({control:d.formMethods.control,name:"subValues",rules:{minLength:0}}),m=QX(d.formMethods,"type"),v=QX(d.formMethods,"subValues"),b=g(e=>l?.(e),[l]),y=v&&v.length>0,x=g(()=>h({value:"",when:void 0}),[h]),w=g(e=>()=>{e>0&&p(e,e-1)},[p]),O=g(e=>()=>{e<u.length-1&&p(e,e+1)},[u,p]),k=g(e=>()=>f(e),[f]),S=g(()=>{d.formMethods.setValue("value","")},[d]);/* @__PURE__ */
4468
+ return M("div",{className:"flex min-w-0 grow basis-0 flex-col gap-3 rounded-sm border border-gray-300 p-2",children:[/* @__PURE__ */P(TEe,{valueType:t,name:`subValues.${e}.value`,isSubValue:!0,index:e,indexLimit:r,onClickRemove:i,onClickUp:a,onClickDown:o}),/* @__PURE__ */P(ZX.Custom,{name:`subValues.${e}.when`,render:({field:{ref:e,value:t,onChange:n},fieldState:{error:r}})=>/* @__PURE__ */M("div",{className:"flex flex-col gap-1",ref:e,children:[/* @__PURE__ */P(WX,{as:"h5",children:"When Happens"}),/* @__PURE__ */P("div",{className:"flex flex-col",children:/* @__PURE__ */P(O5,{direction:"vertical",intent:"gray",className:"w-full",query:t,fields:s,onChange:n,showBranches:!0,error:!!r?.message})})]})})]})},MEe=Bne({name:rne().min(4).regex(/^(?:\w+\s+|)([a-zA-Z_][a-zA-Z0-9_]+)$/i,{message:"Name only can be letters, numbers and _ -"}),category:rne(),type:_ne(["text","number","email","password","select","select2","checkbox","textarea","color","switch"]),value:rne().min(3),subValues:jne(Hne(rne(),Pne())).optional()}),IEe=({name:e="variable",category:n="",value:r="",type:i="text",subValues:a,whenData:o,isNewRecord:s=!1,onSubmit:l,onClose:c})=>{let d=VX({defaultValues:{name:e,value:String(r),category:n,type:i,subValues:a},config:{schema:MEe}}),{fields:u,append:h,remove:f,move:p}=function(e){const n=hB(),{control:r=n,name:i,keyName:a="id",disabled:o,shouldUnregister:s,rules:l}=e,[c,d]=t.useState(r._getFieldArray(i)),u=t.useRef(r._getFieldArray(i).map(OB)),h=t.useRef(!1);o||r._names.array.add(i),t.useMemo(()=>!o&&l&&c.length>=0&&r.register(i,l),[r,i,c.length,l,o]),pB(()=>{if(!o)return r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===i||!t){const n=sB(e,i);Array.isArray(n)?(d(n),u.current=n.map(OB)):t||(d([]),u.current=[])}}}).unsubscribe},[r,i,o]);const f=t.useCallback(e=>{h.current=!0,r._setFieldArray(i,e)},[r,i]);return t.useEffect(()=>{if(o)return;r._state.action=!1,CB(i,r._names)&&r._subjects.state.next({...r._formState});const e=SB(r._options.mode);if(h.current&&(!e.isOnSubmit||r._formState.isSubmitted)&&!SB(r._options.reValidateMode).isOnSubmit&&!e.isOnBlur)if(r._options.resolver)r._runSchema([i]).then(e=>{var t,n;r._updateIsValidating([i]);const a=sB(e.errors,i),o=sB(r._formState.errors,i),s=o&&(o.type||(null===(t=o.root)||void 0===t?void 0:t.type)),l=o&&(o.message||(null===(n=o.root)||void 0===n?void 0:n.message));(o?!a&&s||a&&(s!==a.type||l!==a.message):a&&a.type)&&(a?FF(a)&&!Object.keys(a).some(e=>!Number.isNaN(+e))?NB(r._formState.errors,{[i]:a},i):dB(r._formState.errors,i,a):GB(r._formState.errors,i),r._subjects.state.next({errors:r._formState.errors}))});else{const e=sB(r._fields,i);!e||!e._f||SB(r._options.reValidateMode).isOnSubmit&&SB(r._options.mode).isOnSubmit||FB(e,r._names.disabled,r._formValues,r._options.criteriaMode===GF,r._options.shouldUseNativeValidation,!0).then(e=>!EB(e)&&r._subjects.state.next({errors:NB(r._formState.errors,e,i)}))}h.current&&r._subjects.state.next({name:i,values:WF(r._formValues)}),r._names.focus&&zB(r._fields,(e,t)=>{if(r._names.focus&&t.startsWith(r._names.focus)&&e.focus)return e.focus(),1}),r._names.focus="",r._setValid(),h.current=!1},[c,i,r,o]),t.useEffect(()=>(o||!sB(r._formValues,i)&&r._setFieldArray(i),()=>{if(o)return;const e=!(r._options.shouldUnregister||s);h.current&&e&&r._subjects.state.next({name:i,values:WF(r._formValues)}),e?(e=>{const t=sB(r._fields,e);t&&t._f&&(t._f.mount=!1)})(i):r.unregister(i)}),[i,r,a,s,o]),{swap:t.useCallback((e,t)=>{if(o)return;const n=r._getFieldArray(i);_B(n,e,t),_B(u.current,e,t),f(n),d(n),r._setFieldArray(i,n,_B,{argA:e,argB:t},!1)},[f,i,r,o]),move:t.useCallback((e,t)=>{if(o)return;const n=r._getFieldArray(i);WB(n,e,t),WB(u.current,e,t),f(n),d(n),r._setFieldArray(i,n,WB,{argA:e,argB:t},!1)},[f,i,r,o]),prepend:t.useCallback((e,t)=>{if(o)return;const n=BB(WF(e)),a=XB(r._getFieldArray(i),n);r._names.focus=kB(i,0,t),u.current=XB(u.current,n.map(OB)),f(a),d(a),r._setFieldArray(i,a,XB,{argA:ZB(e)})},[f,i,r,o]),append:t.useCallback((e,t)=>{if(o)return;const n=BB(WF(e)),a=qB(r._getFieldArray(i),n);r._names.focus=kB(i,a.length-1,t),u.current=qB(u.current,n.map(OB)),f(a),d(a),r._setFieldArray(i,a,qB,{argA:ZB(e)})},[f,i,r,o]),remove:t.useCallback(e=>{if(o)return;const t=YB(r._getFieldArray(i),e);u.current=YB(u.current,e),f(t),d(t),!Array.isArray(sB(r._fields,i))&&dB(r._fields,i,void 0),r._setFieldArray(i,t,YB,{argA:e})},[f,i,r,o]),insert:t.useCallback((e,t,n)=>{if(o)return;const a=BB(WF(t)),s=UB(r._getFieldArray(i),e,a);r._names.focus=kB(i,e,n),u.current=UB(u.current,e,a.map(OB)),f(s),d(s),r._setFieldArray(i,s,UB,{argA:e,argB:ZB(t)})},[f,i,r,o]),update:t.useCallback((e,t)=>{if(o)return;const n=WF(t),a=KB(r._getFieldArray(i),e,n);u.current=[...a].map((t,n)=>t&&n!==e?u.current[n]:OB()),f(a),d([...a]),r._setFieldArray(i,a,KB,{argA:e,argB:n},!0,!1)},[f,i,r,o]),replace:t.useCallback(e=>{if(o)return;const t=BB(WF(e));u.current=t.map(OB),f([...t]),d([...t]),r._setFieldArray(i,[...t],e=>e,{},!0,!1)},[f,i,r,o]),fields:t.useMemo(()=>c.map((e,t)=>({...e,...lB(o)?{disabled:o}:{},[a]:u.current[t]||OB()})),[c,a,o])}}({control:d.formMethods.control,name:"subValues",rules:{minLength:0}}),m=QX(d.formMethods,"type"),v=QX(d.formMethods,"subValues"),b=g(e=>l?.(e),[l]),y=v&&v.length>0,x=g(()=>h({value:"",when:void 0}),[h]),w=g(e=>()=>{e>0&&p(e,e-1)},[p]),O=g(e=>()=>{e<u.length-1&&p(e,e+1)},[u,p]),k=g(e=>()=>f(e),[f]),S=g(()=>{d.formMethods.setValue("value","")},[d]);/* @__PURE__ */
4469
4469
  return M(ZX,{form:d,onSubmit:b,className:"gap-4 rounded border border-gray-300 bg-slate-100 p-2",children:[/* @__PURE__ */M(ZX.Body,{gap:2,children:[
4470
4470
  /* @__PURE__ */M("div",{className:"flex gap-4",children:[/* @__PURE__ */P(ZX.Input,{name:"name",label:"Name",size:"xs",disabled:!s,className:"w-full grow basis-0"}),/* @__PURE__ */M(ZX.Select,{name:"type",label:"Type",size:"xs",onChange:S,className:"w-full grow basis-0",children:[
4471
4471
  /* @__PURE__ */P("option",{value:"text",children:"Text"}),
@@ -4508,5 +4508,5 @@ return P(So,{value:k(()=>({collections:a,fetchCollections:b,fetchCollection:y,ad
4508
4508
  return P(Nte,{value:k(()=>({baseAssets:I,assets:R,plugins:r,dispatchPlugins:i,fetch:x,add:w,setSettings:N,getSettings:C,update:O,remove:E,registerCustomAssets:A,unregisterCustomAssets:T,pluginSettingsStyles:D}),[I,R,r,i,x,w,A,T,N,C,O,E,D]),children:e})},pAe={SCHEMA_UPDATE:"SCHEMA_UPDATE",SCHEMA_ADD_PAGE:"SCHEMA_ADD_PAGE",SCHEMA_HOME_PAGE:"SCHEMA_HOME_PAGE",SCHEMA_UPDATE_PAGE:"SCHEMA_UPDATE_PAGE",SCHEMA_REMOVE_PAGE:"SCHEMA_REMOVE_PAGE",SCHEMA_ADD_PAGE_FOLDER:"SCHEMA_ADD_PAGE_FOLDER",SCHEMA_UPDATE_PAGE_FOLDER:"SCHEMA_UPDATE_PAGE_FOLDER",SCHEMA_REMOVE_PAGE_FOLDER:"SCHEMA_REMOVE_PAGE_FOLDER",SCHEMA_ADD_VARIABLE:"SCHEMA_ADD_VARIABLE",SCHEMA_UPDATE_VARIABLE:"SCHEMA_UPDATE_VARIABLE",SCHEMA_REMOVE_VARIABLE:"SCHEMA_REMOVE_VARIABLE",SCHEMA_ADD_ELEMENT:"SCHEMA_ADD_ELEMENT",SCHEMA_REMOVE_ELEMENT:"SCHEMA_REMOVE_ELEMENT",SCHEMA_MOVE_ELEMENT:"SCHEMA_MOVE_ELEMENT",SCHEMA_CLONE_ELEMENT:"SCHEMA_CLONE_ELEMENT",SCHEMA_UPDATE_ELEMENT:"SCHEMA_UPDATE_ELEMENT",SCHEMA_UPDATE_ELEMENTS:"SCHEMA_UPDATE_ELEMENTS",SCHEMA_ADD_TEMPLATE:"SCHEMA_ADD_TEMPLATE",SCHEMA_UPDATE_SETTINGS:"SCHEMA_UPDATE_SETTINGS"},mAe=(e,t)=>{switch(t.type){case pAe.SCHEMA_UPDATE:return{...e,...t.schema};case pAe.SCHEMA_ADD_PAGE:{let{page:n}=t;return qr(e,e=>{re(e,"flat",{...e.flat,[n.id]:n}),e.pages.push(n.id)})}case pAe.SCHEMA_HOME_PAGE:{let n,{flat:r,pages:i}=e,{pageId:a}=t;return i.forEach(e=>{if(n)return;let t=r[e];ne(t,"attributes.default",!1)&&(n=t)}),qr(e,n?e=>{re(e.flat,`${a}.attributes.default`,!0),re(e.flat,`${n.id}.attributes.default`,!1)}:e=>{re(e.flat,`${a}.attributes.default`,!0)})}case pAe.SCHEMA_UPDATE_PAGE:{let{page:n}=t;return qr(e,e=>{re(e.flat,n.id,n)})}case pAe.SCHEMA_REMOVE_PAGE:{let{pageId:n}=t;return qr(e,e=>{Zle.removeElement(e.flat,n,!0),e.pages=e.pages.filter(e=>e!==n)})}case pAe.SCHEMA_ADD_PAGE_FOLDER:{let{pageFolder:n}=t;return qr(e,e=>{e.pageFolders.push(n)})}case pAe.SCHEMA_UPDATE_PAGE_FOLDER:{let{pageFolder:n}=t;return qr(e,e=>{let t=e.pageFolders.findIndex(e=>e.id===n.id);-1!==t&&(e.pageFolders[t]=n)})}case pAe.SCHEMA_REMOVE_PAGE_FOLDER:{let{pageFolderId:n}=t;return qr(e,e=>{e.pageFolders=e.pageFolders.filter(e=>e.id!==n)})}case pAe.SCHEMA_ADD_VARIABLE:{let{variable:n}=t;return qr(e,e=>{e.variables||=[],e.variables.push(n)})}case pAe.SCHEMA_UPDATE_VARIABLE:{let{variable:n}=t;return e.variables?qr(e,e=>{let t=e.variables.findIndex(e=>e.name===n.name);e.variables[t]&&(e.variables[t]=n)}):e}case pAe.SCHEMA_REMOVE_VARIABLE:{let{name:n}=t;return e.variables?qr(e,e=>{e.variables=e.variables.filter(e=>e.name!==n)}):e}case pAe.SCHEMA_ADD_TEMPLATE:case pAe.SCHEMA_ADD_ELEMENT:{let{to:n,data:r,dropPosition:i,initialItems:a,variables:o=[]}=t;return qr(e,e=>{if(Zle.addElement(e.flat,r,n,i,a),o.length>0){let t=o.filter(t=>e.variables&&!e.variables.find(e=>e.name===t.name));re(e,"variables",[...e.variables??[],...t])}})}case pAe.SCHEMA_REMOVE_ELEMENT:{let{elementId:n}=t;return qr(e,e=>{Zle.removeElement(e.flat,n)})}case pAe.SCHEMA_MOVE_ELEMENT:{let{from:n,to:r,elementId:i,dropPosition:a}=t;return qr(e,e=>{Zle.moveElement(e.flat,n,r,i,a)})}case pAe.SCHEMA_CLONE_ELEMENT:{let{to:n,data:r,dropPosition:i,initialItems:a}=t;return qr(e,e=>{Zle.addElement(e.flat,r,n,i,a)})}case pAe.SCHEMA_UPDATE_ELEMENT:{let{element:n}=t;return qr(e,e=>{Zle.updateElement(e.flat,n)})}case pAe.SCHEMA_UPDATE_ELEMENTS:{let{elements:n}=t;return qr(e,e=>{n.forEach(t=>Zle.updateElement(e.flat,t))})}case pAe.SCHEMA_UPDATE_SETTINGS:{let{path:n,value:r}=t;return qr(e,t=>{n&&le(e.settings,n)?re(t.settings,n,r):n||re(t,"settings",r)})}default:return e}},gAe=(e,t,n)=>n?ne(e,`${t}.${n}`,void 0):void 0,vAe=e=>"string"==typeof e||"number"==typeof e||void 0===e,bAe=e=>"object"==typeof e&&!!e&&!Array.isArray(e),yAe=e=>bAe(e)&&Object.values(e).every(vAe),xAe=e=>bAe(e)&&Object.values(e).every(yAe),wAe=e=>bAe(e)&&Object.values(e).every(e=>!(!bAe(e)||"variants"in e||"default"in e&&e.default&&!yAe(e.default)||"states"in e&&e.states&&!xAe(e.states))),OAe=e=>!(!bAe(e)||!e.default||!yAe(e.default)||e.states&&!xAe(e.states)||e.variants&&!wAe(e.variants)),kAe=e=>void 0===e||bAe(e)&&!Object.keys(e).length||bAe(e)&&"base"in e&&Object.values(e).every(OAe),SAe=(e,t,n)=>{let{styleSelector:r,styleVariant:i,styleState:a}=n??{};return e||r||i||a?!(!e&&!r&&i&&a)&&(e||r||!i?e||r||!a?e?vAe(t):!!r&&(void 0===t||!(vAe(t)||!bAe(t))&&(yAe(t)||OAe(t))):xAe(t):wAe(t)):kAe(t)},CAe=(e="add",t,n,r,i,a,o)=>{let s=((e,t,n)=>t&&n?`attributes.${e}.variants.${t}.states.${n}`:t?`attributes.${e}.variants.${t}.default`:n?`attributes.${e}.states.${n}`:`attributes.${e}.default`)(n,o,a),l=!!a||!!o;if(void 0===i)if("add"!==e||r||!l)if(r)re(t,s,ce(ne(t,s,{}),[r]));else{if(o){let e=`attributes.${n}.variants`,r=ne(t,e);if(!r)return;let i=ce(r,[o]);return void(Object.keys(i).length?re(t,e,i):re(t,`attributes.${n}`,ce(ne(t,`attributes.${n}`),["variants"])))}if(a){let e=`attributes.${n}.states`,r=ne(t,e);if(!r)return;let i=ce(r,[a]);return void(Object.keys(i).length?re(t,e,i):re(t,`attributes.${n}`,ce(ne(t,`attributes.${n}`),["states"])))}re(t,s,{})}else ne(t,o?`attributes.${n}.variants`:`attributes.${n}.states`)||re(t,s,{});else{if(yAe(i)&&(e=>!!e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length)(i)){if("update"===e&&l&&!ne(t,o?`attributes.${n}.variants`:`attributes.${n}.states`))return;return void re(t,s,{})}re(t,s,((e,t,n)=>{if(e&&("string"==typeof t||"number"==typeof t))return{...n,[e]:t};if(t&&yAe(t)){let e={...t};for(let n in t)void 0===e[n]&&delete e[n];return e}return n})(r,i,ne(t,s,{})))}},zAe=class{platform;variables;constructor(e){let{platform:t,variables:n}=e;if(!t)throw Error("Platform Required");this.platform=t,this.variables=n??{}}static getInstance=e=>new this(e);addSelector(e,t,n,r,i,a){return((e,t,n,r,i,a,o)=>{if(!o)return!1;let{componentType:s,styleSelector:l,styleState:c,styleVariant:d}=o;if(gAe(e,t,n)||!s&&"element"===r||s&&"element"!==r||l&&"string"!=typeof l||!l&&(c||d)||i&&i.includes(".")||!SAe(i,a,o))return!1;let u={name:n,type:r,attributes:l?{[l]:{default:{}},base:{default:{}}}:{base:{default:{}}},componentType:s,cache:""};return!l&&kAe(a)?((!a||!Object.keys(a).length)&&(a={base:{default:{}}}),u.attributes=a,u.cache=Tse(u),re(e,`${t}.${n}`,u),!0):(CAe("add",u,l??"base",i,a,c,d),u.cache=Tse(u),re(e,`${t}.${n}`,u),!0)})(this.platform,e,t,n,r,i,a)}static addSelector(e,t,n,r,i,a,o){return this.getInstance(e).addSelector(t,n,r,i,a,o)}getSelector=(e,t)=>gAe(this.platform,e,t);static getSelector=(e,t,n)=>this.getInstance(e).getSelector(t,n);updateSelector(e,t,n,r,i){return((e,t,n,r,i,a)=>{if(!a)return!1;let{componentType:o,styleSelector:s,styleState:l,styleVariant:c}=a,d=gAe(e,t,n);return!(!d||!s||!o&&"element"===d.type||o&&"element"!==d.type||s&&"string"!=typeof s||r&&r.includes(".")||!SAe(r,i,a)||(CAe("update",d,s,r,i,l,c),re(d,"cache",Tse(d)),re(e,`${t}.${n}`,d),0))})(this.platform,e,t,n,r,i)}static updateSelector(e,t,n,r,i,a){return this.getInstance(e).updateSelector(t,n,r,i,a)}removeSelector=(e,t)=>{if(e)return!!this.platform[e][t]&&(delete this.platform[e][t],!0);let n=!1;return Object.keys(this.platform).forEach(e=>{this.platform[e][t]&&(n=!0,delete this.platform[e][t])}),n};static removeSelector=(e,t,n)=>this.getInstance(e).removeSelector(t,n);addSelectorVariable=(e,t,n,r,i)=>{let a=gAe(this.platform,e,t);return!(!a||ne(a,`variables.${n}.${r}`,"")||(re(a,`variables.${n}.${r}`,i),re(this.platform,`${e}.${t}.cache`,Tse(a)),0))};static addSelectorVariable=(e,t,n,r,i,a)=>this.getInstance(e).addSelectorVariable(t,n,r,i,a);updateSelectorVariable=(e,t,n,r,i)=>{let a=gAe(this.platform,e,t);return!!a&&(re(a,`variables.${n}.${r}`,i),re(this.platform,`${e}.${t}.cache`,Tse(a)),!0)};static updateSelectorVariable=(e,t,n,r,i,a)=>this.getInstance(e).updateSelectorVariable(t,n,r,i,a);removeSelectorVariable=(e,t,n,r)=>{let i=gAe(this.platform,e,t);return!!(i&&i.variables&&i.variables[n]&&i.variables[n][r])&&(delete i.variables[n][r],0===Object.keys(i.variables[n]).length&&delete i.variables[n],0===Object.keys(i.variables).length&&delete i.variables,re(this.platform,`${e}.${t}.cache`,Tse(i)),!0)};static removeSelectorVariable=(e,t,n,r,i)=>this.getInstance(e).removeSelectorVariable(t,n,r,i);addVariable=(e,t,n)=>(this.variables[e]||(this.variables[e]={}),!this.variables[e][t]&&(this.variables[e][t]=n,!0));static addVariable=(e,t,n,r)=>this.getInstance(e).addVariable(t,n,r);updateVariable=(e,t,n)=>!(!this.variables[e]||!this.variables[e][t]||(this.variables[e][t]=n,0));static updateVariable=(e,t,n,r)=>this.getInstance(e).updateVariable(t,n,r);removeVariable=(e,t)=>!(!this.variables[e]||!this.variables[e][t]||(delete this.variables[e][t],0===Object.keys(this.variables[e]).length&&delete this.variables[e],0));static removeVariable=(e,t,n)=>this.getInstance(e).removeVariable(t,n)},NAe={STYLE_UPDATE:"STYLE_UPDATE",STYLE_ADD_SELECTOR:"STYLE_ADD_SELECTOR",STYLE_UPDATE_SELECTOR:"STYLE_UPDATE_SELECTOR",STYLE_REMOVE_SELECTOR:"STYLE_REMOVE_SELECTOR",STYLE_REMOVE_SELECTORS:"STYLE_REMOVE_SELECTORS",STYLE_ADD_SELECTOR_VARIABLE:"STYLE_ADD_SELECTOR_VARIABLE",STYLE_UPDATE_SELECTOR_VARIABLE:"STYLE_UPDATE_SELECTOR_VARIABLE",STYLE_REMOVE_SELECTOR_VARIABLE:"STYLE_REMOVE_SELECTOR_VARIABLE",STYLE_ADD_VARIABLE:"STYLE_ADD_VARIABLE",STYLE_UPDATE_VARIABLE:"STYLE_UPDATE_VARIABLE",STYLE_REMOVE_VARIABLE:"STYLE_REMOVE_VARIABLE",STYLE_ADD_TEMPLATE:"STYLE_ADD_TEMPLATE",STYLE_UPDATE_SETTINGS:"STYLE_UPDATE_SETTINGS"},EAe=(e,t)=>{switch(t.type){case NAe.STYLE_UPDATE:return{...e,...t.style};case NAe.STYLE_ADD_SELECTOR:{let{displayMode:n,selectorType:r,selector:i,path:a,value:o,params:s}=t;return qr(e,e=>{zAe.addSelector(e,n,i,r,a,o,s)&&re(e,"cache",wie(e))})}case NAe.STYLE_UPDATE_SELECTOR:{let{displayMode:n,selector:r,path:i,value:a,params:o}=t;return qr(e,e=>{zAe.updateSelector(e,n,r,i,a,o)&&re(e,"cache",wie(e))})}case NAe.STYLE_REMOVE_SELECTOR:{let{displayMode:n,selector:r}=t;return qr(e,e=>{zAe.removeSelector(e,n,r)&&re(e,"cache",wie(e))})}case NAe.STYLE_REMOVE_SELECTORS:{let{displayMode:n,selectors:r}=t;return qr(e,e=>{r.reduce((t,r)=>zAe.removeSelector(e,n,r)||t,!1)&&re(e,"cache",wie(e))})}case NAe.STYLE_ADD_SELECTOR_VARIABLE:{let{displayMode:n,selector:r,category:i,name:a,value:o}=t;return qr(e,e=>{zAe.addSelectorVariable(e,n,r,i,a,o)&&re(e,"cache",wie(e))})}case NAe.STYLE_UPDATE_SELECTOR_VARIABLE:{let{displayMode:n,selector:r,category:i,name:a,value:o}=t;return qr(e,e=>{zAe.updateSelectorVariable(e,n,r,i,a,o)&&re(e,"cache",wie(e))})}case NAe.STYLE_REMOVE_SELECTOR_VARIABLE:{let{displayMode:n,selector:r,category:i,name:a}=t;return qr(e,e=>{zAe.removeSelectorVariable(e,n,r,i,a)&&re(e,"cache",wie(e))})}case NAe.STYLE_ADD_VARIABLE:{let{category:n,name:r,value:i}=t;return qr(e,e=>{zAe.addVariable(e,n,r,i)&&re(e,"cache",wie(e))})}case NAe.STYLE_UPDATE_VARIABLE:{let{category:n,name:r,value:i}=t;return qr(e,e=>{zAe.updateVariable(e,n,r,i)&&re(e,"cache",wie(e))})}case NAe.STYLE_REMOVE_VARIABLE:{let{category:n,name:r}=t;return qr(e,e=>{zAe.removeVariable(e,n,r)&&re(e,"cache",wie(e))})}case NAe.STYLE_ADD_TEMPLATE:{let{platform:n}=t;return qr(e,e=>{let t=ne(e,"platform",{});Object.keys(n).forEach(e=>{t[e]={...ne(t,e,{}),...n[e]}}),e.platform=t,e.cache=wie(e)})}case NAe.STYLE_UPDATE_SETTINGS:{let{path:n,value:r}=t;return qr(e,e=>{"mode"===n&&re(e,"mode",r)})}default:return e}},AAe={SEGMENTS_ADD:"SEGMENTS_ADD",SEGMENTS_UPDATE:"SEGMENTS_UPDATE",SEGMENTS_REMOVE:"SEGMENTS_REMOVE",SEGMENTS_ADD_TEMPLATE:"SEGMENTS_ADD_TEMPLATE",SEGMENTS_ADD_ELEMENT:"SEGMENTS_ADD_ELEMENT",SEGMENTS_REMOVE_ELEMENT:"SEGMENTS_REMOVE_ELEMENT",SEGMENTS_MOVE_ELEMENT:"SEGMENTS_MOVE_ELEMENT",SEGMENTS_CLONE_ELEMENT:"SEGMENTS_CLONE_ELEMENT",SEGMENTS_UPDATE_ELEMENT:"SEGMENTS_UPDATE_ELEMENT",SEGMENTS_UPDATE_ELEMENTS:"SEGMENTS_UPDATE_ELEMENTS",SEGMENTS_SPACE_ADD_VARIABLE:"SEGMENTS_SPACE_ADD_VARIABLE",SEGMENTS_SPACE_UPDATE_VARIABLE:"SEGMENTS_SPACE_UPDATE_VARIABLE",SEGMENTS_SPACE_REMOVE_VARIABLE:"SEGMENTS_SPACE_REMOVE_VARIABLE",SEGMENTS_STYLE_ADD_SELECTOR:"SEGMENTS_STYLE_ADD_SELECTOR",SEGMENTS_STYLE_UPDATE_SELECTOR:"SEGMENTS_STYLE_UPDATE_SELECTOR",SEGMENTS_STYLE_REMOVE_SELECTOR:"SEGMENTS_STYLE_REMOVE_SELECTOR",SEGMENTS_STYLE_REMOVE_SELECTORS:"SEGMENTS_STYLE_REMOVE_SELECTORS",SEGMENTS_STYLE_ADD_SELECTOR_VARIABLE:"SEGMENTS_STYLE_ADD_SELECTOR_VARIABLE",SEGMENTS_STYLE_UPDATE_SELECTOR_VARIABLE:"SEGMENTS_STYLE_UPDATE_SELECTOR_VARIABLE",SEGMENTS_STYLE_REMOVE_SELECTOR_VARIABLE:"SEGMENTS_STYLE_REMOVE_SELECTOR_VARIABLE",SEGMENTS_STYLE_ADD_VARIABLE:"SEGMENTS_STYLE_ADD_VARIABLE",SEGMENTS_STYLE_UPDATE_VARIABLE:"SEGMENTS_STYLE_UPDATE_VARIABLE",SEGMENTS_STYLE_REMOVE_VARIABLE:"SEGMENTS_STYLE_REMOVE_VARIABLE"},TAe=(e,t)=>{const{segmentId:n}=t;let{segment:r}=t;if(n&&!r&&(r=Object.values(e).find(e=>e.id===n)),!r)return e;const{identifier:i}=r;switch(t.type){case AAe.SEGMENTS_ADD:case AAe.SEGMENTS_UPDATE:return{...e,[i]:r};case AAe.SEGMENTS_REMOVE:return ce(e,[i]);case AAe.SEGMENTS_ADD_ELEMENT:{const{to:n,data:r,dropPosition:a,initialItems:o,variables:s}=t;return qr(e,e=>{Zle.addElement(ne(e,`${i}.schema.flat`),r,n,a,o),s.length>0&&re(e,`${i}.schema.variables`,Zle.addVariables(ne(e,`${i}.schema.variables`,[]),s))})}case AAe.SEGMENTS_REMOVE_ELEMENT:{const{elementId:n}=t;return qr(e,e=>{Zle.removeElement(ne(e,`${i}.schema.flat`),n)})}case AAe.SEGMENTS_CLONE_ELEMENT:{const{to:n,data:r,dropPosition:a,initialItems:o}=t;return qr(e,e=>{Zle.addElement(ne(e,`${i}.schema.flat`),r,n,a,o)})}case AAe.SEGMENTS_MOVE_ELEMENT:{const{from:n,to:r,elementId:a,dropPosition:o}=t;return qr(e,e=>{Zle.moveElement(ne(e,`${i}.schema.flat`),n,r,a,o)})}case AAe.SEGMENTS_UPDATE_ELEMENT:{const{element:n}=t;return qr(e,e=>{re(e,`${i}.schema.flat[${n.id}]`,n)})}case AAe.SEGMENTS_UPDATE_ELEMENTS:{const{elements:n}=t;return qr(e,e=>{n.forEach(t=>re(e,`${i}.schema.flat[${t.id}]`,t))})}case AAe.SEGMENTS_SPACE_ADD_VARIABLE:{const{variable:n}=t;return qr(e,e=>{r.schema.variables||re(e,`${i}.schema.variables`,[]),Zle.addVariable(ne(e,`${i}.schema.variables`,[]),n)})}case AAe.SEGMENTS_SPACE_UPDATE_VARIABLE:{const{variable:n}=t;return qr(e,e=>{r.schema.variables||re(e,`${i}.schema.variables`,[]),Zle.updateVariable(ne(e,`${i}.schema.variables`,[]),n)})}case AAe.SEGMENTS_SPACE_REMOVE_VARIABLE:{const{name:n}=t;return qr(e,e=>{r.schema.variables&&Zle.removeVariable(ne(e,`${i}.schema.variables`,[]),n)})}case AAe.SEGMENTS_STYLE_ADD_SELECTOR:{const{displayMode:n,selector:r,selectorType:a="class",path:o,value:s,params:l}=t;return qr(e,e=>{zAe.addSelector(e[i].style,n,r,a,o,s,l)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_UPDATE_SELECTOR:{const{displayMode:n,selector:r,path:a,value:o,params:s}=t;return qr(e,e=>{zAe.updateSelector(e[i].style,n,r,a,o,s)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_REMOVE_SELECTOR:{const{displayMode:n,selector:r}=t;return qr(e,e=>{zAe.removeSelector(e[i].style,n,r)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_REMOVE_SELECTORS:{const{displayMode:n,selectors:r}=t;return qr(e,e=>{r.reduce((t,r)=>zAe.removeSelector(e[i].style,n,r)||t,!1)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_ADD_SELECTOR_VARIABLE:{const{displayMode:n,selector:r,category:a,name:o,value:s}=t;return qr(e,e=>{zAe.addSelectorVariable(e[i].style,n,r,a,o,s)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_UPDATE_SELECTOR_VARIABLE:{const{displayMode:n,selector:r,category:a,name:o,value:s}=t;return qr(e,e=>{zAe.updateSelectorVariable(e[i].style,n,r,a,o,s)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_REMOVE_SELECTOR_VARIABLE:{const{displayMode:n,selector:r,category:a,name:o}=t;return qr(e,e=>{zAe.removeSelectorVariable(e[i].style,n,r,a,o)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_ADD_VARIABLE:{const{category:n,name:r,value:a}=t;return qr(e,e=>{zAe.addVariable(e[i].style,n,r,a)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_UPDATE_VARIABLE:{const{category:n,name:r,value:a}=t;return qr(e,e=>{zAe.updateVariable(e[i].style,n,r,a)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_STYLE_REMOVE_VARIABLE:{const{category:n,name:r}=t;return qr(e,e=>{zAe.removeVariable(e[i].style,n,r)&&re(e,`${i}.style.cache`,wie(e[i].style))})}case AAe.SEGMENTS_ADD_TEMPLATE:{const{to:n,data:r,dropPosition:a,initialItems:o,templatePlatform:s,variables:l}=t;return qr(e,e=>{const t=e[i];if(!t)return;Zle.addElement(ne(e,`${i}.schema.flat`),r,n,a,o);const c=ne(t,"style.platform"),d=ne(t,"schema.variables",[]);if(Object.keys(s).forEach(e=>{c[e]={...ne(c,e,{}),...s[e]}}),re(e,`${i}.style.cache`,wie({platform:c})),l.length>0){const t=l.filter(e=>!d.find(t=>t.name===e.name));re(e,`${i}.schema.variables`,[...d,...t])}})}default:return e}},PAe=l({queueManager:{},enqueueMiddleware:()=>{}});PAe.displayName="QueueContext";var MAe=({children:e,includeSubscriptions:t=!0})=>{const{mutate:n}=m(K6),{queueManager:r,processing:i}=(({delay:e=1e3,mutate:t,maxRetries:n=2,retryTimeout:r=2500,disabled:i=!1})=>{const a=k(()=>({queueNormal:[],queueUrgent:[]}),[]),[o,s]=z(!1),l=C(o);l.current=o;const c=g(async e=>{switch(e.action.type){case pAe.SCHEMA_ADD_PAGE:return null;case pAe.SCHEMA_HOME_PAGE:{const{pageId:n}=e.action,{prevState:{flat:r}}=e,i=r[n];return i?ne(i,"attributes.default",!1)?null:t("SpaceHomePage",{pageId:n}):null}case pAe.SCHEMA_UPDATE_PAGE:{const{page:n}=e.action;return t("SpaceUpdatePage",{page:n})}case pAe.SCHEMA_REMOVE_PAGE:{const{pageId:n}=e.action;return t("SpaceRemovePage",{pageId:n})}case pAe.SCHEMA_ADD_PAGE_FOLDER:return null;case pAe.SCHEMA_UPDATE_PAGE_FOLDER:{const{pageFolder:n}=e.action;return t("SpaceUpdatePageFolder",{pageFolder:n})}case pAe.SCHEMA_REMOVE_PAGE_FOLDER:{const{pageFolderId:n}=e.action;return t("SpaceRemovePageFolder",{pageFolderId:n})}case pAe.SCHEMA_ADD_VARIABLE:{const{variable:n}=e.action;return t("SpaceAddVariable",n)}case pAe.SCHEMA_UPDATE_VARIABLE:{const{variable:n}=e.action;return t("SpaceUpdateVariable",{variable:n})}case pAe.SCHEMA_REMOVE_VARIABLE:{const{name:n}=e.action;return t("SpaceRemoveVariable",{name:n})}case pAe.SCHEMA_ADD_ELEMENT:{const{data:n,to:r,dropPosition:i,initialItems:a,variables:o}=e.action;return t("SpaceAddElement",{element:n,to:r,dropPosition:i,initialItems:Object.values(a),variables:o})}case pAe.SCHEMA_UPDATE_ELEMENT:{const{element:n}=e.action;return t("SpaceUpdateElement",{element:n})}case pAe.SCHEMA_UPDATE_ELEMENTS:{const{elements:n}=e.action;return t("SpaceUpdateElements",{elements:n})}case pAe.SCHEMA_REMOVE_ELEMENT:{const{elementId:n}=e.action;return t("SpaceRemoveElement",{elementId:n})}case pAe.SCHEMA_MOVE_ELEMENT:{const{elementId:n,from:r,to:i,dropPosition:a}=e.action;return t("SpaceMoveElement",{elementId:n,from:r,to:i,dropPosition:a})}case pAe.SCHEMA_CLONE_ELEMENT:{const{data:n,to:r,dropPosition:i,initialItems:a}=e.action;return t("SpaceCloneElement",{element:n,to:r,dropPosition:i,initialItems:Object.values(a)})}case pAe.SCHEMA_UPDATE_SETTINGS:{const{value:n,path:r}=e.action;return t("SpaceUpdateSettings",{value:n,path:r})}case pAe.SCHEMA_UPDATE:{const{schema:n,queryFailed:r}=e.action;return r?null:t("SpaceUpdateSchema",{schema:n})}case NAe.STYLE_ADD_SELECTOR:{const{displayMode:n,selector:r,selectorType:i,path:a,value:o,params:s}=e.action;return t("StyleAddSelector",{displayMode:n,selector:r,type:i,path:a,style:o,params:s})}case NAe.STYLE_UPDATE_SELECTOR:{const{displayMode:n,selector:r,path:i,value:a,params:o}=e.action;return t("StyleUpdateSelector",{displayMode:n,selector:r,path:i,style:a,params:o})}case NAe.STYLE_REMOVE_SELECTOR:{const{displayMode:n,selector:r}=e.action;return t("StyleRemoveSelector",{displayMode:n,selector:r})}case NAe.STYLE_REMOVE_SELECTORS:{const{displayMode:n,selectors:r}=e.action;return t("StyleRemoveSelectors",{displayMode:n,selectors:r})}case NAe.STYLE_ADD_SELECTOR_VARIABLE:{const{displayMode:n,selector:r,category:i,name:a,value:o}=e.action;return t("StyleAddSelectorVariable",{displayMode:n,selector:r,category:i,name:a,value:o})}case NAe.STYLE_UPDATE_SELECTOR_VARIABLE:{const{displayMode:n,selector:r,category:i,name:a,value:o}=e.action;return t("StyleUpdateSelectorVariable",{displayMode:n,selector:r,category:i,name:a,value:o})}case NAe.STYLE_REMOVE_SELECTOR_VARIABLE:{const{displayMode:n,selector:r,category:i,name:a}=e.action;return t("StyleRemoveSelectorVariable",{displayMode:n,selector:r,category:i,name:a})}case NAe.STYLE_ADD_VARIABLE:{const{category:n,name:r,value:i}=e.action;return t("StyleAddVariable",{category:n,name:r,value:i})}case NAe.STYLE_UPDATE_VARIABLE:{const{category:n,name:r,value:i}=e.action;return t("StyleUpdateVariable",{category:n,name:r,value:i})}case NAe.STYLE_REMOVE_VARIABLE:{const{category:n,name:r}=e.action;return t("StyleRemoveVariable",{category:n,name:r})}case NAe.STYLE_UPDATE:{const{style:n,queryFailed:r}=e.action;return r?null:t("StyleUpdate",{style:n})}case NAe.STYLE_UPDATE_SETTINGS:{const{path:n,value:r}=e.action;return t("StyleUpdateSettings",{path:n,value:r})}case pAe.SCHEMA_ADD_TEMPLATE:{const{data:n,dropPosition:r,initialItems:i,to:a,variables:o,style:s}=e.action;return t("SpaceAddTemplate",{element:n,style:s,to:a,dropPosition:r,initialItems:Object.values(i),variables:o})}case AAe.SEGMENTS_REMOVE:{const{segmentId:n}=e.action;return t("SegmentRemove",{id:n})}case AAe.SEGMENTS_ADD_ELEMENT:{const{data:n,to:r,dropPosition:i,initialItems:a,variables:o,segmentId:s}=e.action;return t("SegmentAddElement",{element:n,to:r,dropPosition:i,initialItems:Object.values(a),variables:o,contextId:s})}case AAe.SEGMENTS_UPDATE_ELEMENT:{const{element:n,segmentId:r}=e.action;return t("SegmentUpdateElement",{element:n,contextId:r})}case AAe.SEGMENTS_UPDATE_ELEMENTS:{const{elements:n,segmentId:r}=e.action;return t("SegmentUpdateElements",{elements:n,contextId:r})}case AAe.SEGMENTS_REMOVE_ELEMENT:{const{elementId:n,segmentId:r}=e.action;return t("SegmentRemoveElement",{elementId:n,contextId:r})}case AAe.SEGMENTS_MOVE_ELEMENT:{const{elementId:n,from:r,to:i,dropPosition:a,segmentId:o}=e.action;return t("SegmentMoveElement",{elementId:n,from:r,to:i,dropPosition:a,contextId:o})}case AAe.SEGMENTS_SPACE_ADD_VARIABLE:{const{segmentId:n,variable:r}=e.action;return t("SegmentSpaceAddVariable",{contextId:n,variable:r})}case AAe.SEGMENTS_SPACE_UPDATE_VARIABLE:{const{segmentId:n,variable:r}=e.action;return t("SegmentSpaceUpdateVariable",{contextId:n,variable:r})}case AAe.SEGMENTS_SPACE_REMOVE_VARIABLE:{const{segmentId:n,name:r}=e.action;return t("SegmentSpaceRemoveVariable",{contextId:n,name:r})}case AAe.SEGMENTS_STYLE_ADD_SELECTOR:{const{displayMode:n,selector:r,selectorType:i,path:a,value:o,params:s,segmentId:l}=e.action;return t("SegmentStyleAddSelector",{displayMode:n,selector:r,type:i,path:a,style:o,params:s,contextId:l})}case AAe.SEGMENTS_STYLE_UPDATE_SELECTOR:{const{displayMode:n,selector:r,path:i,value:a,params:o,segmentId:s}=e.action;return t("SegmentStyleUpdateSelector",{displayMode:n,selector:r,path:i,style:a,params:o,contextId:s})}case AAe.SEGMENTS_STYLE_REMOVE_SELECTOR:{const{selector:n,segmentId:r}=e.action;return t("SegmentStyleRemoveSelector",{selector:n,contextId:r})}case AAe.SEGMENTS_STYLE_REMOVE_SELECTORS:{const{selectors:n,segmentId:r}=e.action;return t("SegmentStyleRemoveSelectors",{selectors:n,contextId:r})}case AAe.SEGMENTS_STYLE_ADD_SELECTOR_VARIABLE:{const{segmentId:n,displayMode:r,selector:i,category:a,name:o,value:s}=e.action;return t("SegmentStyleAddSelectorVariable",{contextId:n,displayMode:r,selector:i,category:a,name:o,value:s})}case AAe.SEGMENTS_STYLE_UPDATE_SELECTOR_VARIABLE:{const{segmentId:n,displayMode:r,selector:i,category:a,name:o,value:s}=e.action;return t("SegmentStyleUpdateSelectorVariable",{contextId:n,displayMode:r,selector:i,category:a,name:o,value:s})}case AAe.SEGMENTS_STYLE_REMOVE_SELECTOR_VARIABLE:{const{segmentId:n,displayMode:r,selector:i,category:a,name:o}=e.action;return t("SegmentStyleRemoveSelectorVariable",{contextId:n,displayMode:r,selector:i,category:a,name:o})}case AAe.SEGMENTS_STYLE_ADD_VARIABLE:{const{category:n,name:r,value:i,segmentId:a}=e.action;return t("SegmentStyleAddVariable",{category:n,name:r,value:i,contextId:a})}case AAe.SEGMENTS_STYLE_UPDATE_VARIABLE:{const{category:n,name:r,value:i,segmentId:a}=e.action;return t("SegmentStyleUpdateVariable",{category:n,name:r,value:i,contextId:a})}case AAe.SEGMENTS_STYLE_REMOVE_VARIABLE:{const{category:n,name:r,segmentId:i}=e.action;return t("SegmentStyleRemoveVariable",{category:n,name:r,contextId:i})}case AAe.SEGMENTS_ADD_TEMPLATE:{const{data:n,dropPosition:r,initialItems:i,to:a,templatePlatform:o,variables:s,segmentId:l}=e.action;return t("SegmentAddTemplate",{element:n,styles:o,to:a,dropPosition:r,initialItems:Object.values(i),variables:s,contextId:l})}case AAe.SEGMENTS_CLONE_ELEMENT:{const{data:n,to:r,dropPosition:i,initialItems:a,segmentId:o}=e.action;return t("SegmentCloneElement",{element:n,to:r,dropPosition:i,initialItems:Object.values(a),contextId:o})}case AAe.SEGMENTS_UPDATE:{const{segment:n,queryFailed:r}=e.action;return!r&&n&&n.id?t("SegmentUpdate",{id:n.id,segment:n}):null}default:return null}},[t]),d=g(e=>{switch(e.action.type){case pAe[e.action.type]:{const t=e;return void t.dispatch({type:pAe.SCHEMA_UPDATE,schema:t.prevState,queryFailed:!0})}case NAe[e.action.type]:{const t=e;return void t.dispatch({type:NAe.STYLE_UPDATE,style:t.prevState,queryFailed:!0})}case AAe[e.action.type]:{const t=e,n=t.prevState.segmentId;return void t.dispatch({type:AAe.SEGMENTS_UPDATE,segment:t.prevState[n],segmentId:n,queryFailed:!0})}default:return}},[]),u=g(async()=>{const{queueNormal:e}=a;if(0!==e.length){s(!0);do{const t=e.shift();if(t){let e=await c(t);if(e instanceof Error){for(let i=0;i<n&&e instanceof Error;i++)await pa(r),e=await c(t);e instanceof Error&&d(t)}}}while(e.length>0);s(!1)}},[a,c,d,s,n,r]),h=k(()=>({queueNormal:de(u,e),queueUrgent:de(u,0)}),[u,e]),f=g((e=[],t="normal")=>{i||("normal"===t&&(Array.isArray(e)?a.queueNormal.push(...e):a.queueNormal.push(e),h.queueNormal()),"urgent"===t&&(Array.isArray(e)?a.queueUrgent.push(...e):a.queueUrgent.push(e),h.queueUrgent()))},[a,h,i]),p=g((e="all")=>{const{queueNormal:t,queueUrgent:n}=a;return"normal"===e?t.length:"urgent"===e?n.length:t.length+n.length},[a]),m=g(e=>{if(a.queueNormal.length>0)return e.preventDefault(),e.returnValue="Some changes still being saved.",e},[a]),v=g(()=>l.current,[]);return y(()=>(window.addEventListener("beforeunload",m),()=>{window.removeEventListener("beforeunload",m)}),[m]),{queueManager:k(()=>({count:p,enqueue:f,getIsProcessing:v}),[p,f,v]),processing:o}})({delay:100,mutate:n,maxRetries:0,disabled:!t}),a=g((e,t,n,i)=>r.enqueue({action:i,prevState:e,state:t,dispatch:n},"normal"),[r]);/* @__PURE__ */
4509
4509
  return P(PAe,{value:k(()=>({queueManager:r,enqueueMiddleware:a}),[r,a]),children:/* @__PURE__ */P(wge,{value:i,children:e})})},IAe=({children:e,schema:t,includeSubscriptions:n=!0})=>{const r=m(J6),{eventBridge:i}=m(w9),a=k(()=>({...G6.schema,...t||r.schema}),[t,r.schema]),{enqueueMiddleware:o}=m(PAe),{undoableMiddleware:s}=m(Hde),[l,c]=w3(mAe,a,[{middleware:s,filterCallback:e=>!e.fromSubscriptions},{middleware:o,filterCallback:e=>!e.fromSubscriptions}]),{mutate:d,subscriptionManager:u}=m(K6);sa("schema",l);const h=la("schema.flat");sa("pageDefinitions",Og(ie(ne(l,"flat",{}),ne(l,"pages",[])),"soft"));const f=g((e,t=!1)=>c({type:pAe.SCHEMA_UPDATE,schema:{...e,flat:e.flat.reduce((e,t)=>({...e,[t.id]:t}),{})},fromSubscriptions:t}),[c]),p=g((e,t,n="inside",r={},i=[],a=!1)=>{c({type:pAe.SCHEMA_ADD_ELEMENT,to:e,data:t,dropPosition:n,initialItems:r,variables:i,fromSubscriptions:a})},[c]),v=g((e,t=!1)=>c({type:pAe.SCHEMA_UPDATE_ELEMENT,element:e,fromSubscriptions:t}),[c]),b=g((e,t=!1)=>c({type:pAe.SCHEMA_UPDATE_ELEMENTS,elements:e,fromSubscriptions:t}),[c]),x=g((e,t,n,r="inside",i=!1)=>c({type:pAe.SCHEMA_MOVE_ELEMENT,from:e,to:t,elementId:n,dropPosition:r,fromSubscriptions:i}),[c]),w=g((e,t,n=!1)=>{const r=Zle.cloneElements(h(),e,t);r.item&&(r.acum[r.item.id]&&delete r.acum[r.item.id],c({type:pAe.SCHEMA_ADD_ELEMENT,to:t??ne(r,"item.definition.parentId",""),data:r.item,dropPosition:"inside",initialItems:r.acum,fromSubscriptions:n}))},[c,h]),O=g((e,t=!1)=>c({type:pAe.SCHEMA_REMOVE_ELEMENT,elementId:e,fromSubscriptions:t}),[c]),S=g(async(e,t=!1)=>{const n=await d("SpaceAddPage",e);n.result&&c({type:pAe.SCHEMA_ADD_PAGE,page:n.result,fromSubscriptions:t})},[c,d]),C=g((e,t=!1)=>c({type:pAe.SCHEMA_HOME_PAGE,pageId:e,fromSubscriptions:t}),[c]),z=g((e,t=!1)=>c({type:pAe.SCHEMA_UPDATE_PAGE,page:e,fromSubscriptions:t}),[c]),N=g((e,t=!1)=>c({type:pAe.SCHEMA_REMOVE_PAGE,pageId:e,fromSubscriptions:t}),[c]),E=g(async(e,t=!1)=>{const n=await d("SpaceAddPageFolder",e);n.result&&c({type:pAe.SCHEMA_ADD_PAGE_FOLDER,pageFolder:n.result,fromSubscriptions:t})},[c,d]),A=g((e,t=!1)=>c({type:pAe.SCHEMA_UPDATE_PAGE_FOLDER,pageFolder:e,fromSubscriptions:t}),[c]),T=g((e,t=!1)=>c({type:pAe.SCHEMA_REMOVE_PAGE_FOLDER,pageFolderId:e,fromSubscriptions:t}),[c]),M=g((e,t=!1)=>{c({type:pAe.SCHEMA_ADD_VARIABLE,variable:e,fromSubscriptions:t})},[c]),I=g((e,t=!1)=>c({type:pAe.SCHEMA_UPDATE_VARIABLE,variable:e,fromSubscriptions:t}),[c]),R=g((e,t=!1)=>c({type:pAe.SCHEMA_REMOVE_VARIABLE,name:e,fromSubscriptions:t}),[c]),D=g((e,t,n="inside",r={},a,o=[],s=!1)=>{c({type:pAe.SCHEMA_ADD_TEMPLATE,to:e,data:t,dropPosition:n,initialItems:r,variables:o,style:a,fromSubscriptions:s}),i.emit("main","styleAddTemplate",a?.platform,!0)},[c,i]),L=g((e,t="",n=!1)=>c({type:pAe.SCHEMA_UPDATE_SETTINGS,value:e,path:t,fromSubscriptions:n}),[c]);return y(()=>(n&&(u.subscribe("SpaceAddPage",{},e=>{if(!e.data||e.error)return;const{page:t}=ne(e,"data.SpaceAddPage",{});S(t,!0)}),u.subscribe("SpaceHomePage",{},e=>{if(!e.data||e.error)return;const{page:t}=ne(e,"data.SpaceHomePage",{});C(t.id,!0)}),u.subscribe("SpaceUpdatePage",{},e=>{if(!e.data||e.error)return;const{page:t}=ne(e,"data.SpaceUpdatePage",{});z(t,!0)}),u.subscribe("SpaceRemovePage",{},e=>{if(!e.data||e.error)return;const{pageId:t}=ne(e,"data.SpaceRemovePage",{});N(t,!0)}),u.subscribe("SpaceAddPageFolder",{},e=>{if(!e.data||e.error)return;const{pageFolder:t}=ne(e,"data.SpaceAddPageFolder",{});E(t,!0)}),u.subscribe("SpaceUpdatePageFolder",{},e=>{if(!e.data||e.error)return;const{pageFolder:t}=ne(e,"data.SpaceUpdatePageFolder",{});A(t,!0)}),u.subscribe("SpaceRemovePageFolder",{},e=>{if(!e.data||e.error)return;const{pageFolderId:t}=ne(e,"data.SpaceRemovePageFolder",{});T(t,!0)}),u.subscribe("SpaceAddVariable",{},e=>{if(!e.data||e.error)return;const{variable:t}=ne(e,"data.SpaceAddVariable",{});M(t,!0)}),u.subscribe("SpaceUpdateVariable",{},e=>{if(!e.data||e.error)return;const{variable:t}=ne(e,"data.SpaceUpdateVariable",{});I(t,!0)}),u.subscribe("SpaceRemoveVariable",{},e=>{if(!e.data||e.error)return;const{name:t}=ne(e,"data.SpaceRemoveVariable",{});R(t,!0)}),u.subscribe("SpaceUpdateSettings",{},e=>{if(!e.data||e.error)return;const{value:t,path:n}=ne(e,"data.SpaceUpdateSettings",{});L(t,n,!0)}),u.subscribe("SpaceAddElement",{},e=>{if(!e.data||e.error)return;const{element:t,to:n,dropPosition:r,initialItems:i=[],variables:a=[]}=ne(e,"data.SpaceAddElement",{});p(n,t,r,i.reduce((e,t)=>({...e,[t.id]:t}),{}),a,!0)}),u.subscribe("SpaceUpdateElement",{},e=>{if(!e.data||e.error)return;const{element:t}=ne(e,"data.SpaceUpdateElement",{});v(t,!0)}),u.subscribe("SpaceUpdateElements",{},e=>{if(!e.data||e.error)return;const{elements:t}=ne(e,"data.SpaceUpdateElements",{});b(t,!0)}),u.subscribe("SpaceRemoveElement",{},e=>{if(!e.data||e.error)return;const{elementId:t}=ne(e,"data.SpaceRemoveElement",{});O(t,!0)}),u.subscribe("SpaceMoveElement",{},e=>{if(!e.data||e.error)return;const{from:t,to:n,elementId:r,dropPosition:i}=ne(e,"data.SpaceMoveElement",{});x(t,n,r,i,!0)}),u.subscribe("SpaceCloneElement",{},e=>{if(!e.data||e.error)return;const{element:t,to:n,dropPosition:r,initialItems:i=[]}=ne(e,"data.SpaceCloneElement",{});p(n,t,r,i.reduce((e,t)=>({...e,[t.id]:t}),{}),[],!0)}),u.subscribe("SpaceUpdated",{},e=>{if(!e.data||e.error)return;const{schema:t}=ne(e,"data.SpaceUpdated",{});f(t,!0)}),u.subscribe("SpaceAddTemplate",{},e=>{if(!e.data||e.error)return;const{element:t,style:n,to:r,dropPosition:i,initialItems:a=[],variables:o=[]}=ne(e,"data.SpaceAddTemplate",{});D(r,t,i,a.reduce((e,t)=>({...e,[t.id]:t}),{}),n,o,!0)})),()=>{n&&u.unsubscribe(["SpaceAddPage","SpaceHomePage","SpaceUpdatePage","SpaceRemovePage","SpaceAddPageFolder","SpaceUpdatePageFolder","SpaceRemovePageFolder","SpaceAddVariable","SpaceUpdateVariable","SpaceRemoveVariable","SpaceUpdateSettings","SpaceAddElement","SpaceUpdateElement","SpaceUpdateElements","SpaceRemoveElement","SpaceMoveElement","SpaceCloneElement","SpaceUpdated","SpaceAddTemplate"])}),[u,n,S,C,z,N,E,A,T,M,I,R,L,p,v,b,O,x,f,D]),O9("main",k(()=>({schemaAddPage:S,schemaHomePage:C,schemaUpdatePage:z,schemaRemovePage:N,schemaAddPageFolder:E,schemaUpdatePageFolder:A,schemaRemovePageFolder:T,schemaAddVariable:M,schemaUpdateVariable:I,schemaRemoveVariable:R,schemaUpdateSettings:L}),[S,C,z,N,E,A,T,M,I,R,L]),void 0,void 0),O9("main",k(()=>({schemaUpdate:f,schemaAddElement:p,schemaUpdateElement:v,schemaUpdateElements:b,schemaMoveElement:x,schemaCloneElement:w,schemaRemoveElement:O,schemaAddTemplate:D}),[f,p,v,b,x,w,O,D])),/* @__PURE__ */P(Y6,{value:k(()=>({dispatchSchema:c,schemaUpdate:f,schemaAddElement:p,schemaUpdateElement:v,schemaUpdateElements:b,schemaMoveElement:x,schemaCloneElement:w,schemaRemoveElement:O,schemaAddPage:S,schemaHomePage:C,schemaUpdatePage:z,schemaRemovePage:N,schemaAddPageFolder:E,schemaUpdatePageFolder:A,schemaRemovePageFolder:T,schemaAddVariable:M,schemaUpdateVariable:I,schemaRemoveVariable:R,schemaAddTemplate:D,schemaUpdateSettings:L}),[c,f,p,v,b,x,w,O,D,L,S,C,z,N,E,A,T,M,I,R]),children:e})},RAe=({children:e,includeSubscriptions:t=!0})=>{const{query:n,mutate:r,subscriptionManager:i}=m(K6),a=m(J6),{enqueueMiddleware:o}=m(PAe),{undoableMiddleware:s}=m(Hde),[l,c]=w3(TAe,k(()=>a.segments,[a.segments]),[{middleware:s,filterCallback:e=>!e.fromSubscriptions},{middleware:o,filterCallback:e=>!e.fromSubscriptions}]);sa("segments",l);const d=la("segments"),u=g(async(e,t,r)=>{try{const i=await n("Segments",{environment:"main",filter:e,cursor:t,limit:r},"network-only");if(!i.result)return;const a=i.result.Segments;return{...a,edges:a.edges.map(e=>({...e,schema:{...ne(e,"schema"),flat:ne(e,"schema.flat",[]).reduce((e,t)=>({...e,[t.id]:t}),{})}}))}}catch{return}},[n]),h=g(async e=>{const t=d(e,void 0);if(t)return t;try{const t=await n("Segment",{environment:"main",identifier:e},"network-only");if(!t.result)return;const r=t.result.Segment,i={...r,schema:{...ne(r,"schema"),flat:ne(r,"schema.flat",[]).reduce((e,t)=>({...e,[t.id]:t}),{})}};return c({type:AAe.SEGMENTS_ADD,segmentId:i.id,segment:i,fromSubscriptions:!0}),i}catch{return}},[c,d,n]),f=g(e=>{c({type:AAe.SEGMENTS_ADD,segment:e,segmentId:e.id})},[c]),p=g(e=>c({type:AAe.SEGMENTS_UPDATE,segment:e,segmentId:e.id}),[c]),v=g(e=>c({type:AAe.SEGMENTS_REMOVE,segmentId:e}),[c]),b=g((e,t,n,r,i,a,o,s=!1)=>{c({type:AAe.SEGMENTS_ADD_TEMPLATE,segmentId:e,to:t,data:n,dropPosition:r,initialItems:i,templatePlatform:a,variables:o,fromSubscriptions:s})},[c]),x=g((e,t,n,r="inside",i={},a=[],o=!1)=>{c({type:AAe.SEGMENTS_ADD_ELEMENT,segmentId:e,to:t,data:n,dropPosition:r,initialItems:i,variables:a,fromSubscriptions:o})},[c]),w=g((e,t,n=!1)=>c({type:AAe.SEGMENTS_UPDATE_ELEMENT,segmentId:e,element:t,fromSubscriptions:n}),[c]),O=g((e,t,n=!1)=>c({type:AAe.SEGMENTS_UPDATE_ELEMENTS,segmentId:e,elements:t,fromSubscriptions:n}),[c]),S=g((e,t,n=!1)=>c({type:AAe.SEGMENTS_REMOVE_ELEMENT,segmentId:e,elementId:t,fromSubscriptions:n}),[c]),C=g((e,t,n,r,i="inside",a=!1)=>c({type:AAe.SEGMENTS_MOVE_ELEMENT,segmentId:e,from:t,to:n,elementId:r,dropPosition:i,fromSubscriptions:a}),[c]),z=g((e,t,n=!1)=>c({type:AAe.SEGMENTS_SPACE_ADD_VARIABLE,segmentId:e,variable:t,fromSubscriptions:n}),[c]),N=g((e,t,n=!1)=>c({type:AAe.SEGMENTS_SPACE_UPDATE_VARIABLE,segmentId:e,variable:t,fromSubscriptions:n}),[c]),E=g((e,t,n=!1)=>c({type:AAe.SEGMENTS_SPACE_REMOVE_VARIABLE,segmentId:e,name:t,fromSubscriptions:n}),[c]),A=g((e,t,n,r,i,a,o,s=!1)=>c({type:AAe.SEGMENTS_STYLE_ADD_SELECTOR,segmentId:e,displayMode:t,selector:n,selectorType:r,path:i,value:a,params:o,fromSubscriptions:s}),[c]),T=g((e,t,n,r,i,a,o=!1)=>c({type:AAe.SEGMENTS_STYLE_UPDATE_SELECTOR,segmentId:e,displayMode:t,selector:n,path:r,value:i,params:a,fromSubscriptions:o}),[c]),M=g((e,t,n,r=!1)=>c({type:AAe.SEGMENTS_STYLE_REMOVE_SELECTOR,segmentId:e,displayMode:t,selector:n,fromSubscriptions:r}),[c]),I=g((e,t,n,r=!1)=>c({type:AAe.SEGMENTS_STYLE_REMOVE_SELECTORS,segmentId:e,displayMode:t,selectors:n,fromSubscriptions:r}),[c]),R=g((e,t,n,r,i,a,o=!1)=>c({type:AAe.SEGMENTS_STYLE_ADD_SELECTOR_VARIABLE,segmentId:e,displayMode:t,selector:n,category:r,name:i,value:a,fromSubscriptions:o}),[c]),D=g((e,t,n,r,i,a,o=!1)=>c({type:AAe.SEGMENTS_STYLE_UPDATE_SELECTOR_VARIABLE,segmentId:e,displayMode:t,selector:n,category:r,name:i,value:a,fromSubscriptions:o}),[c]),L=g((e,t,n,r,i,a=!1)=>c({type:AAe.SEGMENTS_STYLE_REMOVE_SELECTOR_VARIABLE,segmentId:e,displayMode:t,selector:n,category:r,name:i,fromSubscriptions:a}),[c]),V=g((e,t,n,r,i=!1)=>c({type:AAe.SEGMENTS_STYLE_ADD_VARIABLE,segmentId:e,category:t,name:n,value:r,fromSubscriptions:i}),[c]),Q=g((e,t,n,r,i=!1)=>c({type:AAe.SEGMENTS_STYLE_UPDATE_VARIABLE,segmentId:e,category:t,name:n,value:r,fromSubscriptions:i}),[c]),j=g((e,t,n,r=!1)=>c({type:AAe.SEGMENTS_STYLE_REMOVE_VARIABLE,segmentId:e,category:t,name:n,fromSubscriptions:r}),[c]),F=g(async(e,t,n,i,a)=>{if(!a)return;const{elements:o,elementsStyle:s,variables:l}=Zle.flatAsTemplate(e,t,a.id);if(!o.item)return;const c=await r("SegmentAdd",{name:n,description:i,baseElementId:o.item.id,elements:o.acum,style:{...s,cache:wie(s)},variables:l});if(c.result){const e={...c.result,schema:{...ne(c.result,"schema"),flat:ne(c.result,"schema.flat",[]).reduce((e,t)=>({...e,[t.id]:t}),{})}};f(e)}},[f,r]);y(()=>(t&&(i.subscribe("SegmentAddElement",{},e=>{if(!e.data||e.error)return;const{element:t,to:n,dropPosition:r,initialItems:i=[],variables:a=[],contextId:o}=ne(e,"data.SegmentAddElement",{});x(o,n,t,r,i.reduce((e,t)=>({...e,[t.id]:t}),{}),a,!0)}),i.subscribe("SegmentUpdateElement",{},e=>{if(!e.data||e.error)return;const{element:t,contextId:n}=ne(e,"data.SegmentUpdateElement",{});w(n,t,!0)}),i.subscribe("SegmentUpdateElements",{},e=>{if(!e.data||e.error)return;const{elements:t,contextId:n}=ne(e,"data.SegmentUpdateElements",{});O(n,t,!0)}),i.subscribe("SegmentRemoveElement",{},e=>{if(!e.data||e.error)return;const{elementId:t,contextId:n}=ne(e,"data.SegmentRemoveElement",{});S(n,t,!0)}),i.subscribe("SegmentMoveElement",{},e=>{if(!e.data||e.error)return;const{from:t,to:n,elementId:r,dropPosition:i,contextId:a}=ne(e,"data.SegmentMoveElement",{});C(a,t,n,r,i,!0)}),i.subscribe("SegmentCloneElement",{},e=>{if(!e.data||e.error)return;const{element:t,to:n,dropPosition:r,initialItems:i=[],contextId:a}=ne(e,"data.SegmentCloneElement",{});x(a,n,t,r,i.reduce((e,t)=>({...e,[t.id]:t}),{}),[],!0)}),i.subscribe("SegmentAddTemplate",{},e=>{if(!e.data||e.error)return;const{element:t,styles:n,to:r,dropPosition:i,initialItems:a=[],variables:o=[],contextId:s}=ne(e,"data.SegmentAddTemplate",{});b(s,r,t,i,a.reduce((e,t)=>({...e,[t.id]:t}),{}),n,o,!0)}),i.subscribe("SegmentSpaceAddVariable",{},e=>{if(!e.data||e.error)return;const{contextId:t,variable:n}=ne(e,"data.SegmentSpaceAddVariable",{});z(t,n,!0)}),i.subscribe("SegmentSpaceUpdateVariable",{},e=>{if(!e.data||e.error)return;const{contextId:t,variable:n}=ne(e,"data.SegmentSpaceUpdateVariable",{});N(t,n,!0)}),i.subscribe("SegmentSpaceRemoveVariable",{},e=>{if(!e.data||e.error)return;const{contextId:t,variable:n}=ne(e,"data.SegmentSpaceRemoveVariable",{});E(t,n.name,!0)}),i.subscribe("SegmentStyleAddSelector",{},e=>{if(!e.data||e.error)return;const{displayMode:t,selector:n,type:r,path:i,style:a,contextId:o,params:s}=ne(e,"data.SegmentStyleAddSelector",{});A(o,t,n,r,i,a,s,!0)}),i.subscribe("SegmentStyleUpdateSelector",{},e=>{if(!e.data||e.error)return;const{displayMode:t,selector:n,path:r,style:i,contextId:a,params:o}=ne(e,"data.SegmentStyleUpdateSelector",{});T(a,t,n,r,i,o,!0)}),i.subscribe("SegmentStyleRemoveSelector",{},e=>{if(!e.data||e.error)return;const{displayMode:t,selector:n,contextId:r}=ne(e,"data.SegmentStyleRemoveSelector",{});M(r,t,n,!0)}),i.subscribe("SegmentStyleRemoveSelectors",{},e=>{if(!e.data||e.error)return;const{displayMode:t,selectors:n,contextId:r}=ne(e,"data.SegmentStyleRemoveSelectors",{});I(r,t,n,!0)}),i.subscribe("SegmentStyleAddSelectorVariable",{},e=>{if(!e.data||e.error)return;const{contextId:t,displayMode:n,selector:r,category:i,name:a,value:o}=ne(e,"data.SegmentStyleAddSelectorVariable",{});R(t,n,r,i,a,o,!0)}),i.subscribe("SegmentStyleUpdateSelectorVariable",{},e=>{if(!e.data||e.error)return;const{contextId:t,displayMode:n,selector:r,category:i,name:a,value:o}=ne(e,"data.SegmentStyleUpdateSelectorVariable",{});D(t,n,r,i,a,o,!0)}),i.subscribe("SegmentStyleRemoveSelectorVariable",{},e=>{if(!e.data||e.error)return;const{contextId:t,displayMode:n,selector:r,category:i,name:a}=ne(e,"data.SegmentStyleRemoveSelectorVariable",{});L(t,n,r,i,a,!0)}),i.subscribe("SegmentStyleAddVariable",{},e=>{if(!e.data||e.error)return;const{category:t,name:n,value:r,contextId:i}=ne(e,"data.SegmentStyleAddVariable",{});V(i,t,n,r,!0)}),i.subscribe("SegmentStyleUpdateVariable",{},e=>{if(!e.data||e.error)return;const{category:t,name:n,value:r,contextId:i}=ne(e,"data.SegmentStyleUpdateVariable",{});Q(i,t,n,r,!0)}),i.subscribe("SegmentStyleRemoveVariable",{},e=>{if(!e.data||e.error)return;const{category:t,name:n,contextId:r}=ne(e,"data.SegmentStyleRemoveVariable",{});j(r,t,n,!0)})),()=>{i.unsubscribe(["SegmentAddElement","SegmentUpdateElement","SegmentUpdateElements","SegmentRemoveElement","SegmentMoveElement","SegmentCloneElement","SegmentAddTemplate","SegmentSpaceAddVariable","SegmentSpaceUpdateVariable","SegmentSpaceRemoveVariable","SegmentStyleAddSelector","SegmentStyleUpdateSelector","SegmentStyleRemoveSelector","SegmentStyleRemoveSelectors","SegmentStyleAddSelectorVariable","SegmentStyleUpdateSelectorVariable","SegmentStyleRemoveSelectorVariable","SegmentStyleAddVariable","SegmentStyleUpdateVariable","SegmentStyleRemoveVariable"])}),[i,t,x,w,O,S,C,b,z,N,E,A,T,M,I,R,D,L,V,Q,j]);const B=g(async(e,t,n,i,a=[])=>{const o=await r("SegmentAdd",{name:e,description:t,schema:n,style:i,variables:a});if(o.result){const e={...o.result,schema:{...ne(o.result,"schema"),flat:ne(o.result,"schema.flat",[]).reduce((e,t)=>({...e,[t.id]:t}),{})}};f(e)}},[r,f]);return O9("segment",k(()=>({schemaUpdate:p,schemaAddElement:x,schemaUpdateElement:w,schemaUpdateElements:O,schemaRemoveElement:S,schemaMoveElement:C,schemaAddTemplate:b,styleUpdate:p,spaceAddVariable:z,spaceUpdateVariable:N,spaceRemoveVariable:E,styleAddSelector:A,styleUpdateSelector:T,styleRemoveSelector:M,styleRemoveSelectors:I,styleAddSelectorVariable:R,styleUpdateSelectorVariable:D,styleRemoveSelectorVariable:L,styleAddVariable:V,styleUpdateVariable:Q,styleRemoveVariable:j,styleAddTemplate:b}),[p,x,w,O,S,C,b,z,N,E,A,T,M,I,R,D,L,V,Q,j])),/* @__PURE__ */P(n9,{value:k(()=>({dispatchSegments:c,segmentGet:h,segmentsFetch:u,segmentsAdd:f,segmentsUpdate:p,segmentsRemove:v,elementAsSegment:F,segmentAddMutation:B}),[c,h,u,f,p,v,F,B]),children:e})},DAe=l({});DAe.displayName="StyleContext";var LAe=({children:e,style:t,includeSubscriptions:n=!0,middlewares:r=[]})=>{let{subscriptionManager:i}=m(K6),a=k(()=>r.map(e=>({middleware:e,filterCallback:e=>!e.fromSubscriptions})),[r]),[o,s]=w3(EAe,t??Z6,a);$i("style",o);let l=g((e,t=!1)=>s({type:NAe.STYLE_UPDATE,style:e,fromSubscriptions:t}),[s]),c=g((e,t,n,r,i,a,o=!1)=>{t||=Oie(n),s({type:NAe.STYLE_ADD_SELECTOR,displayMode:e,selector:t,selectorType:n,path:r,value:i,params:a,fromSubscriptions:o})},[s]),d=g((e,t,n,r,i,a=!1)=>s({type:NAe.STYLE_UPDATE_SELECTOR,displayMode:e,selector:t,path:n,value:r,params:i,fromSubscriptions:a}),[s]),u=g((e,t,n=!1)=>s({type:NAe.STYLE_REMOVE_SELECTOR,displayMode:e,selector:t,fromSubscriptions:n}),[s]),h=g((e,t,n=!1)=>s({type:NAe.STYLE_REMOVE_SELECTORS,displayMode:e,selectors:t,fromSubscriptions:n}),[s]),f=g((e,t,n,r,i,a=!1)=>{s({type:NAe.STYLE_ADD_SELECTOR_VARIABLE,displayMode:e,selector:t,category:n,name:r,value:i,fromSubscriptions:a})},[s]),p=g((e,t,n,r,i,a=!1)=>{s({type:NAe.STYLE_UPDATE_SELECTOR_VARIABLE,displayMode:e,selector:t,category:n,name:r,value:i,fromSubscriptions:a})},[s]),v=g((e,t,n,r,i=!1)=>{s({type:NAe.STYLE_REMOVE_SELECTOR_VARIABLE,displayMode:e,selector:t,category:n,name:r,fromSubscriptions:i})},[s]),b=g((e,t,n,r=!1)=>s({type:NAe.STYLE_ADD_VARIABLE,category:e,name:t,value:n,fromSubscriptions:r}),[s]),x=g((e,t,n,r=!1)=>s({type:NAe.STYLE_UPDATE_VARIABLE,category:e,name:t,value:n,fromSubscriptions:r}),[s]),w=g((e,t,n=!1)=>s({type:NAe.STYLE_REMOVE_VARIABLE,category:e,name:t,fromSubscriptions:n}),[s]),O=g((e,t=!1)=>s({type:NAe.STYLE_ADD_TEMPLATE,platform:e,fromSubscriptions:t}),[s]),S=g((e,t,n=!1)=>{s({type:NAe.STYLE_UPDATE_SETTINGS,path:e,value:t,fromSubscriptions:n})},[s]);y(()=>(n&&(i.subscribe("StyleUpdated",{},e=>{if(!e.data||e.error)return;let t=ne(e,"data.StyleUpdated",{});l(t,!0)}),i.subscribe("StyleAddSelector",{},e=>{if(!e.data||e.error)return;let{displayMode:t,selector:n,type:r,path:i,style:a,params:o}=ne(e,"data.StyleAddSelector",{});c(t,n,r,i,a,o,!0)}),i.subscribe("StyleUpdateSelector",{},e=>{if(!e.data||e.error)return;let{displayMode:t,selector:n,path:r,style:i,params:a}=ne(e,"data.StyleUpdateSelector",{});d(t,n,r,i,a,!0)}),i.subscribe("StyleRemoveSelector",{},e=>{if(!e.data||e.error)return;let{displayMode:t,selector:n}=ne(e,"data.StyleRemoveSelector",{});u(t,n,!0)}),i.subscribe("StyleRemoveSelectors",{},e=>{if(!e.data||e.error)return;let{displayMode:t,selectors:n}=ne(e,"data.StyleRemoveSelectors",{});h(t,n,!0)}),i.subscribe("StyleAddSelectorVariable",{},e=>{if(!e.data||e.error)return;let{displayMode:t,selector:n,category:r,name:i,value:a}=ne(e,"data.StyleAddSelectorVariable",{});f(t,n,r,i,a,!0)}),i.subscribe("StyleUpdateSelectorVariable",{},e=>{if(!e.data||e.error)return;let{displayMode:t,selector:n,category:r,name:i,value:a}=ne(e,"data.StyleUpdateSelectorVariable",{});p(t,n,r,i,a,!0)}),i.subscribe("StyleRemoveSelectorVariable",{},e=>{if(!e.data||e.error)return;let{displayMode:t,selector:n,category:r,name:i}=ne(e,"data.StyleRemoveSelectorVariable",{});v(t,n,r,i,!0)}),i.subscribe("StyleAddVariable",{},e=>{if(!e.data||e.error)return;let{category:t,name:n,value:r}=ne(e,"data.StyleAddVariable",{});b(t,n,r,!0)}),i.subscribe("StyleUpdateVariable",{},e=>{if(!e.data||e.error)return;let{category:t,name:n,value:r}=ne(e,"data.StyleUpdateVariable",{});x(t,n,r,!0)}),i.subscribe("StyleRemoveVariable",{},e=>{if(!e.data||e.error)return;let{category:t,name:n}=ne(e,"data.StyleRemoveVariable",{});w(t,n,!0)}),i.subscribe("StyleUpdateSettings",{},e=>{if(!e.data||e.error)return;let{path:t,value:n}=ne(e,"data.StyleUpdateSettings",{});S(t,n,!0)})),()=>{n&&i.unsubscribe(["StyleUpdated","StyleAddSelector","StyleUpdateSelector","StyleRemoveSelector","StyleRemoveSelectors","StyleAddSelectorVariable","StyleUpdateSelectorVariable","StyleRemoveSelectorVariable","StyleAddVariable","StyleUpdateVariable","StyleRemoveVariable","StyleUpdateSettings"])}),[i,n,l,c,d,u,h,f,p,v,b,x,w,S]);let C=k(()=>({styleUpdate:l,styleAddSelector:c,styleUpdateSelector:d,styleRemoveSelector:u,styleRemoveSelectors:h,styleAddSelectorVariable:f,styleUpdateSelectorVariable:p,styleRemoveSelectorVariable:v,styleAddVariable:b,styleUpdateVariable:x,styleRemoveVariable:w,styleAddTemplate:O,styleUpdateSettings:S}),[l,c,d,u,h,f,p,v,b,x,w,O,S]);return O9("main",C),/* @__PURE__ */P(DAe,{value:C,children:e})},VAe=({children:e,includeSubscriptions:t=!0})=>{const{style:n}=m(J6),{enqueueMiddleware:r}=m(PAe),{undoableMiddleware:i}=m(Hde);/* @__PURE__ */
4510
4510
  return P(LAe,{style:n,middlewares:k(()=>[r,i],[r,i]),includeSubscriptions:t,children:e})},QAe={past:[],future:[],canUndo:!1,canRedo:!1},jAe=(e=QAe,t)=>{switch(t.type){case"undoableAddUndo":{const n=ce(t,["type"]),r=[...e.past,n];return{past:r,future:[],canUndo:r.length>0,canRedo:!1}}case"undoableUndo":case"undoableRedo":return{past:t.past,future:t.future,canUndo:t.past.length>0,canRedo:t.future.length>0};case"undoableClearHistory":return QAe;default:return e}},FAe=({children:e})=>{const[t,n]=S(jAe,QAe),r=C(t);r.current=t;const i=g((e,t=!0)=>{switch(e.action.type){case pAe[e.action.type]:{const n=e;return void n.dispatch({type:pAe.SCHEMA_UPDATE,schema:t?n.prevState:n.nextState})}case NAe[e.action.type]:{const n=e;return void n.dispatch({type:NAe.STYLE_UPDATE,style:t?n.prevState:n.nextState})}case AAe[e.action.type]:{const n=e,r=n.prevState.segmentId;return void n.dispatch({type:AAe.SEGMENTS_UPDATE,segment:t?n.prevState[r]:n.nextState[r],segmentId:r})}default:return}},[]),a=g((e,t,r,i)=>{n({type:"undoableAddUndo",prevState:e,action:t,nextState:r,dispatch:i})},[n]),o=g(()=>{const{canUndo:e,past:t,future:a}=r.current;if(e){const e=t.pop();if(!e)return;const r=[...a,e];i(e),n({type:"undoableUndo",past:t,future:r})}},[n,i]),s=g(()=>{const{canRedo:e,past:t,future:a}=r.current;if(e){const e=a.pop();if(!e)return;const r=[...t,e];i(e,!1),n({type:"undoableRedo",past:r,future:a})}},[n,i]),l=g(()=>{n({type:"undoableClearHistory"})},[n]),c=g((e,t,n,r)=>a(e,r,t,n),[a]),{canUndo:d,canRedo:u}=t;/* @__PURE__ */
4511
- return P(Hde,{value:k(()=>({canUndo:d,canRedo:u,dispatchUndoable:n,undoableAddUndo:a,undoableUndo:o,undoableRedo:s,undoableClearHistory:l,undoableMiddleware:c}),[d,u,n,a,o,s,l,c]),children:e})},BAe=({children:e,instanceId:t,webKey:n="",webId:r,environment:i="main",userKey:a="",server:o,includeSubscriptions:s=!0,includeRealTime:l=!0,previewMode:c=!1,debugMode:d=!1})=>/* @__PURE__ */P(dAe,{instanceId:t,webKey:n,webId:r,environment:i,userKey:a,server:o,children:/* @__PURE__ */P(uAe,{includeSubscriptions:s,includeRealTime:l,children:/* @__PURE__ */P(MAe,{includeSubscriptions:s,children:/* @__PURE__ */P(FAe,{children:/* @__PURE__ */P(tde,{debugMode:d,children:/* @__PURE__ */P(RAe,{children:/* @__PURE__ */P(iAe,{children:/* @__PURE__ */P(fAe,{children:/* @__PURE__ */P(i2,{children:/* @__PURE__ */P(IAe,{includeSubscriptions:s,children:/* @__PURE__ */P(VAe,{includeSubscriptions:s,children:/* @__PURE__ */P(dde,{previewMode:c,environment:i,server:o,children:/* @__PURE__ */P(aAe,{previewMode:c,children:e})})})})})})})})})})})})}),qAe=({webKey:e="",webId:t,userKey:n="",instanceId:r="",server:i,environment:a="main",includeSubscriptions:o=!0,includeRealTime:s=!0,externalStyle:l="",debugMode:c=!1})=>{const[d,u]=z(!1),[h,f]=N3("builder-state.app.displayBorderComponents","black"),[p,m]=z(1),[g,v]=z("desktop"),[b,y]=z(!1);return sa("displayMode",g),/* @__PURE__ */P(Cte,{value:k(()=>({previewMode:d,debugMode:c,setPreviewMode:u,displayBorderComponents:h,setDisplayBorderComponents:f,zoom:p,setZoom:m,displayMode:g,setDisplayMode:v,mobilePreview:b,setMobilePreview:y}),[d,c,u,h,f,p,m,g,v,b,y]),children:k(()=>/* @__PURE__ */P(BAe,{instanceId:r,webKey:e,webId:t,environment:a,userKey:n,server:i,includeSubscriptions:o,includeRealTime:s,previewMode:d,debugMode:c,children:/* @__PURE__ */P(_ce,{environment:a,children:/* @__PURE__ */P(bde,{previewMode:d,children:/* @__PURE__ */P(A2,{renderLeftPopup:!1,renderRightPopup:!1,renderFloatingPopup:!d,children:/* @__PURE__ */P(hge,{innerClassName:"flex",enabled:c,instanceId:r,children:/* @__PURE__ */P(YEe,{externalStyle:l})})})})})}),[r,e,t,a,n,i,o,s,d,c,l])})},ZAe=e=>{const t=new Headers;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(e=>{const n=e.split(":"),r=n.shift()?.trim();if(r){const e=n.join(":").trim();t.append(r,e)}}),t},UAe=(e,t)=>t?.customFetch?((e,t)=>new Promise((n,r)=>{const i=new XMLHttpRequest;i.onload=()=>{const e={url:"",status:i.status,statusText:i.statusText,headers:ZAe(i.getAllResponseHeaders()||"")};e.url="responseURL"in i?i.responseURL:e.headers.get("X-Request-URL")??"";const t=i.response??i.responseText;n(new Response(t,e))},i.onerror=e=>{r(/* @__PURE__ */new TypeError("Network request failed")),t?.onError&&t.onError(e)},i.ontimeout=()=>{r(/* @__PURE__ */new TypeError("Network request failed"))},i.open(t?.method??"GET",e,!0),t?.headers&&Object.keys(t.headers).forEach(e=>{const n=t.headers;n[e]&&i.setRequestHeader(e,n[e])}),t?.onProgress&&(i.upload.onprogress=t.onProgress),t?.onAbortPossible&&t.onAbortPossible(()=>{i.abort()}),t?.body&&i.send(t.body)}))(e,t):fetch(e,t),WAe={name:"@plitzi/plitzi-builder",version:"0.32.9",homepage:"./",license:"AGPL-3.0",files:["dist"],repository:{type:"https",url:"https://github.com/plitzi/plitzi-workspace.git"},type:"module",main:"dist/plitzi-builder.js",module:"dist/plitzi-builder.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/plitzi-builder.js",default:"./dist/plitzi-builder.js"},"./plitzi-builder.css":"./dist/plitzi-builder.css","./plitzi-builder-vendor.js":"./dist/plitzi-builder-vendor.js","./plitzi-builder-dev-vendor.js":"./dist/plitzi-builder-dev-vendor.js","./plitzi-builder-dev-vendor.js.map":"./dist/plitzi-builder-dev-vendor.js.map"},dependencies:{"@apollo/client":"^4.2.7","@fortawesome/fontawesome-free":"^7.3.1","@plitzi/nexus":"workspace:*","@plitzi/plitzi-sdk":"workspace:*","@plitzi/plitzi-ui":"^1.6.17","@plitzi/sdk-auth":"workspace:*","@plitzi/sdk-collections":"workspace:*","@plitzi/sdk-dev-tools":"workspace:*","@plitzi/sdk-elements":"workspace:*","@plitzi/sdk-event-bridge":"workspace:*","@plitzi/sdk-interactions":"workspace:*","@plitzi/sdk-navigation":"workspace:*","@plitzi/sdk-plugins":"workspace:*","@plitzi/sdk-schema":"workspace:*","@plitzi/sdk-shared":"workspace:*","@plitzi/sdk-style":"workspace:*","@plitzi/sdk-variables":"workspace:*","@tanstack/react-virtual":"^3.14.8","@xyflow/react":"^12.11.2","apollo-upload-client":"^19.0.0",clsx:"^2.1.1",graphql:"^17.0.2","graphql-ws":"^6.1.1",immer:"^11.1.15",jszip:"^3.10.1","react-hook-form":"^7.82.0","react-router-dom":"^7.18.1",swr:"^2.4.2",uuid:"^14.0.1",zod:"^4.4.3"},peerDependencies:{react:"^19","react-dom":"^19"},devDependencies:{"@babel/compat-data":"^8.0.0","@babel/core":"^8.0.1","@babel/helper-builder-react-jsx-experimental":"^7.12.11","@babel/helper-validator-identifier":"^8.0.4","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-transform-private-methods":"^8.0.1","@babel/plugin-transform-runtime":"^8.0.1","@babel/polyfill":"^7.12.1","@babel/preset-env":"^8.0.2","@babel/preset-react":"^8.0.1","@tailwindcss/postcss":"^4.3.3","css-loader":"^7.1.4",cypress:"15.19.0",eslint:"^9.39.5","eslint-plugin-import":"^2.32.0","flow-bin":"^0.323.0",postcss:"^8.5.22","postcss-loader":"^8.2.1","postcss-scss":"^4.0.9",prettier:"^3.9.6","prop-types":"^15.8.1",react:"^19.2.8","react-dom":"^19.2.8","react-refresh":"^0.18.0","react-test-renderer":"^19.2.8",sass:"^1.101.6","sass-embedded":"^1.100.0","sass-loader":"^17.0.0",stylelint:"^17.14.1","stylelint-order":"^8.1.1","stylelint-scss":"^7.2.0",terser:"^5.49.0",typescript:"^6.0.3",vite:"^8.1.5","vite-plugin-dts":"^5.0.3","vite-plugin-ejs":"^2.0.0","vite-plugin-mkcert":"^2.1.0","vite-plugin-react":"^4.0.1",vitest:"^4.1.10"},scripts:{start:"vite dev --mode development",test:"vitest run","test:coverage":"",lint:"TIMING=1 eslint ./src","lint-style":'stylelint "**/*.scss" --custom-syntax postcss-scss',"lint-style:fix":'stylelint "**/*.scss" --custom-syntax postcss-scss --fix',typecheck:"tsc -p tsconfig.app.json --noEmit","build:dev":"tsc -p tsconfig.app.json --noEmit && vite build --mode development","build:dev-watch":"tsc -p tsconfig.app.json --noEmit && vite build --mode development --watch","build:dev-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build --mode development","build:dev-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build --mode development","build:prod":"tsc -p tsconfig.app.json --noEmit && vite build","build:prod-watch":"tsc -p tsconfig.app.json --noEmit && vite build --watch","build:prod-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build","build:prod-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build","build-vendor:dev":"vite build --config vite.vendor.config.ts --mode development","build-vendor:prod":"vite build --config vite.vendor.config.ts"},eslintConfig:{extends:"react-app"},browserslist:{production:[">0.2%","not dead","not op_mini all"],development:["last 1 chrome version","last 1 firefox version","last 1 safari version"]}},XAe={Button:pb,FileUpload:wF,ContentEditable:bF,Card:vb,Form:aZ,Input:Nq,Switch:Zq,Checkbox:Pb,Select:Tq,Select2:Rq,Heading:UX,Flex:Uv,ContainerResizable:Hj,ContainerCollapsable:Qj,Icon:Xv,IconGroup:XX,Popup:C2,Sidebar:h2,Tree:C5,Accordion:Kv,QueryBuilder:u5,Alert:sb,Modal:t2,Text:k5,Label:Eb,TextArea:Xq,ContainerFrame:nF,KVInput:JX,Markdown:tH,MenuList:F1,ContainerDraggable:Gj,Breadcrumb:ub,CodeMirror:KV,ErrorMessage:zb,ColorPicker:lQ,MetricInput:Y1,ContainerTabs:mF,ContainerFloating:tQ,Badge:cb},HAe=e=>{const{children:t,server:r,webKey:i="",includeSubscriptions:a=!0,userKey:o="",className:s="min-h-screen",debugMode:l=!1}=e,c=k(()=>function(e){if(!e)return 0;let t={};try{let n=e.split(".")[1],r=typeof window<"u"?window.atob(n):Buffer.from(n,"base64").toString();t=JSON.parse(r)}catch{return 0}return ne(t,"data.spaceId",0)}(i),[i]),[d,u]=N3(`web_${c}_state.instanceId`,"","sessionStorage"),[f,p]=N3("builder-state.debugMode",!1,"localStorage",l),m=k(()=>(e=>{const t={apiServer:"https://api.plitzi.com",ssrServer:"https://ssr.plitzi.com",basePath:"",host:"https://plitzi.com",serverUrl:"https://server.plitzi.com",websocketServer:"wss://server.plitzi.com",subscriptionServer:"wss://server.plitzi.com/subscriptions",location:void 0,...e};return"/"===t.basePath?t.basePath="":t.basePath&&(t.basePath=t.basePath.replaceAll("//","/")),t})(r),[r]),v=g(e=>{e.shiftKey&&"F12"===e.key&&p(e=>!e)},[p]);y(()=>{l&&window.addEventListener("keydown",v)},[v,l]),y(()=>{},[]);let b=!1;try{g8(),b=!0}catch{b=!1}y(()=>{const e=x5();u(e)},[c,u]);const x=g((e,t,n,r)=>{if(!e)return;const i=new vm,a=new uue({uri:e.serverUrl,fetch:UAe}),s=new iue(e=>{const n={...e.headers??{},"plitzi-instance-id":r,"plitzi-access-token":o,"sdk-version":WAe.version,"Apollo-Require-Preflight":"true"};return t&&(n.authorization=`Bearer ${t}`),{headers:n}}),l=Kf.from([sg(),s,a]);if(!n||!e.subscriptionServer)return new Hm({link:l,cache:i});const c=function(e){const{url:t,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:l=0,retryAttempts:c=5,retryWait:d=async function(e){const t=Math.pow(2,e);await new Promise(e=>setTimeout(e,1e3*t+Math.floor(2700*Math.random()+300)))},shouldRetry:u=xue,on:h,webSocketImpl:f,generateID:p=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},jsonMessageReplacer:m,jsonMessageReviver:g}=e;let v;if(f){if(!("function"==typeof(b=f)&&"constructor"in b&&"CLOSED"in b&&"CLOSING"in b&&"CONNECTING"in b&&"OPEN"in b))throw new Error("Invalid WebSocket implementation provided");v=f}else"undefined"!=typeof WebSocket?v=WebSocket:"undefined"!=typeof global?v=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window&&(v=window.WebSocket||window.MozWebSocket);var b;if(!v)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const y=v,x=(()=>{const e=/* @__PURE__ */(()=>{const e={};return{on:(t,n)=>(e[t]=n,()=>{delete e[t]}),emit(t){"id"in t&&e[t.id]?.(t)}}})(),t={connecting:h?.connecting?[h.connecting]:[],opened:h?.opened?[h.opened]:[],connected:h?.connected?[h.connected]:[],ping:h?.ping?[h.ping]:[],pong:h?.pong?[h.pong]:[],message:h?.message?[e.emit,h.message]:[e.emit],closed:h?.closed?[h.closed]:[],error:h?.error?[h.error]:[]};return{onMessage:e.on,on(e,n){const r=t[e];return r.push(n),()=>{const e=r.indexOf(n);e>-1&&r.splice(e,1)}},emit(e,...n){for(const r of[...t[e]])r(...n)}}})();function w(e){const t=[x.on("error",n=>{t.forEach(e=>e()),e(n)}),x.on("closed",n=>{t.forEach(e=>e()),e(n)})]}let O,k,S=0,C=!1,z=0,N=!1;async function E(){clearTimeout(k);const[e,r]=await(O??(O=new Promise((e,r)=>(async()=>{if(C){if(await d(z),!S)return O=void 0,r({code:1e3,reason:"All Subscriptions Gone"});z++}x.emit("connecting",C);const i=new y("function"==typeof t?await t():t,"graphql-transport-ws");let a,c;function u(){isFinite(o)&&o>0&&(clearTimeout(c),c=setTimeout(()=>{i.readyState===y.OPEN&&(i.send(bue({type:gue.Ping})),x.emit("ping",!1,void 0))},o))}w(e=>{O=void 0,clearTimeout(a),clearTimeout(c),r(e),e instanceof yue&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=e=>x.emit("error",e),i.onclose=e=>x.emit("closed",e),i.onopen=async()=>{try{x.emit("opened",i);const e="function"==typeof n?await n():n;if(i.readyState!==y.OPEN)return;i.send(bue(e?{type:gue.ConnectionInit,payload:e}:{type:gue.ConnectionInit},m)),isFinite(l)&&l>0&&(a=setTimeout(()=>{i.close(mue.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),u()}catch(e){x.emit("error",e),i.close(mue.InternalClientError,pue(e instanceof Error?e.message:String(e),"Internal client error"))}};let h=!1;i.onmessage=({data:t})=>{try{const n=function(e,t){return vue("string"==typeof e?JSON.parse(e,t):e)}(t,g);if(x.emit("message",n),"ping"===n.type||"pong"===n.type)return x.emit(n.type,!0,n.payload),void("pong"===n.type?u():s||(i.send(bue(n.payload?{type:gue.Pong,payload:n.payload}:{type:gue.Pong})),x.emit("pong",!1,n.payload)));if(h)return;if(n.type!==gue.ConnectionAck)throw new Error(`First message cannot be of type ${n.type}`);clearTimeout(a),h=!0,x.emit("connected",i,n.payload,C),C=!1,z=0,e([i,new Promise((e,t)=>w(t))])}catch(n){i.onmessage=null,x.emit("error",n),i.close(mue.BadResponse,pue(n instanceof Error?n.message:String(n),"Bad response"))}}})())));e.readyState===y.CLOSING&&await r;let i=()=>{};const c=new Promise(e=>i=e);return[e,i,Promise.race([c.then(()=>{if(!S){const t=()=>e.close(1e3,"Normal Closure");isFinite(a)&&a>0?k=setTimeout(()=>{e.readyState===y.OPEN&&t()},a):t()}}),r])]}function A(e){if(xue(e)&&(function(e){return![1e3,1001,1006,1005,1012,1013,1014].includes(e)&&e>=1e3&&e<=1999}(e.code)||[mue.InternalServerError,mue.InternalClientError,mue.BadRequest,mue.BadResponse,mue.Unauthorized,mue.SubprotocolNotAcceptable,mue.SubscriberAlreadyExists,mue.TooManyInitialisationRequests].includes(e.code)))throw e;if(N)return!1;if(xue(e)&&1e3===e.code)return S>0;if(!c||z>=c)throw e;if(!u(e))throw e;return C=!0}function T(e,t){const n=p(e);let r=!1,i=!1,a=()=>{S--,r=!0};return(async()=>{for(S++;;)try{const[o,s,l]=await E();if(r)return s();const c=x.onMessage(n,e=>{switch(e.type){case gue.Next:return void t.next(e.payload);case gue.Error:return i=!0,r=!0,t.error(e.payload),void a();case gue.Complete:return r=!0,void a()}});return o.send(bue({id:n,type:gue.Subscribe,payload:e},m)),a=()=>{r||o.readyState!==y.OPEN||o.send(bue({id:n,type:gue.Complete},m)),S--,r=!0,s()},void(await l.finally(c))}catch(o){if(!A(o))return}})().then(()=>{i||t.complete()}).catch(e=>{t.error(e)}),()=>{r||a()}}return r||(async()=>{for(S++;;)try{const[,,e]=await E();await e}catch(e){try{if(!A(e))return}catch(t){return i?.(t)}}})(),{on:x.on,subscribe:T,iterate(e){const t=[],n={done:!1,error:null,resolve:()=>{}},r=T(e,{next(e){t.push(e),n.resolve()},error(e){n.done=!0,n.error=e,n.resolve()},complete(){n.done=!0,n.resolve()}}),i=async function*(){for(;;){for(t.length||await new Promise(e=>n.resolve=e);t.length;)yield t.shift();if(n.error)throw n.error;if(n.done)return}}();return i.throw=async e=>(n.done||(n.done=!0,n.error=e,n.resolve()),{done:!0,value:void 0}),i.return=async()=>(r(),{done:!0,value:void 0}),i},async dispose(){if(N=!0,O){const[e]=await O;e.close(1e3,"Normal Closure")}},terminate(){O&&x.emit("closed",new yue)}}}({url:e.subscriptionServer,shouldRetry:()=>!0,retryAttempts:1/0,connectionParams:{authToken:t,instanceId:r,userToken:o},onNonLazyError:e=>{if(e instanceof Error){const{message:t}=e;"Space Not Allowed"!==t&&"Invalid Token"!==t&&"Missing auth token"!==t&&"Missing instanceId"!==t&&"Access Not Authorized"!==t&&"Token Invalid"!==t||c.dispose()}}}),d=new aue(c),u=new Hm({link:Kf.split(({query:e})=>{const t=xh(e);return"OperationDefinition"===t.kind&&t.operation===Ls},Kf.from([sg(),d]),l),cache:i});return u.subscriptionClient=c,u},[o]),w=k(()=>x(m,i,a,d),[x,m,i,a,d]),O=k(()=>{const e={};return t?(n.forEach(t,t=>{if(!h(t))return;const{renderType:n,component:r,settings:i,definition:a,...o}=t.props;if(!n||!r)return;const s=r;s.type=n,s.pluginSettings=i,s.extraProps=o,a&&(s.content=a),e[n]=s}),e):e},[t]);y(()=>{if(w)return()=>{const e=w.subscriptionClient;e&&e.dispose()}},[w]);const S=k(()=>w&&/* @__PURE__ */P(lue,{client:w,children:/* @__PURE__ */P(Ste,{localCustomComponents:O,localComponents:V,children:/* @__PURE__ */P(b3,{children:/* @__PURE__ */P(qAe,{...ce(e,["children","server"]),debugMode:f,server:m,instanceId:d,webId:c})})})}),[w,f,d,O,e,m,c]);/* @__PURE__ */
4511
+ return P(Hde,{value:k(()=>({canUndo:d,canRedo:u,dispatchUndoable:n,undoableAddUndo:a,undoableUndo:o,undoableRedo:s,undoableClearHistory:l,undoableMiddleware:c}),[d,u,n,a,o,s,l,c]),children:e})},BAe=({children:e,instanceId:t,webKey:n="",webId:r,environment:i="main",userKey:a="",server:o,includeSubscriptions:s=!0,includeRealTime:l=!0,previewMode:c=!1,debugMode:d=!1})=>/* @__PURE__ */P(dAe,{instanceId:t,webKey:n,webId:r,environment:i,userKey:a,server:o,children:/* @__PURE__ */P(uAe,{includeSubscriptions:s,includeRealTime:l,children:/* @__PURE__ */P(MAe,{includeSubscriptions:s,children:/* @__PURE__ */P(FAe,{children:/* @__PURE__ */P(tde,{debugMode:d,children:/* @__PURE__ */P(RAe,{children:/* @__PURE__ */P(iAe,{children:/* @__PURE__ */P(fAe,{children:/* @__PURE__ */P(i2,{children:/* @__PURE__ */P(IAe,{includeSubscriptions:s,children:/* @__PURE__ */P(VAe,{includeSubscriptions:s,children:/* @__PURE__ */P(dde,{previewMode:c,environment:i,server:o,children:/* @__PURE__ */P(aAe,{previewMode:c,children:e})})})})})})})})})})})})}),qAe=({webKey:e="",webId:t,userKey:n="",instanceId:r="",server:i,environment:a="main",includeSubscriptions:o=!0,includeRealTime:s=!0,externalStyle:l="",debugMode:c=!1})=>{const[d,u]=z(!1),[h,f]=N3("builder-state.app.displayBorderComponents","black"),[p,m]=z(1),[g,v]=z("desktop"),[b,y]=z(!1);return sa("displayMode",g),/* @__PURE__ */P(Cte,{value:k(()=>({previewMode:d,debugMode:c,setPreviewMode:u,displayBorderComponents:h,setDisplayBorderComponents:f,zoom:p,setZoom:m,displayMode:g,setDisplayMode:v,mobilePreview:b,setMobilePreview:y}),[d,c,u,h,f,p,m,g,v,b,y]),children:k(()=>/* @__PURE__ */P(BAe,{instanceId:r,webKey:e,webId:t,environment:a,userKey:n,server:i,includeSubscriptions:o,includeRealTime:s,previewMode:d,debugMode:c,children:/* @__PURE__ */P(_ce,{environment:a,children:/* @__PURE__ */P(bde,{previewMode:d,children:/* @__PURE__ */P(A2,{renderLeftPopup:!1,renderRightPopup:!1,renderFloatingPopup:!d,children:/* @__PURE__ */P(hge,{innerClassName:"flex",enabled:c,instanceId:r,children:/* @__PURE__ */P(YEe,{externalStyle:l})})})})})}),[r,e,t,a,n,i,o,s,d,c,l])})},ZAe=e=>{const t=new Headers;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(e=>{const n=e.split(":"),r=n.shift()?.trim();if(r){const e=n.join(":").trim();t.append(r,e)}}),t},UAe=(e,t)=>t?.customFetch?((e,t)=>new Promise((n,r)=>{const i=new XMLHttpRequest;i.onload=()=>{const e={url:"",status:i.status,statusText:i.statusText,headers:ZAe(i.getAllResponseHeaders()||"")};e.url="responseURL"in i?i.responseURL:e.headers.get("X-Request-URL")??"";const t=i.response??i.responseText;n(new Response(t,e))},i.onerror=e=>{r(/* @__PURE__ */new TypeError("Network request failed")),t?.onError&&t.onError(e)},i.ontimeout=()=>{r(/* @__PURE__ */new TypeError("Network request failed"))},i.open(t?.method??"GET",e,!0),t?.headers&&Object.keys(t.headers).forEach(e=>{const n=t.headers;n[e]&&i.setRequestHeader(e,n[e])}),t?.onProgress&&(i.upload.onprogress=t.onProgress),t?.onAbortPossible&&t.onAbortPossible(()=>{i.abort()}),t?.body&&i.send(t.body)}))(e,t):fetch(e,t),WAe={name:"@plitzi/plitzi-builder",version:"0.32.11",homepage:"./",license:"AGPL-3.0",files:["dist"],repository:{type:"https",url:"https://github.com/plitzi/plitzi-workspace.git"},type:"module",main:"dist/plitzi-builder.js",module:"dist/plitzi-builder.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/plitzi-builder.js",default:"./dist/plitzi-builder.js"},"./plitzi-builder.css":"./dist/plitzi-builder.css","./plitzi-builder-vendor.js":"./dist/plitzi-builder-vendor.js","./plitzi-builder-dev-vendor.js":"./dist/plitzi-builder-dev-vendor.js","./plitzi-builder-dev-vendor.js.map":"./dist/plitzi-builder-dev-vendor.js.map"},dependencies:{"@apollo/client":"^4.2.8","@fortawesome/fontawesome-free":"^7.3.1","@plitzi/nexus":"workspace:*","@plitzi/plitzi-sdk":"workspace:*","@plitzi/plitzi-ui":"^1.6.18","@plitzi/sdk-auth":"workspace:*","@plitzi/sdk-collections":"workspace:*","@plitzi/sdk-dev-tools":"workspace:*","@plitzi/sdk-elements":"workspace:*","@plitzi/sdk-event-bridge":"workspace:*","@plitzi/sdk-interactions":"workspace:*","@plitzi/sdk-navigation":"workspace:*","@plitzi/sdk-plugins":"workspace:*","@plitzi/sdk-schema":"workspace:*","@plitzi/sdk-shared":"workspace:*","@plitzi/sdk-style":"workspace:*","@plitzi/sdk-variables":"workspace:*","@tanstack/react-virtual":"^3.14.8","@xyflow/react":"^12.11.2","apollo-upload-client":"^19.0.0",clsx:"^2.1.1",graphql:"^17.0.2","graphql-ws":"^6.2.0",immer:"^11.1.15",jszip:"^3.10.1","react-hook-form":"^7.83.0","react-router-dom":"^7.18.1",swr:"^2.4.2",uuid:"^14.0.1",zod:"^4.4.3"},peerDependencies:{react:"^19","react-dom":"^19"},devDependencies:{"@babel/compat-data":"^8.0.0","@babel/core":"^8.0.1","@babel/helper-builder-react-jsx-experimental":"^7.12.11","@babel/helper-validator-identifier":"^8.0.4","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-transform-private-methods":"^8.0.1","@babel/plugin-transform-runtime":"^8.0.1","@babel/polyfill":"^7.12.1","@babel/preset-env":"^8.0.2","@babel/preset-react":"^8.0.1","@tailwindcss/postcss":"^4.3.3","css-loader":"^7.1.4",cypress:"15.19.0",eslint:"^9.39.5","eslint-plugin-import":"^2.32.0","flow-bin":"^0.324.0",postcss:"^8.5.23","postcss-loader":"^8.2.1","postcss-scss":"^4.0.9",prettier:"^3.9.6","prop-types":"^15.8.1",react:"^19.2.8","react-dom":"^19.2.8","react-refresh":"^0.18.0","react-test-renderer":"^19.2.8",sass:"^1.102.0","sass-embedded":"^1.100.0","sass-loader":"^17.0.0",stylelint:"^17.14.1","stylelint-order":"^8.1.1","stylelint-scss":"^7.2.0",terser:"^5.49.0",typescript:"^6.0.3",vite:"^8.1.5","vite-plugin-dts":"^5.0.3","vite-plugin-ejs":"^2.0.0","vite-plugin-mkcert":"^2.1.0","vite-plugin-react":"^4.0.1",vitest:"^4.1.10"},scripts:{start:"vite dev --mode development",test:"vitest run","test:coverage":"",lint:"TIMING=1 eslint ./src","lint-style":'stylelint "**/*.scss" --custom-syntax postcss-scss',"lint-style:fix":'stylelint "**/*.scss" --custom-syntax postcss-scss --fix',typecheck:"tsc -p tsconfig.app.json --noEmit","build:dev":"tsc -p tsconfig.app.json --noEmit && vite build --mode development","build:dev-watch":"tsc -p tsconfig.app.json --noEmit && vite build --mode development --watch","build:dev-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build --mode development","build:dev-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build --mode development","build:prod":"tsc -p tsconfig.app.json --noEmit && vite build","build:prod-watch":"tsc -p tsconfig.app.json --noEmit && vite build --watch","build:prod-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build","build:prod-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build","build-vendor:dev":"vite build --config vite.vendor.config.ts --mode development","build-vendor:prod":"vite build --config vite.vendor.config.ts"},eslintConfig:{extends:"react-app"},browserslist:{production:[">0.2%","not dead","not op_mini all"],development:["last 1 chrome version","last 1 firefox version","last 1 safari version"]}},XAe={Button:pb,FileUpload:wF,ContentEditable:bF,Card:vb,Form:aZ,Input:Nq,Switch:Zq,Checkbox:Pb,Select:Tq,Select2:Rq,Heading:UX,Flex:Uv,ContainerResizable:Hj,ContainerCollapsable:Qj,Icon:Xv,IconGroup:XX,Popup:C2,Sidebar:h2,Tree:C5,Accordion:Kv,QueryBuilder:u5,Alert:sb,Modal:t2,Text:k5,Label:Eb,TextArea:Xq,ContainerFrame:nF,KVInput:JX,Markdown:tH,MenuList:F1,ContainerDraggable:Gj,Breadcrumb:ub,CodeMirror:KV,ErrorMessage:zb,ColorPicker:lQ,MetricInput:Y1,ContainerTabs:mF,ContainerFloating:tQ,Badge:cb},HAe=e=>{const{children:t,server:r,webKey:i="",includeSubscriptions:a=!0,userKey:o="",className:s="min-h-screen",debugMode:l=!1}=e,c=k(()=>function(e){if(!e)return 0;let t={};try{let n=e.split(".")[1],r=typeof window<"u"?window.atob(n):Buffer.from(n,"base64").toString();t=JSON.parse(r)}catch{return 0}return ne(t,"data.spaceId",0)}(i),[i]),[d,u]=N3(`web_${c}_state.instanceId`,"","sessionStorage"),[f,p]=N3("builder-state.debugMode",!1,"localStorage",l),m=k(()=>(e=>{const t={apiServer:"https://api.plitzi.com",ssrServer:"https://ssr.plitzi.com",basePath:"",host:"https://plitzi.com",serverUrl:"https://server.plitzi.com",websocketServer:"wss://server.plitzi.com",subscriptionServer:"wss://server.plitzi.com/subscriptions",location:void 0,...e};return"/"===t.basePath?t.basePath="":t.basePath&&(t.basePath=t.basePath.replaceAll("//","/")),t})(r),[r]),v=g(e=>{e.shiftKey&&"F12"===e.key&&p(e=>!e)},[p]);y(()=>{l&&window.addEventListener("keydown",v)},[v,l]),y(()=>{},[]);let b=!1;try{g8(),b=!0}catch{b=!1}y(()=>{const e=x5();u(e)},[c,u]);const x=g((e,t,n,r)=>{if(!e)return;const i=new vm,a=new uue({uri:e.serverUrl,fetch:UAe}),s=new iue(e=>{const n={...e.headers??{},"plitzi-instance-id":r,"plitzi-access-token":o,"sdk-version":WAe.version,"Apollo-Require-Preflight":"true"};return t&&(n.authorization=`Bearer ${t}`),{headers:n}}),l=Kf.from([sg(),s,a]);if(!n||!e.subscriptionServer)return new Hm({link:l,cache:i});const c=function(e){const{url:t,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:l=0,retryAttempts:c=5,retryWait:d=async function(e){const t=Math.pow(2,e);await new Promise(e=>setTimeout(e,1e3*t+Math.floor(2700*Math.random()+300)))},shouldRetry:u=xue,on:h,webSocketImpl:f,generateID:p=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},jsonMessageReplacer:m,jsonMessageReviver:g}=e;let v;if(f){if(!("function"==typeof(b=f)&&"constructor"in b&&"CLOSED"in b&&"CLOSING"in b&&"CONNECTING"in b&&"OPEN"in b))throw new Error("Invalid WebSocket implementation provided");v=f}else"undefined"!=typeof WebSocket?v=WebSocket:"undefined"!=typeof global?v=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window&&(v=window.WebSocket||window.MozWebSocket);var b;if(!v)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const y=v,x=(()=>{const e=/* @__PURE__ */(()=>{const e={};return{on:(t,n)=>(e[t]=n,()=>{delete e[t]}),emit(t){"id"in t&&e[t.id]?.(t)}}})(),t={connecting:h?.connecting?[h.connecting]:[],opened:h?.opened?[h.opened]:[],connected:h?.connected?[h.connected]:[],ping:h?.ping?[h.ping]:[],pong:h?.pong?[h.pong]:[],message:h?.message?[e.emit,h.message]:[e.emit],closed:h?.closed?[h.closed]:[],error:h?.error?[h.error]:[]};return{onMessage:e.on,on(e,n){const r=t[e];return r.push(n),()=>{const e=r.indexOf(n);e>-1&&r.splice(e,1)}},emit(e,...n){for(const r of[...t[e]])r(...n)}}})();function w(e){const t=[x.on("error",n=>{t.forEach(e=>e()),e(n)}),x.on("closed",n=>{t.forEach(e=>e()),e(n)})]}let O,k,S=0,C=!1,z=0,N=!1;async function E(){clearTimeout(k);const[e,r]=await(O??(O=new Promise((e,r)=>(async()=>{if(C){if(await d(z),!S)return O=void 0,r({code:1e3,reason:"All Subscriptions Gone"});z++}x.emit("connecting",C);const i=new y("function"==typeof t?await t():t,"graphql-transport-ws");let a,c;function u(){isFinite(o)&&o>0&&(clearTimeout(c),c=setTimeout(()=>{i.readyState===y.OPEN&&(i.send(bue({type:gue.Ping})),x.emit("ping",!1,void 0))},o))}w(e=>{O=void 0,clearTimeout(a),clearTimeout(c),r(e),e instanceof yue&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=e=>x.emit("error",e),i.onclose=e=>x.emit("closed",e),i.onopen=async()=>{try{x.emit("opened",i);const e="function"==typeof n?await n():n;if(i.readyState!==y.OPEN)return;i.send(bue(e?{type:gue.ConnectionInit,payload:e}:{type:gue.ConnectionInit},m)),isFinite(l)&&l>0&&(a=setTimeout(()=>{i.close(mue.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),u()}catch(e){x.emit("error",e),i.close(mue.InternalClientError,pue(e instanceof Error?e.message:String(e),"Internal client error"))}};let h=!1;i.onmessage=({data:t})=>{try{const n=function(e,t){return vue("string"==typeof e?JSON.parse(e,t):e)}(t,g);if(x.emit("message",n),"ping"===n.type||"pong"===n.type)return x.emit(n.type,!0,n.payload),void("pong"===n.type?u():s||(i.send(bue(n.payload?{type:gue.Pong,payload:n.payload}:{type:gue.Pong})),x.emit("pong",!1,n.payload)));if(h)return;if(n.type!==gue.ConnectionAck)throw new Error(`First message cannot be of type ${n.type}`);clearTimeout(a),h=!0,x.emit("connected",i,n.payload,C),C=!1,z=0,e([i,new Promise((e,t)=>w(t))])}catch(n){i.onmessage=null,x.emit("error",n),i.close(mue.BadResponse,pue(n instanceof Error?n.message:String(n),"Bad response"))}}})())));e.readyState===y.CLOSING&&await r;let i=()=>{};const c=new Promise(e=>i=e);return[e,i,Promise.race([c.then(()=>{if(!S){const t=()=>e.close(1e3,"Normal Closure");isFinite(a)&&a>0?k=setTimeout(()=>{e.readyState===y.OPEN&&t()},a):t()}}),r])]}function A(e){if(xue(e)&&(function(e){return![1e3,1001,1006,1005,1012,1013,1014].includes(e)&&e>=1e3&&e<=1999}(e.code)||[mue.InternalServerError,mue.InternalClientError,mue.BadRequest,mue.BadResponse,mue.Unauthorized,mue.SubprotocolNotAcceptable,mue.SubscriberAlreadyExists,mue.TooManyInitialisationRequests].includes(e.code)))throw e;if(N)return!1;if(xue(e)&&1e3===e.code)return S>0;if(!c||z>=c)throw e;if(!u(e))throw e;return C=!0}function T(e,t){const n=p(e);let r=!1,i=!1,a=()=>{S--,r=!0};return(async()=>{for(S++;;)try{const[o,s,l]=await E();if(r)return s();const c=x.onMessage(n,e=>{switch(e.type){case gue.Next:return void t.next(e.payload);case gue.Error:return i=!0,r=!0,t.error(e.payload),void a();case gue.Complete:return r=!0,void a()}});return o.send(bue({id:n,type:gue.Subscribe,payload:e},m)),a=()=>{r||o.readyState!==y.OPEN||o.send(bue({id:n,type:gue.Complete},m)),S--,r=!0,s()},void(await l.finally(c))}catch(o){if(!A(o))return}})().then(()=>{i||t.complete()}).catch(e=>{t.error(e)}),()=>{r||a()}}return r||(async()=>{for(S++;;)try{const[,,e]=await E();await e}catch(e){try{if(!A(e))return}catch(t){return i?.(t)}}})(),{on:x.on,subscribe:T,iterate(e){const t=[],n={done:!1,error:null,resolve:()=>{}},r=T(e,{next(e){t.push(e),n.resolve()},error(e){n.done=!0,n.error=e,n.resolve()},complete(){n.done=!0,n.resolve()}}),i=async function*(){for(;;){for(t.length||await new Promise(e=>n.resolve=e);t.length;)yield t.shift();if(n.error)throw n.error;if(n.done)return}}();return i.throw=async e=>(n.done||(n.done=!0,n.error=e,n.resolve()),{done:!0,value:void 0}),i.return=async()=>(r(),{done:!0,value:void 0}),i},async dispose(){if(N=!0,O){const[e]=await O;e.close(1e3,"Normal Closure")}},terminate(){O&&x.emit("closed",new yue)}}}({url:e.subscriptionServer,shouldRetry:()=>!0,retryAttempts:1/0,connectionParams:{authToken:t,instanceId:r,userToken:o},onNonLazyError:e=>{if(e instanceof Error){const{message:t}=e;"Space Not Allowed"!==t&&"Invalid Token"!==t&&"Missing auth token"!==t&&"Missing instanceId"!==t&&"Access Not Authorized"!==t&&"Token Invalid"!==t||c.dispose()}}}),d=new aue(c),u=new Hm({link:Kf.split(({query:e})=>{const t=xh(e);return"OperationDefinition"===t.kind&&t.operation===Ls},Kf.from([sg(),d]),l),cache:i});return u.subscriptionClient=c,u},[o]),w=k(()=>x(m,i,a,d),[x,m,i,a,d]),O=k(()=>{const e={};return t?(n.forEach(t,t=>{if(!h(t))return;const{renderType:n,component:r,settings:i,definition:a,...o}=t.props;if(!n||!r)return;const s=r;s.type=n,s.pluginSettings=i,s.extraProps=o,a&&(s.content=a),e[n]=s}),e):e},[t]);y(()=>{if(w)return()=>{const e=w.subscriptionClient;e&&e.dispose()}},[w]);const S=k(()=>w&&/* @__PURE__ */P(lue,{client:w,children:/* @__PURE__ */P(Ste,{localCustomComponents:O,localComponents:V,children:/* @__PURE__ */P(b3,{children:/* @__PURE__ */P(qAe,{...ce(e,["children","server"]),debugMode:f,server:m,instanceId:d,webId:c})})})}),[w,f,d,O,e,m,c]);/* @__PURE__ */
4512
4512
  return P(Fi,{value:k(()=>({styleSelector:"base"}),[]),middlewares:[d9(no("builder")),h9(c),...f?[()=>({onChange:e=>U9.recordStoreChange(e)}),Hi({shouldRecord:e=>!e?.startsWith("runtime.elements")})]:[]],children:/* @__PURE__ */P(s9,{storageKey:"builder-state.theme",children:/* @__PURE__ */P(T2,{components:XAe,children:/* @__PURE__ */M(aF,{className:ge("plitzi-builder flex items-stretch",s),children:[!b&&/* @__PURE__ */P(eee,{basename:m.basePath??"",children:S}),b&&S]})})})})};function YAe(e,t={},n={},r=!1){const i=()=>(r||bs(),/* @__PURE__ */P(HAe,{...t,debugMode:r,children:Object.keys(n).map(e=>/* @__PURE__ */P(rue.Plugin,{renderType:e,settings:n[e].pluginSettings,definition:n[e].content,component:n[e]},e))}));"undefined"!=typeof document&&E.createRoot(document.getElementById(e)).render(/* @__PURE__ */P(i,{}))}var _Ae=e=>{const{debugMode:t=!1,children:n}=e;return y(()=>{t||bs()},[t]),/* @__PURE__ */P(HAe,{...e,children:n})};_Ae.Plugin=rue.Plugin;var{version:GAe}=WAe;export{co as ComponentContext,Ste as ComponentProvider,H9 as JsxManager,ao as PlitziServiceProvider,n7 as PluginManager,bo as PluginRemote,nte as ReplicaProvider,oo as RootElement,_Ae as default,YAe as render,G as useElement,io as usePlitziServiceContext,J as useRscData,GAe as version,W9 as withElement};