@valbuild/ui 0.78.3 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/valbuild-ui.cjs.js +1 -1
- package/dist/valbuild-ui.esm.js +1 -1
- package/package.json +3 -3
- package/server/.tmp/assets/{index-DG1iVa23.js → index-DpuBcW47.js} +16 -16
- package/server/.tmp/assets/{index-VKTuo3t4.css → index-zYwqLWu7.css} +1 -1
- package/server/.tmp/index.html +2 -2
- package/server/dist/valbuild-ui-server.cjs.js +2 -2
- package/server/dist/valbuild-ui-server.esm.js +2 -2
|
@@ -40,15 +40,15 @@ Error generating stack: `+i.message+`
|
|
|
40
40
|
*/var xz=g,bz=Symbol.for("react.element"),wz=Symbol.for("react.fragment"),Sz=Object.prototype.hasOwnProperty,kz=xz.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ez={key:!0,ref:!0,__self:!0,__source:!0};function tM(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)Sz.call(t,r)&&!Ez.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:bz,type:e,key:i,ref:s,props:o,_owner:kz.current}}Ov.Fragment=wz;Ov.jsx=tM;Ov.jsxs=tM;eM.exports=Ov;var f=eM.exports;function ub(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function O1(e,t){if(e){if(typeof e=="string")return ub(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ub(e,t):void 0}}function zc(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=O1(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
41
41
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function M1(e){return e.length>0}var Fh=Object.freeze({kind:"ok",value:void 0});function En(e){return e===void 0?Fh:{kind:"ok",value:e}}function Vn(e){return{kind:"err",error:e}}function ju(e){return e===Fh||e.kind==="ok"}function Mv(e){return e!==Fh&&e.kind==="err"}function nM(e){var t=[],n=[],r=zc(e),o;try{for(r.s();!(o=r.n()).done;){var i=o.value;ju(i)?t.push(i.value):n.push(i.error)}}catch(s){r.e(s)}finally{r.f()}return M1(n)?Vn(n):En(t)}function Cz(e){return nM(e)}function _z(e){var t=[],n=zc(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value;Mv(o)&&t.push(o.error)}}catch(i){n.e(i)}finally{n.f()}return M1(t)?Vn(t):Fh}function j1(e,t){return function(n){for(var r=En(t),o=0;o<n.length&&ju(r);++o)r=e(r.value,n[o],o);return r}}function to(e){return function(t){return ju(t)?En(e(t.value)):t}}function Cl(e){return function(t){return ju(t)?e(t.value):t}}function Pz(e){return function(t){return Mv(t)?Vn(e(t.error)):t}}function Nz(e,t){return function(n){return e(n)?En(n):Vn(t(n))}}var jv=function(t,n){return function(r){return ju(r)?t(r.value)?r:Vn(n(r.value)):r}},Tz=Object.freeze({__proto__:null,voidOk:Fh,ok:En,err:Vn,isOk:ju,isErr:Mv,allT:nM,all:Cz,allV:_z,flatMapReduce:j1,map:to,flatMap:Cl,mapErr:Pz,fromPredicate:Nz,filterOrElse:jv});function Oz(e){if(Array.isArray(e))return e}function Mz(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function jz(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
42
42
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Un(e,t){return Oz(e)||Mz(e,t)||O1(e,t)||jz()}function Rz(e){if(Array.isArray(e))return ub(e)}function Iz(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Az(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
43
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mc(e){return Rz(e)||Iz(e)||O1(e)||Az()}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ae(e)}function Dz(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rM(e){var t=Dz(e,"string");return typeof t=="symbol"?t:t+""}function H(e,t,n){return(t=rM(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SC(Object(n),!0).forEach(function(r){H(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lz(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rM(r.key),r)}}function Tn(e,t,n){return t&&Lz(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ag(e){return ag=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ag(e)}function oM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oM=function(){return!!e})()}function Fz(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zz(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fz(e)}function Hr(e,t,n){return t=ag(t),zz(e,oM()?Reflect.construct(t,[],ag(e).constructor):t.apply(e,n))}function db(e,t){return db=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},db(e,t)}function Wr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&db(e,t)}var Kr=function(){function e(){Nn(this,e)}return Tn(e,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):H({},r,[{message:o,value:i}])}}])}(),iM=Symbol("GetSchema"),sM=Symbol("Path"),$z=Symbol("GetSource");function Bz(e){return e[iM]}var De="_type",vt="_ref",fb="_tag";function Vz(e){return ae(e)==="object"&&e!==null&&De in e&&e[De]==="file"&&vt in e&&typeof e[vt]=="string"}var Uz=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Wr(t,e),Tn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return H({},r,[{message:"Non-optional file was null or undefined.",value:o}]);if(typeof o[vt]!="string")return H({},r,[{message:"File did not have a file reference string. Got: ".concat(ae(o[vt])),value:o}]);if(this.isRemote&&o[De]!=="remote")return H({},r,[{message:"Expected a remote file, but got a local file.",value:o,fixes:["file:upload-remote"]}]);if(this.isRemote&&o[De]==="remote")return H({},r,[{message:"Remote file was not checked.",value:o,fixes:["file:check-remote"]}]);if(!this.isRemote&&o[De]==="remote")return H({},r,[{message:"Expected locale file, but found remote.",value:o,fixes:["file:download-remote"]}]);if(o[De]!=="file")return H({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[De]),value:o,fixes:["file:change-extension","file:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return H({},r,[{message:"Invalid mime type format. Got: ".concat(l),value:o,fixes:["file:change-extension","file:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(h){return h.trim()}),u=c.some(function(h){if(h==="*/*")return!0;if(h.endsWith("/*")){var p=h.slice(0,-2);return l.startsWith(p)}return h===l});if(!u)return H({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}])}var d=X.filenameToMimeType(o[vt]);return d?d!==l?H({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}]):o.metadata?H({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the mimeType.",value:o,fixes:["file:check-metadata"]}]):H({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}]):H({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[vt]),value:o,fixes:["file:change-extension","file:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected object, got '".concat(ae(o),"'"),typeError:!0}])}:vt in o?De in o&&o[De]==="file"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt,remote:this.isRemote}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Hz=function(t){return new Uz(t)};function Wz(e){return e[vt].startsWith("/public")?e.patch_id?{url:"/api/val/files"+e[vt]+"?patch_id=".concat(e.patch_id),metadata:e.metadata}:{url:e[vt].slice(7),metadata:e.metadata}:{url:e[vt]+(e.patch_id?"?patch_id=".concat(e.patch_id):""),metadata:e.metadata}}function Kz(e){return ae(e)==="object"&&e!==null&&e!==void 0&&sM in e&&"val"in e}function aM(e){return e[sM]}function zf(e,t){if(ae(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(e)return e.includes(X.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(X.ModuleFilePathSep).concat(JSON.stringify(t))}function _r(e,t){if(ae(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(!e)throw Error("Cannot create val path of array item of empty or missing path: ".concat(e,". Item: ").concat(t));return e.includes(X.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(X.ModuleFilePathSep).concat(JSON.stringify(t))}var lg=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.items=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?H({},r,[{message:"Expected 'object', got 'null'"}]):ae(o)!=="object"?H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'")}]):Array.isArray(o)?H({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=Un(a,2),c=l[0],u=l[1],d=zf(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var h=u.validate(d,o[c]);h&&s?s=Vt(Vt({},h),s):h&&(s=h)}}),s)}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(ae(o)!=="object")return{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])};if(Array.isArray(o))return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])};for(var i=[],s=0,a=Object.keys(this.items);s<a.length;s++){var l=a[s],c=zf(r,l);c?l in o||i.push({message:"Expected key '".concat(l,"' not found in object"),typeError:!0}):i.push({message:"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(l),internalError:!0})}return i.length>0?{success:!1,errors:H({},r,i)}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=Un(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null)return i;for(var s in this.items){var a=o[s];if(a!=null){var l=_r(r,s),c=this.items[s].executePreview(l,a);for(var u in c){var d=u;i[d]=c[d]}}}return i}}])}(Kr),Gz=function(t){return new lg(t)},lM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),H(r,"previewInput",null),r.item=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=this.assert(r,o);if(!i.success)return i.errors;if(i.data===null)return!1;for(var s={},a=0,l=Object.entries(i.data);a<l.length;a++){var c=Un(l[a],2),u=c[0],d=c[1],h=_r(r,Number(u)),p=this.item.validate(h,d);p&&(s=Vt(Vt({},p),s))}return Object.keys(s).length===0?!1:s}},{key:"assert",value:function(r,o){return o===null&&this.opt?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected object of type 'array'",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null)return i;for(var s=0;s<o.length;s++){var a=s,l=o[a];if(l!=null){var c=_r(r,a),u=this.item.executePreview(c,l);for(var d in u){var h=d;i[h]=u[h]}}}if(this.previewInput){var p=this.previewInput,m=p.prepare,v=p.layout;v!=="list"&&(i[r]={status:"error",message:"Unknown layout type: "+v});try{i[r]={status:"success",data:{layout:"list",parent:"array",items:o.map(function(x){var b=m({val:x}),w=b.title,S=b.subtitle,C=b.image;return{title:w,subtitle:S,image:C}})}}}catch(x){i[r]={status:"error",message:x instanceof Error?x.message:"Unknown error"}}}return i}},{key:"preview",value:function(r){return this.previewInput=r,this}}])}(Kr),qz=function(t){return new lM(t)},Ka=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.value=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),value:o}]):o!==this.value?H({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o=="string"&&o===this.value?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Yz=function(t){return new Ka(t)},cM=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),o=Hr(this,t),o.key=n,o.items=r,o.opt=i,o}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i===null)return!1;if(!this.key)return H({},r,[{message:"Missing required first argument in union",schemaError:!0}]);var a=this.key;if(!Array.isArray(this.items))return H({},r,[{message:"A union schema must take more than 1 schema arguments",schemaError:!0}]);if(typeof a=="string"){if(this.items.some(function(M){return!(M instanceof lg)}))return H({},r,[{message:"Key is a string, so all schema items must be objects",schemaError:!0}]);var l=this.items,c=l.map(function(M){return M.serialize()}),u=c.filter(function(M){return M.type!=="object"||M.items[a].type!=="literal"});if(u.length>0)return H({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),schemaError:!0}]);var d=c,h=d.filter(function(M){return M.items[a].opt});if(h.length>1)return H({},r,[{message:"Schema cannot have an optional keys: ".concat(a),schemaError:!0}]);if(ae(i)!=="object")return H({},r,[{message:"Expected an object",typeError:!0}]);var p=i;if(p[a]===void 0)return H({},r,[{message:"Missing required key: ".concat(a),typeError:!0}]);var m=[],v=zc(d),x;try{for(v.s();!(x=v.n()).done;){var b=x.value,w=b.items[a];if(w.type==="literal")if(!m.includes(w.value))m.push(w.value);else return H({},r,[{message:"Found duplicate key in schema: ".concat(w.value),schemaError:!0}])}}catch(M){v.e(M)}finally{v.f()}var S=l.find(function(M){return!M.items[a].validate(r,p[a])});if(!S){var C=zf(r,a);if(!C)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return H({},C,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(M){var I=M.items[a];if(I.type==="literal"&&I.value)return'"'.concat(I.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(I,null,2)))}).join(", "))}])}var _=S.validate(r,p);if(_)return _}else if(a instanceof Ka){if(this.items.some(function(M){return!(M instanceof Ka)}))return H({},r,[{message:"Key is a literal schema, so all schema items must be literals",typeError:!0}]);var P=[a].concat(Mc(this.items));if(typeof i=="string"){var O=P.some(function(M){return!M.validate(r,i)});if(!O)return H({},r,[{message:"Union must match one of the following: ".concat(P.map(function(M){return'"'.concat(M.value,'"')}).join(", "))}])}}else return H({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(!this.key)return{success:!1,errors:H({},r,[{message:"Missing required first argument in union schema",schemaError:!0}])};if(!Array.isArray(this.items))return{success:!1,errors:H({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])};if(this.key instanceof Ka){var i,s=!1,a={},l=zc((i=[this.key]).concat.apply(i,Mc(this.items))),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!(u instanceof Ka))return{success:!1,errors:H({},r,[{message:"Schema of value is a union of string, so all schema items must be literals",schemaError:!0}])};if(typeof o!="string"){a[r]=[{message:"Expected 'string', got '".concat(ae(o),"'"),typeError:!0}];continue}var d=u.assert(r,o);if(d.success){s=!0;break}else for(var h=0,p=Object.entries(d.errors);h<p.length;h++){var m,v=Un(p[h],2),x=v[0],b=v[1];a[x]||(a[x]=[]),(m=a[x]).push.apply(m,Mc(b))}}}catch(W){l.e(W)}finally{l.f()}return s?{success:!0,data:o}:{success:!1,errors:a}}else if(typeof this.key=="string"){var w=!1,S={},C=zc(this.items),_;try{for(C.s();!(_=C.n()).done;){var P=_.value,O=P.assert(r,o);if(O.success){w=!0;break}else for(var M=0,I=Object.entries(O.errors);M<I.length;M++){var L,U=Un(I[M],2),$=U[0],K=U[1];S[$]||(S[$]=[]),(L=S[$]).push.apply(L,Mc(K))}}}catch(W){C.e(W)}finally{C.f()}return w?{success:!0,data:o}:{success:!1,errors:S}}else return{success:!1,errors:H({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])}}},{key:"nullable",value:function(){return new t(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",key:this.key.serialize(),items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null||this.key instanceof Ka)return i;var s=this.key;if(typeof s=="string"){var a=this.items.find(function(d){if(d instanceof lg){var h=d.items[s];if(h instanceof Ka)return ae(o)==="object"&&s in o&&h.value===o[s]}return!1});if(a){var l=a.executePreview(r,o);for(var c in l){var u=c;i[u]=l[u]}return i}i[r]={status:"error",message:"Could not find a matching (object) schema for the union key: ".concat(s)}}return i[r]={status:"error",message:"The schema of this value is wrong. Expected a object union schema, but union key is not a string. Got: '".concat(JSON.stringify(s,null,2),"'")},i}}])}(Kr),Jz=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new cM(t,r)},R1=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Wr(t,e),Tn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return H({},r,[{message:"Non-optional image was null or undefined.",value:o}]);if(this.isRemote&&o[De]!=="remote")return H({},r,[{message:"Expected a remote image, but got a local image.",value:o,fixes:["image:upload-remote"]}]);if(this.isRemote&&o[De]==="remote")return H({},r,[{message:"Remote image was not checked.",value:o,fixes:["image:check-remote"]}]);if(!this.isRemote&&o[De]==="remote")return H({},r,[{message:"Expected locale image, but found remote.",value:o,fixes:["image:download-remote"]}]);if(typeof o[vt]!="string")return H({},r,[{message:"Image did not have a file reference string. Got: ".concat(ae(o[vt])),value:o}]);if(o[De]!=="file")return H({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[De]),value:o,fixes:["image:change-extension","image:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return H({},r,[{message:"Invalid mime type format. Got: '".concat(l,"'"),value:o,fixes:["image:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(h){return h.trim()}),u=c.some(function(h){if(h==="*/*")return!0;if(h.endsWith("/*")){var p=h.slice(0,-2);return l.startsWith(p)}return h===l});if(!u)return H({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["image:check-metadata"]}])}var d=X.filenameToMimeType(o[vt]);return d?d&&l&&d!==l?H({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["image:check-metadata"]}]):o.metadata?o.metadata.hotspot&&(ae(o.metadata.hotspot)!=="object"||typeof o.metadata.hotspot.x!="number"||typeof o.metadata.hotspot.y!="number")?H({},r,[{message:"Hotspot must be an object with x and y as numbers.",value:o}]):H({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",value:o,fixes:["image:check-metadata"]}]):H({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}]):H({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[vt]),value:o,fixes:["image:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])}:vt in o?De in o&&o[De]==="file"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt,remote:this.isRemote}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Xz=function(t){return new R1(t)},uM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"maxLength",value:function(r){return new t(Vt(Vt({},this.options),{},{maxLength:r}),this.opt)}},{key:"minLength",value:function(r){return new t(Vt(Vt({},this.options),{},{minLength:r}),this.opt)}},{key:"validate",value:function(r,o){var i=this.assert(r,o);if(!i.success)return H({},r,i.errors[r]);var s=i.data;if(s===null&&this.opt)return!1;if(s===null)return H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}]);var a={},l=this.internalValidate(r,s,a);return l||(Object.keys(a).length>0?a:!1)}},{key:"internalValidate",value:function(r,o,i){var s=this,a=0,l=function(m,v,x){var b=function(j,F,J){x[j]||(x[j]=[]),x[j].push({message:F,typeError:J})},w=zc(v),S;try{for(w.s();!(S=w.n()).done;){var C,_,P,O,M,I,L,U,$,K,W,B=S.value,A=_r(m,v.indexOf(B));if(typeof B=="string"){a+=B.length;continue}if(ae(B)!=="object")return H({},A,[{message:"Expected nodes of type 'object' or 'string', got '".concat(ae(B),"'"),typeError:!0}]);if(B===null)return H({},A,[{message:"Expected nodes of type 'object' or 'string', got 'null'",typeError:!0}]);if(!("tag"in B))return H({},A,[{message:"Expected node to either have 'tag' or be of type 'string'",typeError:!0}]);if(typeof B.tag!="string")return H({},A,[{message:"Expected 'string', got '".concat(ae(B.tag),"'"),typeError:!0}]);if(B.tag==="h1"&&!((C=s.options.block)!==null&&C!==void 0&&C.h1)&&b(A,"'h' block is not valid",!1),B.tag==="h2"&&!((_=s.options.block)!==null&&_!==void 0&&_.h2)&&b(A,"'h2' block is not valid",!1),B.tag==="h3"&&!((P=s.options.block)!==null&&P!==void 0&&P.h3)&&b(A,"'h3' block is not valid",!1),B.tag==="h4"&&!((O=s.options.block)!==null&&O!==void 0&&O.h4)&&b(A,"'h4' block is not valid",!1),B.tag==="h5"&&!((M=s.options.block)!==null&&M!==void 0&&M.h5)&&b(A,"'h5' block is not valid",!1),B.tag==="h6"&&!((I=s.options.block)!==null&&I!==void 0&&I.h6)&&b(A,"'h6' block is not valid",!1),B.tag==="ol"&&!((L=s.options.block)!==null&&L!==void 0&&L.ol)&&b(A,"'ol' block is not valid",!1),B.tag==="ul"&&!((U=s.options.block)!==null&&U!==void 0&&U.ul)&&b(A,"'ul' block is not valid",!1),B.tag==="li"&&!(($=s.options.block)!==null&&$!==void 0&&$.ul)&&!((K=s.options.block)!==null&&K!==void 0&&K.ol)&&b(A,"'li' tag is invalid since neither 'ul' nor 'ol' block is not valid",!1),B.tag==="a"&&!((W=s.options.inline)!==null&&W!==void 0&&W.a)&&b(A,"'a' inline is not valid",!1),B.tag==="img"){var R,N;if(!((R=s.options.inline)!==null&&R!==void 0&&R.img))b(A,"'img' inline is not valid",!1);else if((N=s.options.inline)!==null&&N!==void 0&&N.img){var D,z;if(!("src"in B))return H({},A,[{message:"Expected 'src' in 'img'",typeError:!0}]);var V=_r(A,"src"),G=ae((D=s.options.inline)===null||D===void 0?void 0:D.img)==="object"?(z=s.options.inline)===null||z===void 0?void 0:z.img.validate(V,B.src):new R1({},!1,!1).validate(V,B.src);if(G)for(var _e in G){var Se,Be=_e;x[Be]||(x[Be]=[]),(Se=x[Be]).push.apply(Se,Mc(G[Be]))}}}if("styles"in B&&B.tag!=="span")return H({},A,[{message:"Cannot have styles on '".concat(B.tag,"'. This is only allowed on 'span'"),typeError:!0}]);if("styles"in B){if(!Array.isArray(B.styles))return H({},A,[{message:"Expected 'array', got '".concat(ae(B.styles),"'"),typeError:!0}]);for(var Z=_r(A,"styles"),Y=0;Y<B.styles.length;Y++){var ce,Ee,fe,Ie=B.styles[Y],Ce=_r(Z,Y);if(typeof Ie!="string")return H({},Ce,[{message:"Expected 'string', got '".concat(ae(Ie),"'"),typeError:!0}]);Ie==="bold"&&!((ce=s.options.style)!==null&&ce!==void 0&&ce.bold)&&b(Ce,"Style 'bold' is not valid",!1),Ie==="italic"&&!((Ee=s.options.style)!==null&&Ee!==void 0&&Ee.italic)&&b(Ce,"Style 'italic' is not valid",!1),Ie==="lineThrough"&&!((fe=s.options.style)!==null&&fe!==void 0&&fe.lineThrough)&&b(Ce,"Style 'lineThrough' is not valid",!1)}}if("children"in B){if(!Array.isArray(B.children))return H({},A,[{message:"Expected 'array', got '".concat(ae(B.children),"'"),typeError:!0}]);for(var Ye=B.children,pt=0;pt<Ye.length;pt++){var Wt=Ye[pt];if(ae(Wt)==="object"){var T=_r(A,"children"),k=l(T,[Wt],x);if(k)return k}else if(typeof Wt=="string"){a+=Wt.length;continue}else return H({},A,[{message:"Expected 'object' or 'string', got '".concat(ae(Wt),"'"),typeError:!0}])}}}}catch(E){w.e(E)}finally{w.f()}return!1},c=l(r,o,i),u=[];if(this.options.maxLength&&a>this.options.maxLength&&u.push({message:"Maximum length of ".concat(this.options.maxLength," exceeded (current length: ").concat(a,")"),typeError:!1}),this.options.minLength&&a<this.options.minLength&&u.push({message:"Minimum length of ".concat(this.options.minLength," not met (current length: ").concat(a,")"),typeError:!1}),c){if(u.length>0){var d;c[r]||(c[r]=[]),(d=c[r]).push.apply(d,u)}return c}if(Object.keys(i).length>0){if(u.length>0){var h;i[r]||(i[r]=[]),(h=i[r]).push.apply(h,u)}return i}return u.length>0?H({},r,u):!1}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null&&!this.opt)return{success:!1,errors:H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])};if(!Array.isArray(o))return{success:!1,errors:H({},r,[{message:"Expected 'array', got '".concat(ae(o),"'"),typeError:!0}])};for(var i={},s=0;s<o.length;s++)this.recursiveAssert(_r(r,s),o[s],i);return Object.keys(i).length>0?{success:!1,errors:i}:{success:!0,data:o}}},{key:"recursiveAssert",value:function(r,o,i){if(ae(o)!=="object"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0});return}if(Array.isArray(o)){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'array'",typeError:!0});return}if(o===null){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'null'",typeError:!0});return}if("tag"in o&&typeof o.tag!="string"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'string', got '".concat(ae(o.tag),"'"),typeError:!0});return}if("children"in o)if(Array.isArray(o.children))for(var s=0;s<o.children.length;s++){var a=o.children[s],l=_r(_r(r,"children"),s);if(ae(a)==="object")this.recursiveAssert(l,a,i);else{if(typeof a=="string")continue;i[l]||(i[l]=[]),i[l].push({message:"Expected 'object' or 'string', got '".concat(ae(a),"'"),typeError:!0})}}else{i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(ae(o.children),"'"),typeError:!0});return}if("styles"in o)if(!Array.isArray(o.styles))i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(ae(o.styles),"'"),typeError:!0});else for(var c=0;c<o.styles.length;c++){var u=o.styles[c];if(typeof u!="string"){var d=_r(r,c);i[d]||(i[d]=[]),i[d].push({message:"Expected 'string', got '".concat(ae(u),"'"),typeError:!0})}}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){var r={maxLength:this.options.maxLength,minLength:this.options.minLength,style:this.options.style,block:this.options.block,inline:this.options.inline&&{a:this.options.inline.a,img:this.options.inline.img&&ae(this.options.inline.img)==="object"?this.options.inline.img.serialize():this.options.inline.img}};return{type:"richtext",opt:this.opt,options:r}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Zz=function(t){return new uM(t??{})},dM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),H(r,"previewInput",null),r.item=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?H({},r,[{message:"Expected 'object', got 'null'"}]):ae(o)!=="object"?H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'")}]):Array.isArray(o)?H({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=Un(a,2),c=l[0],u=l[1],d=zf(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var h=i.item.validate(d,u);h&&s?s=Vt(Vt({},h),s):h&&(s=h)}}),s)}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null)return i;for(var s in o){var a=o[s];if(a!=null){var l=_r(r,s),c=this.item.executePreview(l,a);for(var u in c){var d=u;i[d]=c[d]}}}if(this.previewInput){var h=this.previewInput,p=h.prepare,m=h.layout;m!=="list"&&(i[r]={status:"error",message:"Unknown layout type: "+m});try{i[r]={status:"success",data:{layout:"list",parent:"record",items:Object.entries(o).map(function(v){var x=Un(v,2),b=x[0],w=x[1],S=p({key:b,val:w}),C=S.title,_=S.subtitle,P=S.image;return[b,{title:C,subtitle:_,image:P}]})}}}catch(v){i[r]={status:"error",message:v instanceof Error?v.message:"Unknown error"}}}return i}},{key:"preview",value:function(r){return this.previewInput=r,this}}])}(Kr),Qz=function(t){return new dM(t)};function e$(e){var t=e[$z],n=t;return n}function fM(e){var t=e.indexOf(va);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+va.length)]}function hM(e,t){return t===""?e:"".concat(e).concat(va).concat(t)}function t$(e){return e instanceof lg||ae(e)==="object"&&"type"in e&&e.type==="object"}function n$(e){return e instanceof dM||ae(e)==="object"&&"type"in e&&e.type==="record"}function r$(e){return e instanceof lM||ae(e)==="object"&&"type"in e&&e.type==="array"}function o$(e){return e instanceof cM||ae(e)==="object"&&"type"in e&&e.type==="union"}function i$(e){return e instanceof uM||ae(e)==="object"&&"type"in e&&e.type==="richtext"}function s$(e){return e instanceof R1||ae(e)==="object"&&"type"in e&&e.type==="image"}function a$(e,t,n){for(var r=cg(e),o=Mc(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(r$(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(ae(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ae(s)));s=s[u],i=i.item}else if(n$(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ae(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ae(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.item}else if(t$(i)){if(ae(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ae(s)));if(s!==null&&s[u]===void 0)throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s===null?s:s[u],i=i.items[u]}else{if(s$(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(x){return JSON.stringify(x)}).join("."),schema:i,source:s}};if(o$(i)){var d=i.key;if(typeof d!="string")return{v:{path:o.map(function(x){return Number.isNaN(Number(x))?JSON.stringify(x):x}).join("."),schema:i,source:s}};var h=s[d];if(!h)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(d," in path: ").concat(e));var p=i.items.find(function(x){var b;return(x==null||(b=x.items)===null||b===void 0||(b=b[d])===null||b===void 0?void 0:b.value)===h});if(!p)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(d," of value ").concat(h," in path: ").concat(e));i=p.items[u],s=s[u]}else if(i$(i)){if("src"in s&&"tag"in s&&s.tag==="img"&&r.length===0){var m,v;i=(m=i.options)!==null&&m!==void 0&&(m=m.inline)!==null&&m!==void 0&&m.img&&typeof((v=i.options)===null||v===void 0||(v=v.inline)===null||v===void 0?void 0:v.img)!="boolean"?i.options.inline.img:i}s=s[u]}else throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function l$(e){var t=e.split("/").slice(1);return t}function cg(e){for(var t=[],n=0;n<e.length;){var r="";if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&e[n+1]==='"'?(r+='"',n++):r+=e[n],n++;if(e[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(e),"): Missing closing double quote: ").concat((o=e[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(e.length,")"))}}else for(;n<e.length&&e[n]!==".";)r+=e[n],n++;r!==""&&t.push(r),n++}return t}function c$(e){return e.split(",")}function u$(e){var t=fM(e),n=Un(t,2),r=n[0],o=n[1],i=cg(o).slice(0,-1);return i.length>0?hM(r,pM(i)):r}function pM(e){return e.map(function(t){return Number.isInteger(Number(t))?t:JSON.stringify(t)}).join(".")}var d$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?H({},r,[{message:"Expected 'number', got '".concat(ae(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'number', got 'null'",typeError:!0}])}:typeof o=="number"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected 'number', got '".concat(ae(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}},{key:"executePreview",value:function(){return{}}}])}(Kr),f$=function(t){return new d$(t)},h$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return Wr(t,e),Tn(t,[{key:"min",value:function(r){return this.minLength(r)}},{key:"minLength",value:function(r){return new t(Vt(Vt({},this.options),{},{minLength:r}),this.opt,this.isRaw)}},{key:"max",value:function(r){return this.maxLength(r)}},{key:"maxLength",value:function(r){return new t(Vt(Vt({},this.options),{},{maxLength:r}),this.opt,this.isRaw)}},{key:"regexp",value:function(r){return new t(Vt(Vt({},this.options),{},{regexp:r}),this.opt,this.isRaw)}},{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?H({},r,l):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:typeof o=="string"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}},{key:"executePreview",value:function(){return{}}}])}(Kr),p$=function(t){return new h$(t)},m$=function(e){function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Nn(this,t),n=Hr(this,t),n.opt=r,n}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?H({},r,[{message:"Expected 'boolean', got '".concat(ae(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'boolean', got 'null'",typeError:!0}])}:typeof o!="boolean"?{success:!1,errors:H({},r,[{message:"Expected 'boolean', got '".concat(ae(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}},{key:"executePreview",value:function(){return{}}}])}(Kr),g$=function(){return new m$},v$=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),o=Hr(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return H({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="object"||i.type==="record"))return H({},r,[{message:"Schema in keyOf must be an 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="record"&&typeof o!="string")return H({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(o))return H({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return i.type==="record"?typeof o!="string"?H({},r,[{message:"Value of keyOf (record) must be 'string'. Found: ".concat(ae(o))}]):H({},r,[{fixes:["keyof:check-keys"],message:"Did not validate keyOf (record). This error (keyof:check-keys) should typically be processed by Val internally. Seeing this error most likely means you have a Val version mismatch.",value:{key:o,sourcePath:this.sourcePath}}]):!1}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])};var i=this.schema;if(!i)return{success:!1,errors:H({},r,[{message:"Neither key nor schema was found. keyOf is missing an argument.",typeError:!0}])};var s=i;if(!(s.type==="object"||s.type==="record"))return{success:!1,errors:H({},r,[{message:"Schema of first argument must be either: 'array', 'object' or 'record'. Found '".concat(s.type,"'"),typeError:!0}])};if(s.type==="record"&&typeof o!="string")return{success:!1,errors:H({},r,[{message:"Value of keyOf (record) must be 'string', got '".concat(ae(o),"'"),typeError:!0}])};if(s.type==="object"){var a=Object.keys(s.items);if(!a.includes(o))return{success:!1,errors:H({},r,[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o),typeError:!0}])}}return{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.schema,this.sourcePath,!0)}},{key:"serialize",value:function(){var r=this.sourcePath;if(!r)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module of record schema.");var o=this.schema;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(o.type){case"record":i="string";break;case"object":i=Object.keys(o.items);break;default:throw new Error("Cannot serialize keyOf schema with selector of type '".concat(o.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",path:r,schema:o,opt:this.opt,values:i}}},{key:"executePreview",value:function(){return{}}}])}(Kr),y$=function(t){var n;return new v$(t==null||(n=t[iM])===null||n===void 0?void 0:n.serialize(),aM(t))},x$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i,s,a,l;if(this.opt&&o==null)return!1;if(typeof o!="string")return H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),value:o}]);if((i=this.options)!==null&&i!==void 0&&i.from&&(s=this.options)!==null&&s!==void 0&&s.to){if(this.options.from>this.options.to)return H({},r,[{message:"From date ".concat(this.options.from," is after to date ").concat(this.options.to),value:o,typeError:!0}]);if(o<this.options.from||o>this.options.to)return H({},r,[{message:"Date is not between ".concat(this.options.from," and ").concat(this.options.to),value:o}])}else if((a=this.options)!==null&&a!==void 0&&a.from){if(o<this.options.from)return H({},r,[{message:"Date is before the minimum date ".concat(this.options.from),value:o}])}else if((l=this.options)!==null&&l!==void 0&&l.to&&o>this.options.to)return H({},r,[{message:"Date is after the maximum date ".concat(this.options.to),value:o}]);return!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o!="string"?{success:!1,errors:H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"from",value:function(r){return new t(Vt(Vt({},this.options),{},{from:r}),this.opt)}},{key:"to",value:function(r){return new t(Vt(Vt({},this.options),{},{to:r}),this.opt)}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"date",opt:this.opt,options:this.options}}},{key:"executePreview",value:function(){return{}}}])}(Kr),b$=function(t){return new x$(t)};function w$(){return{string:p$,boolean:g$,array:qz,object:Gz,number:f$,union:Jz,richtext:Zz,image:Xz,literal:Yz,keyOf:y$,record:Qz,file:Hz,date:b$}}function S$(e,t){var n=t.publicProjectId,r=t.coreVersion,o=t.validationHash,i=t.fileHash,s=t.filePath,a=t.bucket;return"".concat(e,"/file/p/").concat(n,"/b/").concat(a,"/v/").concat(r,"/h/").concat(o,"/f/").concat(i,"/p/").concat(s)}var k$=/^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;function mM(e){var t=e.match(k$);return t?t[7].indexOf("public/val/")!==0?{status:"error",error:"Invalid remote ref: "+e}:{status:"success",remoteHost:t[1],projectId:t[2],bucket:t[3],version:t[4],validationHash:t[5],fileHash:t[6],filePath:t[7]}:{status:"error",error:"Invalid remote ref: "+e}}var kC="https://remote.val.build";function E$(e){if(e!=null&&e.patch_id){var t=mM(e[vt]);if(t.status==="success")return{url:"/api/val/files/"+t.filePath+"?patch_id=".concat(e.patch_id,"&remote=true&ref=").concat(encodeURIComponent(e[vt])),metadata:e.metadata};console.warn("Internal Val error: failed to split remote ref: ".concat(e[vt],". The data format is different than what is expected. Check Val versions for mismatches."),t.error)}return{url:e[vt],metadata:e.metadata}}var Fr=Tn(function e(t){Nn(this,e),this.message=t}),C$=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],mt=function(e){return e[e.inputBytes=64]="inputBytes",e[e.inputWords=16]="inputWords",e[e.highIndex=14]="highIndex",e[e.lowIndex=15]="lowIndex",e[e.workWords=64]="workWords",e[e.allocBytes=80]="allocBytes",e[e.allocWords=20]="allocWords",e[e.allocTotal=8e3]="allocTotal",e}(mt||{});function _$(e){return new P$}var P$=function(){function e(){Nn(this,e),H(this,"A",1779033703),H(this,"B",-1150833019),H(this,"C",1013904242),H(this,"D",-1521486534),H(this,"E",1359893119),H(this,"F",-1694144372),H(this,"G",528734635),H(this,"H",1541459225),H(this,"_size",0),H(this,"_sp",0),(!Fp||fd>=mt.allocTotal)&&(Fp=new ArrayBuffer(mt.allocTotal),fd=0),this._byte=new Uint8Array(Fp,fd,mt.allocBytes),this._word=new Int32Array(Fp,fd,mt.allocWords),fd+=mt.allocBytes}return Tn(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+ae(n));var r=n.byteOffset,o=n.byteLength,i=o/mt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%mt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*mt.inputWords);i--;)this._int32(a,s>>2),s+=mt.inputBytes;this._size+=s}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+s,o-s);return this._uint8(c)}return s===o?this:this._uint8(n,s)}},{key:"_uint8",value:function(n,r){var o=this._byte,i=this._word,s=n.length;for(r=r|0;r<s;){for(var a=this._size%mt.inputBytes,l=a;r<s&&l<mt.inputBytes;)o[l++]=n[r++];l>=mt.inputBytes&&this._int32(i),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,i=n.length,s=this._sp,a=0;a<i;){for(var l=this._size%mt.inputBytes,c=l;a<i&&c<mt.inputBytes;){var u=n.charCodeAt(a++)|0;u<128?r[c++]=u:u<2048?(r[c++]=192|u>>>6,r[c++]=128|u&63):u<55296||u>57343?(r[c++]=224|u>>>12,r[c++]=128|u>>>6&63,r[c++]=128|u&63):s?(u=((s&1023)<<10)+(u&1023)+65536,r[c++]=240|u>>>18,r[c++]=128|u>>>12&63,r[c++]=128|u>>>6&63,r[c++]=128|u&63,s=0):s=u}c>=mt.inputBytes&&(this._int32(o),o[0]=o[mt.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,h=0;for(r=r|0;h<mt.inputWords;)Ua[h++]=bo(n[r++]);for(h=mt.inputWords;h<mt.workWords;h++)Ua[h]=A$(Ua[h-2])+Ua[h-7]+I$(Ua[h-15])+Ua[h-16]|0;for(h=0;h<mt.workWords;h++){var p=d+R$(l)+O$(l,c,u)+C$[h]+Ua[h]|0,m=j$(o)+M$(o,i,s)|0;d=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+m|0}this.A=o+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=l+this.E|0,this.F=c+this.F|0,this.G=u+this.G|0,this.H=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%mt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>mt.highIndex){for(;i<mt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<mt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[mt.highIndex]=bo(l)),a&&(o[mt.lowIndex]=bo(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H;return bs(n)+bs(r)+bs(o)+bs(i)+bs(s)+bs(a)+bs(l)+bs(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=bo(n),d[1]=bo(r),d[2]=bo(o),d[3]=bo(i),d[4]=bo(s),d[5]=bo(a),d[6]=bo(l),d[7]=bo(c),u.slice(0,32)}}])}(),Ua=new Int32Array(mt.workWords),Fp,fd=0,bs=function(t){return(t+4294967296).toString(16).substr(-8)},N$=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},T$=function(t){return t},bo=D$()?T$:N$,O$=function(t,n,r){return r^t&(n^r)},M$=function(t,n,r){return t&n|r&(t|n)},j$=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},R$=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},I$=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},A$=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function D$(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var I1=function(t){return _$().update(t).digest("hex")},A1={x3d:"application/vnd.hzn-3d-crossword","3gp":"video/3gpp","3g2":"video/3gpp2",mseq:"application/vnd.mseq",pwn:"application/vnd.3m.post-it-notes",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",acc:"application/vnd.americandynamics.acc",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",adp:"audio/adpcm",aab:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",air:"application/vnd.adobe.air-application-installer-package+zip",swf:"application/x-shockwave-flash",fxp:"application/vnd.adobe.fxp",pdf:"application/pdf",ppd:"application/vnd.cups-ppd",dir:"application/x-director",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",aac:"audio/x-aac",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",ami:"application/vnd.amiga.ami","N/A":"application/andrew-inset",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",dmg:"application/x-apple-diskimage",mpkg:"application/vnd.apple.installer+xml",aw:"application/applixware",mp3:"audio/mpeg",les:"application/vnd.hhe.lesson-player",swi:"application/vnd.aristanetworks.swi",s:"text/x-asm",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",atom:"application/atom+xml",ac:"application/pkix-attr-cert",aif:"audio/x-aiff",avi:"video/x-msvideo",aep:"application/vnd.audiograph",dxf:"image/vnd.dxf",dwf:"model/vnd.dwf",par:"text/plain-bas",bcpio:"application/x-bcpio",bin:"application/octet-stream",bmp:"image/bmp",torrent:"application/x-bittorrent",cod:"application/vnd.rim.cod",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",sh:"application/x-sh",btif:"image/prs.btif",rep:"application/vnd.businessobjects",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",c:"text/x-c",cdxml:"application/vnd.chemdraw+xml",css:"text/css",cdx:"chemical/x-cdx",cml:"chemical/x-cml",csml:"chemical/x-csml",cdbcmsg:"application/vnd.contact.cmsg",cla:"application/vnd.claymore",c4g:"application/vnd.clonk.c4group",sub:"image/vnd.dvb.subtitle",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",ras:"image/x-cmu-raster",dae:"model/vnd.collada+xml",csv:"text/csv",cpt:"application/mac-compactpro",wmlc:"application/vnd.wap.wmlc",cgm:"image/cgm",ice:"x-conference/x-cooltalk",cmx:"image/x-cmx",xar:"application/vnd.xara",cmc:"application/vnd.cosmocaller",cpio:"application/x-cpio",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",cryptonote:"application/vnd.rig.cryptonote",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cu:"application/cu-seeme",cww:"application/prs.cww",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",cmp:"application/vnd.yellowriver-custom-menu",dssc:"application/dssc+der",xdssc:"application/dssc+xml",deb:"application/x-debian-package",uva:"audio/vnd.dece.audio",uvi:"image/vnd.dece.graphic",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvu:"video/vnd.uvvu.mp4",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",dvi:"application/x-dvi",seed:"application/vnd.fdsn.seed",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",eol:"audio/vnd.digital-winds",djvu:"image/vnd.djvu",dtd:"application/xml-dtd",mlp:"application/vnd.dolby.mlp",wad:"application/x-doom",dpg:"application/vnd.dpgraph",dra:"audio/vnd.dra",dfac:"application/vnd.dreamfactory",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dwg:"image/vnd.dwg",geo:"application/vnd.dynageo",es:"application/ecmascript",mag:"application/vnd.ecowin.chart",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",exi:"application/exi",mgz:"application/vnd.proteus.magazine",epub:"application/epub+zip",eml:"message/rfc822",nml:"application/vnd.enliven",xpr:"application/vnd.is-xpr",xif:"image/vnd.xiff",xfdl:"application/vnd.xfdl",emma:"application/emma+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fst:"image/vnd.fst",fvt:"video/vnd.fvt",fbs:"image/vnd.fastbidsheet",fe_launch:"application/vnd.denovo.fcselayout-link",f4v:"video/x-f4v",flv:"video/x-flv",fpx:"image/vnd.fpx",npx:"image/vnd.net-fpx",flx:"text/vnd.fmi.flexstor",fli:"video/x-fli",ftc:"application/vnd.fluxtime.clip",fdf:"application/vnd.fdf",f:"text/x-fortran",mif:"application/vnd.mif",fm:"application/vnd.framemaker",fh:"image/x-freehand",fsc:"application/vnd.fsc.weblaunch",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",spl:"application/x-futuresplash",fzs:"application/vnd.fuzzysheet",g3:"image/g3fax",gmx:"application/vnd.gmx",gtw:"model/vnd.gtw",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gdl:"model/vnd.gdl",gex:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gsf:"application/x-font-ghostscript",bdf:"application/x-font-bdf",gtar:"application/x-gtar",texinfo:"application/x-texinfo",gnumeric:"application/x-gnumeric",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gif:"image/gif",gv:"text/vnd.graphviz",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",h261:"video/h261",h263:"video/h263",h264:"video/h264",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",hdf:"application/x-hdf",rip:"audio/vnd.rip",hbci:"application/vnd.hbci",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",hpgl:"application/vnd.hp-hpgl",hvs:"application/vnd.yamaha.hv-script",hvd:"application/vnd.yamaha.hv-dic",hvp:"application/vnd.yamaha.hv-voice","sfd-hdstx":"application/vnd.hydrostatix.sof-data",stk:"application/hyperstudio",hal:"application/vnd.hal+xml",html:"text/html",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",ics:"text/calendar",icc:"application/vnd.iccprofile",ico:"image/x-icon",igl:"application/vnd.igloader",ief:"image/ief",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",rif:"application/reginfo+xml","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",igs:"model/iges",i2g:"application/vnd.intergeo",cdy:"application/vnd.cinderella",xpw:"application/vnd.intercon.formnet",fcs:"application/vnd.isac.fcs",ipfix:"application/ipfix",cer:"application/pkix-cert",pki:"application/pkixcmp",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",igm:"application/vnd.insors.igm",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",jad:"text/vnd.sun.j2me.app-descriptor",jar:"application/java-archive",class:"application/java-vm",jnlp:"application/x-java-jnlp-file",ser:"application/java-serialized-object",java:"text/x-java-source,java",js:"application/javascript",json:"application/json",joda:"application/vnd.joost.joda-archive",jpm:"video/jpm",jpeg:"image/jpeg",jpg:"image/jpeg",pjpeg:"image/pjpeg",jpgv:"video/jpeg",ktz:"application/vnd.kahootz",mmd:"application/vnd.chipnuts.karaoke-mmd",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",latex:"application/x-latex",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",jam:"application/vnd.jam",123:"application/vnd.lotus-1-2-3",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",lvp:"audio/vnd.lucent.voice",m3u:"audio/x-mpegurl",m4v:"video/x-m4v",hqx:"application/mac-binhex40",portpkg:"application/vnd.macports.portpkg",mgp:"application/vnd.osgeo.mapguide.package",mrc:"application/marc",mrcx:"application/marcxml+xml",mxf:"application/mxf",nbp:"application/vnd.wolfram.player",ma:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mc1:"application/vnd.medcalcdata",mscml:"application/mediaservercontrol+xml",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",msh:"model/mesh",mads:"application/mads+xml",mets:"application/mets+xml",mods:"application/mods+xml",meta4:"application/metalink4+xml",mcd:"application/vnd.mcd",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",es3:"application/vnd.eszigno3+xml",mdb:"application/x-msaccess",asf:"video/x-ms-asf",exe:"application/x-msdownload",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",ims:"application/vnd.ms-ims",application:"application/x-ms-application",clp:"application/x-msclip",mdi:"image/vnd.ms-modi",eot:"application/vnd.ms-fontobject",xls:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",chm:"application/vnd.ms-htmlhelp",crd:"application/x-mscardfile",lrm:"application/vnd.ms-lrm",mvb:"application/x-msmediaview",mny:"application/x-msmoney",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",obd:"application/x-msbinder",thmx:"application/vnd.ms-officetheme",onetoc:"application/onenote",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",ppt:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",pub:"application/x-mspublisher",scd:"application/x-msschedule",xap:"application/x-silverlight-app",stl:"application/vnd.ms-pki.stl",cat:"application/vnd.ms-pki.seccat",vsd:"application/vnd.visio",vsdx:"application/vnd.visio2013",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wax:"audio/x-ms-wax",wmx:"video/x-ms-wmx",wmd:"application/x-ms-wmd",wpl:"application/vnd.ms-wpl",wmz:"application/x-ms-wmz",wmv:"video/x-ms-wmv",wvx:"video/x-ms-wvx",wmf:"application/x-msmetafile",trm:"application/x-msterminal",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wri:"application/x-mswrite",wps:"application/vnd.ms-works",xbap:"application/x-ms-xbap",xps:"application/vnd.ms-xpsdocument",mid:"audio/midi",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",rms:"application/vnd.jcp.javame.midlet-rms",tmo:"application/vnd.tmobile-livetv",prc:"application/x-mobipocket-ebook",mbk:"application/vnd.mobius.mbk",dis:"application/vnd.mobius.dis",plc:"application/vnd.mobius.plc",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",txf:"application/vnd.mobius.txf",daf:"application/vnd.mobius.daf",fly:"text/vnd.fly",mpc:"application/vnd.mophun.certificate",mpn:"application/vnd.mophun.application",mj2:"video/mj2",mpga:"audio/mpeg",mxu:"video/vnd.mpegurl",mpeg:"video/mpeg",m21:"application/mp21",mp4a:"audio/mp4",mp4:"video/mp4",m3u8:"application/vnd.apple.mpegurl",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",mxml:"application/xv+xml",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",ncx:"application/x-dtbncx+xml",nc:"application/x-netcdf",nlu:"application/vnd.neurolanguage.nlu",dna:"application/vnd.dna",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",n3:"text/n3",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",gph:"application/vnd.flographit",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",oda:"application/oda",ogx:"application/ogg",oga:"audio/ogg",ogv:"video/ogg",dd2:"application/vnd.oma.dd2+xml",oth:"application/vnd.oasis.opendocument.text-web",opf:"application/oebps-package+xml",qbo:"application/vnd.intu.qbo",oxt:"application/vnd.openofficeorg.extension",osf:"application/vnd.yamaha.openscoreformat",weba:"audio/webm",webm:"video/webm",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",ktx:"image/ktx",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",otf:"application/x-font-otf",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",dp:"application/vnd.osgi.dp",pdb:"application/vnd.palm",p:"text/x-pascal",paw:"application/vnd.pawaafile",pclxl:"application/vnd.hp-pclxl",efif:"application/vnd.picsel",pcx:"image/x-pcx",psd:"image/vnd.adobe.photoshop",prf:"application/pics-rules",pic:"image/x-pict",chat:"application/x-chat",p10:"application/pkcs10",p12:"application/x-pkcs12",p7m:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p7r:"application/x-pkcs7-certreqresp",p7b:"application/x-pkcs7-certificates",p8:"application/pkcs8",plf:"application/vnd.pocketlearn",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pcf:"application/x-font-pcf",pfr:"application/font-tdpfr",pgn:"application/x-chess-pgn",pgm:"image/x-portable-graymap",png:"image/png",ppm:"image/x-portable-pixmap",pskcxml:"application/pskc+xml",pml:"application/vnd.ctc-posml",ai:"application/postscript",pfa:"application/x-font-type1",pbd:"application/vnd.powerbuilder6",pgp:"application/pgp-signature",box:"application/vnd.previewsystems.box",ptid:"application/vnd.pvi.ptid1",pls:"application/pls+xml",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",dsc:"text/prs.lines.tag",psf:"application/x-font-linux-psf",qps:"application/vnd.publishare-delta-tree",wg:"application/vnd.pmi.widget",qxd:"application/vnd.quark.quarkxpress",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",ssf:"application/vnd.epson.ssf",qam:"application/vnd.epson.quickanime",qfx:"application/vnd.intu.qfx",mov:"video/quicktime",rar:"application/x-rar-compressed",ram:"audio/x-pn-realaudio",rmp:"audio/x-pn-realaudio-plugin",rsd:"application/rsd+xml",rm:"application/vnd.rn-realmedia",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",rnc:"application/relax-ng-compact-syntax",rdz:"application/vnd.data-vision.rdz",rdf:"application/rdf+xml",rp9:"application/vnd.cloanto.rp9",jisp:"application/vnd.jisp",rtf:"application/rtf",rtx:"text/richtext",link66:"application/vnd.route66.link66+xml",rss:"application/rss+xml",shf:"application/shf+xml",st:"application/vnd.sailingtracker.track",svg:"image/svg+xml",sus:"application/vnd.sus-calendar",sru:"application/sru+xml",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",see:"application/vnd.seemail",snf:"application/x-font-snf",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",sdp:"application/sdp",etx:"text/x-setext",movie:"video/x-sgi-movie",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",tfi:"application/thraud+xml",shar:"application/x-shar",rgb:"image/x-rgb",slt:"application/vnd.epson.salt",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",twd:"application/vnd.simtech-mindmapper",csp:"application/vnd.commonspace",saf:"application/vnd.yamaha.smaf-audio",mmf:"application/vnd.smaf",spf:"application/vnd.yamaha.smaf-phrase",teacher:"application/vnd.smart.teacher",svd:"application/vnd.svd",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",ssml:"application/ssml+xml",skp:"application/vnd.koan",sgml:"text/sgml",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",sm:"application/vnd.stepmania.stepchart",sit:"application/x-stuffit",sitx:"application/x-stuffitx",sdkm:"application/vnd.solent.sdkm+xml",xo:"application/vnd.olpc-sugar",au:"audio/basic",wqd:"application/vnd.wqd",sis:"application/vnd.symbian.install",smi:"application/smil+xml",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",sbml:"application/sbml+xml",tsv:"text/tab-separated-values",tiff:"image/tiff",tao:"application/vnd.tao.intent-module-archive",tar:"application/x-tar",tcl:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",tei:"application/tei+xml",txt:"text/plain",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",tsd:"application/timestamped-data",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",t:"text/troff",tra:"application/vnd.trueapp",ttf:"application/x-font-ttf",ttl:"text/turtle",umj:"application/vnd.umajin",uoml:"application/vnd.uoml+xml",unityweb:"application/vnd.unity",ufd:"application/vnd.ufdl",uri:"text/uri-list",utz:"application/vnd.uiq.theme",ustar:"application/x-ustar",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",vcd:"application/x-cdlink",vsf:"application/vnd.vsf",wrl:"model/vrml",vcx:"application/vnd.vcx",mts:"model/vnd.mts",vtu:"model/vnd.vtu",vis:"application/vnd.visionary",viv:"video/vnd.vivo",ccxml:"application/ccxml+xml,",vxml:"application/voicexml+xml",src:"application/x-wais-source",wbxml:"application/vnd.wap.wbxml",wbmp:"image/vnd.wap.wbmp",wav:"audio/x-wav",davmount:"application/davmount+xml",woff:"application/x-font-woff",wspolicy:"application/wspolicy+xml",webp:"image/webp",wtb:"application/vnd.webturbo",wgt:"application/widget",hlp:"application/winhlp",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",wmlsc:"application/vnd.wap.wmlscriptc",wpd:"application/vnd.wordperfect",stf:"application/vnd.wt.stf",wsdl:"application/wsdl+xml",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",der:"application/x-x509-ca-cert",fig:"application/x-xfig",xhtml:"application/xhtml+xml",xml:"application/xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xer:"application/patch-ops-error+xml",rl:"application/resource-lists+xml",rs:"application/rls-services+xml",rld:"application/resource-lists-diff+xml",xslt:"application/xslt+xml",xop:"application/xop+xml",xpi:"application/x-xpinstall",xspf:"application/xspf+xml",xul:"application/vnd.mozilla.xul+xml",xyz:"chemical/x-xyz",yaml:"text/yaml",yang:"application/yang",yin:"application/yin+xml",zir:"application/vnd.zul",zip:"application/zip",zmm:"application/vnd.handheld-entertainment+xml",zaz:"application/vnd.zzazz.deck+xml"},gM=Object.fromEntries(Object.entries(A1).map(function(e){var t=Un(e,2),n=t[0],r=t[1];return[r,n]})),L$=/^data:(.*?);base64,/;function F$(e){var t=L$.exec(e);if(t&&t[1])return t[1]}function z$(e){var t=gM[e];return t||e.split("/")[1]}function $$(e){var t=e.split(".").pop(),n=t&&A1[t];if(n)return n}function vM(e,t,n,r,o){var i="".concat((r==null?void 0:r.width)||"").concat((r==null?void 0:r.height)||"").concat(r==null?void 0:r.mimeType),s={type:t.type,opt:t.opt,options:Vt({},t.options)};return e+JSON.stringify(s)+n+i+o}function B$(e,t,n,r,o,i){return I1(i.encode(vM(e,t,n,r,o))).slice(0,4)}function yM(e){return e.slice(0,12)}function V$(e){return yM(I1(new Uint8Array(e)))}var va="?p=",xM="https://content.val.build",hb="https://app.val.build",X={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:Wz,convertRemoteSource:E$,getSchema:Bz,getValPath:aM,getSource:e$,resolvePath:a$,splitModuleFilePathAndModulePath:fM,joinModuleFilePathAndModulePath:hM,remote:{createRemoteRef:S$,getValidationBasis:vM,getValidationHash:B$,getFileHash:V$,hashToRemoteFileHash:yM,splitRemoteRef:mM},isVal:Kz,isFile:Vz,createValPathOfItem:zf,getSHA256Hash:I1,initSchema:w$,getMimeType:F$,mimeTypeToFileExt:z$,filenameToMimeType:$$,EXT_TO_MIME_TYPES:A1,MIME_TYPES_TO_EXT:gM,ModuleFilePathSep:va,notFileOp:function(t){return t.op!=="file"},isFileOp:function(t){return t.op==="file"&&typeof t.filePath=="string"},createPatchJSONPath:function(t){return"/".concat(t.split(".").map(function(n){return n&&U$(n)}).join("/"))},createPatchPath:function(t){return cg(t)},splitModulePath:cg,splitModuleFilePath:l$,splitJoinedSourcePaths:c$,parentOfSourcePath:u$,patchPathToModulePath:pM,VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session",createFilename:function(t,n,r,o){var i,s;if(!r||!t)return n;var a=o.slice(0,5),l=(i=X.getMimeType(t))!==null&&i!==void 0?i:"unknown",c=(s=X.mimeTypeToFileExt(l))!==null&&s!==void 0?s:"unknown";if(n){var u=n.split(".").slice(0,-1).join(".")||n,d=u.lastIndexOf("_"),h=u.slice(d+1,u.length);h===a&&(u=u.slice(0,d));var p=encodeURIComponent(u).replace(/%[0-9A-Fa-f]{2}/g,"").toLowerCase();return"".concat(p,"_").concat(a,".").concat(c)}return"".concat(o,".").concat(c)}};function U$(e){try{return JSON.parse(e)}catch{return e}}function Ys(e){return Array.isArray(e)}function su(e){"@babel/helpers - typeof";return su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},su(e)}function vn(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Ne(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function We(e){Ne(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||su(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Yn(e,t){Ne(2,arguments);var n=We(e),r=vn(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Bo(e,t){Ne(2,arguments);var n=We(e),r=vn(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());i.setMonth(n.getMonth()+r+1,0);var s=i.getDate();return o>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}function H$(e,t){Ne(2,arguments);var n=We(e).getTime(),r=vn(t);return new Date(n+r)}var W$={};function Aa(){return W$}function ui(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=We(e),p=h.getDay(),m=(p<d?7:0)+p-d;return h.setDate(h.getDate()-m),h.setHours(0,0,0,0),h}function _l(e){return Ne(1,arguments),ui(e,{weekStartsOn:1})}function K$(e){Ne(1,arguments);var t=We(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=_l(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var s=_l(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function G$(e){Ne(1,arguments);var t=K$(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=_l(n);return r}function $f(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function au(e){Ne(1,arguments);var t=We(e);return t.setHours(0,0,0,0),t}var q$=864e5;function Bi(e,t){Ne(2,arguments);var n=au(e),r=au(t),o=n.getTime()-$f(n),i=r.getTime()-$f(r);return Math.round((o-i)/q$)}function pb(e,t){Ne(2,arguments);var n=vn(t),r=n*7;return Yn(e,r)}function Y$(e,t){Ne(2,arguments);var n=vn(t);return Bo(e,n*12)}function J$(e){Ne(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(su(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=We(r);(n===void 0||n<o||isNaN(Number(o)))&&(n=o)}),n||new Date(NaN)}function X$(e){Ne(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(su(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=We(r);(n===void 0||n>o||isNaN(o.getDate()))&&(n=o)}),n||new Date(NaN)}function lr(e,t){Ne(2,arguments);var n=au(e),r=au(t);return n.getTime()===r.getTime()}function D1(e){return Ne(1,arguments),e instanceof Date||su(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Z$(e){if(Ne(1,arguments),!D1(e)&&typeof e!="number")return!1;var t=We(e);return!isNaN(Number(t))}function Bf(e,t){Ne(2,arguments);var n=We(e),r=We(t),o=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return o*12+i}var Q$=6048e5;function e6(e,t,n){Ne(2,arguments);var r=ui(e,n),o=ui(t,n),i=r.getTime()-$f(r),s=o.getTime()-$f(o);return Math.round((i-s)/Q$)}function L1(e){Ne(1,arguments);var t=We(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function hr(e){Ne(1,arguments);var t=We(e);return t.setDate(1),t.setHours(0,0,0,0),t}function t6(e){Ne(1,arguments);var t=We(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function F1(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=We(e),p=h.getDay(),m=(p<d?-7:0)+6-(p-d);return h.setDate(h.getDate()+m),h.setHours(23,59,59,999),h}function bM(e){return Ne(1,arguments),F1(e,{weekStartsOn:1})}function n6(e,t){Ne(2,arguments);var n=vn(t);return H$(e,-n)}var r6=864e5;function o6(e){Ne(1,arguments);var t=We(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),o=n-r;return Math.floor(o/r6)+1}function ug(e){Ne(1,arguments);var t=1,n=We(e),r=n.getUTCDay(),o=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function wM(e){Ne(1,arguments);var t=We(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=ug(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=ug(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function i6(e){Ne(1,arguments);var t=wM(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=ug(n);return r}var s6=6048e5;function a6(e){Ne(1,arguments);var t=We(e),n=ug(t).getTime()-i6(t).getTime();return Math.round(n/s6)+1}function dg(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=We(e),p=h.getUTCDay(),m=(p<d?7:0)+p-d;return h.setUTCDate(h.getUTCDate()-m),h.setUTCHours(0,0,0,0),h}function SM(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=We(e),d=u.getUTCFullYear(),h=Aa(),p=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(d+1,0,p),m.setUTCHours(0,0,0,0);var v=dg(m,t),x=new Date(0);x.setUTCFullYear(d,0,p),x.setUTCHours(0,0,0,0);var b=dg(x,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=b.getTime()?d:d-1}function l6(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),h=SM(e,t),p=new Date(0);p.setUTCFullYear(h,0,d),p.setUTCHours(0,0,0,0);var m=dg(p,t);return m}var c6=6048e5;function u6(e,t){Ne(1,arguments);var n=We(e),r=dg(n,t).getTime()-l6(n,t).getTime();return Math.round(r/c6)+1}function dt(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var ws={y:function(t,n){var r=t.getUTCFullYear(),o=r>0?r:1-r;return dt(n==="yy"?o%100:o,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):dt(r+1,2)},d:function(t,n){return dt(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return dt(t.getUTCHours()%12||12,n.length)},H:function(t,n){return dt(t.getUTCHours(),n.length)},m:function(t,n){return dt(t.getUTCMinutes(),n.length)},s:function(t,n){return dt(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,o=t.getUTCMilliseconds(),i=Math.floor(o*Math.pow(10,r-3));return dt(i,n.length)}},Zl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},d6={G:function(t,n,r){var o=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(o,{width:"abbreviated"});case"GGGGG":return r.era(o,{width:"narrow"});case"GGGG":default:return r.era(o,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var o=t.getUTCFullYear(),i=o>0?o:1-o;return r.ordinalNumber(i,{unit:"year"})}return ws.y(t,n)},Y:function(t,n,r,o){var i=SM(t,o),s=i>0?i:1-i;if(n==="YY"){var a=s%100;return dt(a,2)}return n==="Yo"?r.ordinalNumber(s,{unit:"year"}):dt(s,n.length)},R:function(t,n){var r=wM(t);return dt(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return dt(r,n.length)},Q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(o);case"QQ":return dt(o,2);case"Qo":return r.ordinalNumber(o,{unit:"quarter"});case"QQQ":return r.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(o,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(o);case"qq":return dt(o,2);case"qo":return r.ordinalNumber(o,{unit:"quarter"});case"qqq":return r.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(o,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,n,r){var o=t.getUTCMonth();switch(n){case"M":case"MM":return ws.M(t,n);case"Mo":return r.ordinalNumber(o+1,{unit:"month"});case"MMM":return r.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(o,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(o,{width:"wide",context:"formatting"})}},L:function(t,n,r){var o=t.getUTCMonth();switch(n){case"L":return String(o+1);case"LL":return dt(o+1,2);case"Lo":return r.ordinalNumber(o+1,{unit:"month"});case"LLL":return r.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(o,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(o,{width:"wide",context:"standalone"})}},w:function(t,n,r,o){var i=u6(t,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):dt(i,n.length)},I:function(t,n,r){var o=a6(t);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):dt(o,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):ws.d(t,n)},D:function(t,n,r){var o=o6(t);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):dt(o,n.length)},E:function(t,n,r){var o=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(o,{width:"short",context:"formatting"});case"EEEE":default:return r.day(o,{width:"wide",context:"formatting"})}},e:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(s);case"ee":return dt(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(s);case"cc":return dt(s,n.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var o=t.getUTCDay(),i=o===0?7:o;switch(n){case"i":return String(i);case"ii":return dt(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(o,{width:"short",context:"formatting"});case"iiii":default:return r.day(o,{width:"wide",context:"formatting"})}},a:function(t,n,r){var o=t.getUTCHours(),i=o/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var o=t.getUTCHours(),i;switch(o===12?i=Zl.noon:o===0?i=Zl.midnight:i=o/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var o=t.getUTCHours(),i;switch(o>=17?i=Zl.evening:o>=12?i=Zl.afternoon:o>=4?i=Zl.morning:i=Zl.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var o=t.getUTCHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return ws.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):ws.H(t,n)},K:function(t,n,r){var o=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):dt(o,n.length)},k:function(t,n,r){var o=t.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):dt(o,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):ws.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):ws.s(t,n)},S:function(t,n){return ws.S(t,n)},X:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();if(s===0)return"Z";switch(n){case"X":return CC(s);case"XXXX":case"XX":return Ga(s);case"XXXXX":case"XXX":default:return Ga(s,":")}},x:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"x":return CC(s);case"xxxx":case"xx":return Ga(s);case"xxxxx":case"xxx":default:return Ga(s,":")}},O:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+EC(s,":");case"OOOO":default:return"GMT"+Ga(s,":")}},z:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+EC(s,":");case"zzzz":default:return"GMT"+Ga(s,":")}},t:function(t,n,r,o){var i=o._originalDate||t,s=Math.floor(i.getTime()/1e3);return dt(s,n.length)},T:function(t,n,r,o){var i=o._originalDate||t,s=i.getTime();return dt(s,n.length)}};function EC(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(i===0)return n+String(o);var s=t;return n+String(o)+s+dt(i,2)}function CC(e,t){if(e%60===0){var n=e>0?"-":"+";return n+dt(Math.abs(e)/60,2)}return Ga(e,t)}function Ga(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e),i=dt(Math.floor(o/60),2),s=dt(o%60,2);return r+i+n+s}var _C=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},kM=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},f6=function(t,n){var r=t.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return _C(t,n);var s;switch(o){case"P":s=n.dateTime({width:"short"});break;case"PP":s=n.dateTime({width:"medium"});break;case"PPP":s=n.dateTime({width:"long"});break;case"PPPP":default:s=n.dateTime({width:"full"});break}return s.replace("{{date}}",_C(o,n)).replace("{{time}}",kM(i,n))},h6={p:kM,P:f6},p6=["D","DD"],m6=["YY","YYYY"];function g6(e){return p6.indexOf(e)!==-1}function v6(e){return m6.indexOf(e)!==-1}function PC(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var y6={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},x6=function(t,n,r){var o,i=y6[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:o+" ago":o};function mx(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var b6={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},w6={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},S6={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},k6={date:mx({formats:b6,defaultWidth:"full"}),time:mx({formats:w6,defaultWidth:"full"}),dateTime:mx({formats:S6,defaultWidth:"full"})},E6={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},C6=function(t,n,r,o){return E6[t]};function hd(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):i;o=e.formattingValues[s]||e.formattingValues[i]}else{var a=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[l]||e.values[a]}var c=e.argumentCallback?e.argumentCallback(t):t;return o[c]}}var _6={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},P6={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},N6={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},T6={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},O6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},M6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},j6=function(t,n){var r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},R6={ordinalNumber:j6,era:hd({values:_6,defaultWidth:"wide"}),quarter:hd({values:P6,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:hd({values:N6,defaultWidth:"wide"}),day:hd({values:T6,defaultWidth:"wide"}),dayPeriod:hd({values:O6,defaultWidth:"wide",formattingValues:M6,defaultFormattingWidth:"wide"})};function pd(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;var s=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?A6(a,function(d){return d.test(s)}):I6(a,function(d){return d.test(s)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(s.length);return{value:c,rest:u}}}function I6(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function A6(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function D6(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;var a=t.slice(o.length);return{value:s,rest:a}}}var L6=/^(\d+)(th|st|nd|rd)?/i,F6=/\d+/i,z6={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$6={any:[/^b/i,/^(a|c)/i]},B6={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},V6={any:[/1/i,/2/i,/3/i,/4/i]},U6={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},H6={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},W6={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},K6={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},G6={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},q6={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Y6={ordinalNumber:D6({matchPattern:L6,parsePattern:F6,valueCallback:function(t){return parseInt(t,10)}}),era:pd({matchPatterns:z6,defaultMatchWidth:"wide",parsePatterns:$6,defaultParseWidth:"any"}),quarter:pd({matchPatterns:B6,defaultMatchWidth:"wide",parsePatterns:V6,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:pd({matchPatterns:U6,defaultMatchWidth:"wide",parsePatterns:H6,defaultParseWidth:"any"}),day:pd({matchPatterns:W6,defaultMatchWidth:"wide",parsePatterns:K6,defaultParseWidth:"any"}),dayPeriod:pd({matchPatterns:G6,defaultMatchWidth:"any",parsePatterns:q6,defaultParseWidth:"any"})},EM={code:"en-US",formatDistance:x6,formatLong:k6,formatRelative:C6,localize:R6,match:Y6,options:{weekStartsOn:0,firstWeekContainsDate:1}},J6=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,X6=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Z6=/^'([^]*?)'?$/,Q6=/''/g,eB=/[a-zA-Z]/;function us(e,t,n){var r,o,i,s,a,l,c,u,d,h,p,m,v,x,b,w,S,C;Ne(2,arguments);var _=String(t),P=Aa(),O=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:P.locale)!==null&&r!==void 0?r:EM,M=vn((i=(s=(a=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:P.firstWeekContainsDate)!==null&&s!==void 0?s:(d=P.locale)===null||d===void 0||(h=d.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(M>=1&&M<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var I=vn((p=(m=(v=(x=n==null?void 0:n.weekStartsOn)!==null&&x!==void 0?x:n==null||(b=n.locale)===null||b===void 0||(w=b.options)===null||w===void 0?void 0:w.weekStartsOn)!==null&&v!==void 0?v:P.weekStartsOn)!==null&&m!==void 0?m:(S=P.locale)===null||S===void 0||(C=S.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&p!==void 0?p:0);if(!(I>=0&&I<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!O.localize)throw new RangeError("locale must contain localize property");if(!O.formatLong)throw new RangeError("locale must contain formatLong property");var L=We(e);if(!Z$(L))throw new RangeError("Invalid time value");var U=$f(L),$=n6(L,U),K={firstWeekContainsDate:M,weekStartsOn:I,locale:O,_originalDate:L},W=_.match(X6).map(function(B){var A=B[0];if(A==="p"||A==="P"){var R=h6[A];return R(B,O.formatLong)}return B}).join("").match(J6).map(function(B){if(B==="''")return"'";var A=B[0];if(A==="'")return tB(B);var R=d6[A];if(R)return!(n!=null&&n.useAdditionalWeekYearTokens)&&v6(B)&&PC(B,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&g6(B)&&PC(B,t,String(e)),R($,B,O.localize,K);if(A.match(eB))throw new RangeError("Format string contains an unescaped latin alphabet character `"+A+"`");return B}).join("");return W}function tB(e){var t=e.match(Z6);return t?t[1].replace(Q6,"'"):e}function nB(e){Ne(1,arguments);var t=We(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}var rB=6048e5;function oB(e){Ne(1,arguments);var t=We(e),n=_l(t).getTime()-G$(t).getTime();return Math.round(n/rB)+1}function iB(e){Ne(1,arguments);var t=We(e),n=t.getTime();return n}function sB(e){return Ne(1,arguments),Math.floor(iB(e)/1e3)}function aB(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=We(e),d=u.getFullYear(),h=Aa(),p=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setFullYear(d+1,0,p),m.setHours(0,0,0,0);var v=ui(m,t),x=new Date(0);x.setFullYear(d,0,p),x.setHours(0,0,0,0);var b=ui(x,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=b.getTime()?d:d-1}function lB(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),h=aB(e,t),p=new Date(0);p.setFullYear(h,0,d),p.setHours(0,0,0,0);var m=ui(p,t);return m}var cB=6048e5;function uB(e,t){Ne(1,arguments);var n=We(e),r=ui(n,t).getTime()-lB(n,t).getTime();return Math.round(r/cB)+1}function dB(e){Ne(1,arguments);var t=We(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function fB(e,t){return Ne(1,arguments),e6(dB(e),hr(e),t)+1}function mb(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getTime()>r.getTime()}function CM(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getTime()<r.getTime()}function z1(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function hB(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getFullYear()===r.getFullYear()}function gx(e,t){Ne(2,arguments);var n=vn(t);return Yn(e,-n)}function vx(e,t){Ne(2,arguments);var n=We(e),r=vn(t),o=n.getFullYear(),i=n.getDate(),s=new Date(0);s.setFullYear(o,r,15),s.setHours(0,0,0,0);var a=nB(s);return n.setMonth(r,Math.min(i,a)),n}function NC(e,t){Ne(2,arguments);var n=We(e),r=vn(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var je=function(){return je=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},je.apply(this,arguments)};function pB(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function _M(e,t,n){for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function zh(e){return e.mode==="multiple"}function $h(e){return e.mode==="range"}function Rv(e){return e.mode==="single"}var mB={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function gB(e,t){return us(e,"LLLL y",t)}function vB(e,t){return us(e,"d",t)}function yB(e,t){return us(e,"LLLL",t)}function xB(e){return"".concat(e)}function bB(e,t){return us(e,"cccccc",t)}function wB(e,t){return us(e,"yyyy",t)}var SB=Object.freeze({__proto__:null,formatCaption:gB,formatDay:vB,formatMonthCaption:yB,formatWeekNumber:xB,formatWeekdayName:bB,formatYearCaption:wB}),kB=function(e,t,n){return us(e,"do MMMM (EEEE)",n)},EB=function(){return"Month: "},CB=function(){return"Go to next month"},_B=function(){return"Go to previous month"},PB=function(e,t){return us(e,"cccc",t)},NB=function(e){return"Week n. ".concat(e)},TB=function(){return"Year: "},OB=Object.freeze({__proto__:null,labelDay:kB,labelMonthDropdown:EB,labelNext:CB,labelPrevious:_B,labelWeekNumber:NB,labelWeekday:PB,labelYearDropdown:TB});function MB(){var e="buttons",t=mB,n=EM,r={},o={},i=1,s={},a=new Date;return{captionLayout:e,classNames:t,formatters:SB,labels:OB,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:i,styles:s,today:a,mode:"default"}}function jB(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,s=e.toDate;return r?i=hr(r):t&&(i=new Date(t,0,1)),o?s=L1(o):n&&(s=new Date(n,11,31)),{fromDate:i?au(i):void 0,toDate:s?au(s):void 0}}var PM=g.createContext(void 0);function NM(e){var t,n=e.initialProps,r=MB(),o=jB(n),i=o.fromDate,s=o.toDate,a=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;a!=="buttons"&&(!i||!s)&&(a="buttons");var l;(Rv(n)||zh(n)||$h(n))&&(l=n.onSelect);var c=je(je(je({},r),n),{captionLayout:a,classNames:je(je({},r.classNames),n.classNames),components:je({},n.components),formatters:je(je({},r.formatters),n.formatters),fromDate:i,labels:je(je({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:je(je({},r.modifiers),n.modifiers),modifiersClassNames:je(je({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:je(je({},r.styles),n.styles),toDate:s});return f.jsx(PM.Provider,{value:c,children:e.children})}function bt(){var e=g.useContext(PM);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function TM(e){var t=bt(),n=t.locale,r=t.classNames,o=t.styles,i=t.formatters.formatCaption;return f.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function RB(e){return f.jsx("svg",je({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:f.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function OM(e){var t,n,r=e.onChange,o=e.value,i=e.children,s=e.caption,a=e.className,l=e.style,c=bt(),u=(n=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:RB;return f.jsxs("div",{className:a,style:l,children:[f.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),f.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:o,onChange:r,children:i}),f.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,f.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function IB(e){var t,n=bt(),r=n.fromDate,o=n.toDate,i=n.styles,s=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return f.jsx(f.Fragment,{});if(!o)return f.jsx(f.Fragment,{});var d=[];if(hB(r,o))for(var h=hr(r),p=r.getMonth();p<=o.getMonth();p++)d.push(vx(h,p));else for(var h=hr(new Date),p=0;p<=11;p++)d.push(vx(h,p));var m=function(x){var b=Number(x.target.value),w=vx(hr(e.displayMonth),b);e.onChange(w)},v=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:OM;return f.jsx(v,{name:"months","aria-label":u(),className:l.dropdown_month,style:i.dropdown_month,onChange:m,value:e.displayMonth.getMonth(),caption:a(e.displayMonth,{locale:s}),children:d.map(function(x){return f.jsx("option",{value:x.getMonth(),children:a(x,{locale:s})},x.getMonth())})})}function AB(e){var t,n=e.displayMonth,r=bt(),o=r.fromDate,i=r.toDate,s=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,h=[];if(!o)return f.jsx(f.Fragment,{});if(!i)return f.jsx(f.Fragment,{});for(var p=o.getFullYear(),m=i.getFullYear(),v=p;v<=m;v++)h.push(NC(t6(new Date),v));var x=function(w){var S=NC(hr(n),Number(w.target.value));e.onChange(S)},b=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:OM;return f.jsx(b,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:x,value:n.getFullYear(),caption:u(n,{locale:s}),children:h.map(function(w){return f.jsx("option",{value:w.getFullYear(),children:u(w,{locale:s})},w.getFullYear())})})}function DB(e,t){var n=g.useState(e),r=n[0],o=n[1],i=t===void 0?r:t;return[i,o]}function LB(e){var t=e.month,n=e.defaultMonth,r=e.today,o=t||n||r||new Date,i=e.toDate,s=e.fromDate,a=e.numberOfMonths,l=a===void 0?1:a;if(i&&Bf(i,o)<0){var c=-1*(l-1);o=Bo(i,c)}return s&&Bf(o,s)<0&&(o=s),hr(o)}function FB(){var e=bt(),t=LB(e),n=DB(t,e.month),r=n[0],o=n[1],i=function(s){var a;if(!e.disableNavigation){var l=hr(s);o(l),(a=e.onMonthChange)===null||a===void 0||a.call(e,l)}};return[r,i]}function zB(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=hr(e),i=hr(Bo(o,r)),s=Bf(i,o),a=[],l=0;l<s;l++){var c=Bo(o,l);a.push(c)}return n&&(a=a.reverse()),a}function $B(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=hr(e);if(!n)return Bo(a,s);var l=Bf(n,e);if(!(l<i))return Bo(a,s)}}function BB(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=hr(e);if(!n)return Bo(a,-s);var l=Bf(a,n);if(!(l<=0))return Bo(a,-s)}}var MM=g.createContext(void 0);function VB(e){var t=bt(),n=FB(),r=n[0],o=n[1],i=zB(r,t),s=$B(r,t),a=BB(r,t),l=function(d){return i.some(function(h){return z1(d,h)})},c=function(d,h){l(d)||(h&&CM(d,h)?o(Bo(d,1+t.numberOfMonths*-1)):o(d))},u={currentMonth:r,displayMonths:i,goToMonth:o,goToDate:c,previousMonth:a,nextMonth:s,isDateDisplayed:l};return f.jsx(MM.Provider,{value:u,children:e.children})}function Bh(){var e=g.useContext(MM);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function TC(e){var t,n=bt(),r=n.classNames,o=n.styles,i=n.components,s=Bh().goToMonth,a=function(u){s(Bo(u,e.displayIndex?-e.displayIndex:0))},l=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:TM,c=f.jsx(l,{id:e.id,displayMonth:e.displayMonth});return f.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[f.jsx("div",{className:r.vhidden,children:c}),f.jsx(IB,{onChange:a,displayMonth:e.displayMonth}),f.jsx(AB,{onChange:a,displayMonth:e.displayMonth})]})}function UB(e){return f.jsx("svg",je({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:f.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function HB(e){return f.jsx("svg",je({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:f.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var fg=g.forwardRef(function(e,t){var n=bt(),r=n.classNames,o=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var s=i.join(" "),a=je(je({},o.button_reset),o.button);return e.style&&Object.assign(a,e.style),f.jsx("button",je({},e,{ref:t,type:"button",className:s,style:a}))});function WB(e){var t,n,r=bt(),o=r.dir,i=r.locale,s=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!e.nextMonth&&!e.previousMonth)return f.jsx(f.Fragment,{});var h=c(e.previousMonth,{locale:i}),p=[s.nav_button,s.nav_button_previous].join(" "),m=u(e.nextMonth,{locale:i}),v=[s.nav_button,s.nav_button_next].join(" "),x=(t=d==null?void 0:d.IconRight)!==null&&t!==void 0?t:HB,b=(n=d==null?void 0:d.IconLeft)!==null&&n!==void 0?n:UB;return f.jsxs("div",{className:s.nav,style:a.nav,children:[!e.hidePrevious&&f.jsx(fg,{name:"previous-month","aria-label":h,className:p,style:a.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?f.jsx(x,{className:s.nav_icon,style:a.nav_icon}):f.jsx(b,{className:s.nav_icon,style:a.nav_icon})}),!e.hideNext&&f.jsx(fg,{name:"next-month","aria-label":m,className:v,style:a.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?f.jsx(b,{className:s.nav_icon,style:a.nav_icon}):f.jsx(x,{className:s.nav_icon,style:a.nav_icon})})]})}function OC(e){var t=bt().numberOfMonths,n=Bh(),r=n.previousMonth,o=n.nextMonth,i=n.goToMonth,s=n.displayMonths,a=s.findIndex(function(m){return z1(e.displayMonth,m)}),l=a===0,c=a===s.length-1,u=t>1&&(l||!c),d=t>1&&(c||!l),h=function(){r&&i(r)},p=function(){o&&i(o)};return f.jsx(WB,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:d,nextMonth:o,previousMonth:r,onPreviousClick:h,onNextClick:p})}function KB(e){var t,n=bt(),r=n.classNames,o=n.disableNavigation,i=n.styles,s=n.captionLayout,a=n.components,l=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:TM,c;return o?c=f.jsx(l,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?c=f.jsx(TC,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?c=f.jsxs(f.Fragment,{children:[f.jsx(TC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),f.jsx(OC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):c=f.jsxs(f.Fragment,{children:[f.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),f.jsx(OC,{displayMonth:e.displayMonth,id:e.id})]}),f.jsx("div",{className:r.caption,style:i.caption,children:c})}function GB(e){var t=bt(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?f.jsx("tfoot",{className:o,style:r.tfoot,children:f.jsx("tr",{children:f.jsx("td",{colSpan:8,children:n})})}):f.jsx(f.Fragment,{})}function qB(e,t,n){for(var r=n?_l(new Date):ui(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var s=Yn(r,i);o.push(s)}return o}function YB(){var e=bt(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,i=e.weekStartsOn,s=e.ISOWeek,a=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,c=qB(o,i,s);return f.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&f.jsx("td",{style:n.head_cell,className:t.head_cell}),c.map(function(u,d){return f.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":l(u,{locale:o}),children:a(u,{locale:o})},d)})]})}function JB(){var e,t=bt(),n=t.classNames,r=t.styles,o=t.components,i=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:YB;return f.jsx("thead",{style:r.head,className:n.head,children:f.jsx(i,{})})}function XB(e){var t=bt(),n=t.locale,r=t.formatters.formatDay;return f.jsx(f.Fragment,{children:r(e.date,{locale:n})})}var $1=g.createContext(void 0);function ZB(e){if(!zh(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return f.jsx($1.Provider,{value:t,children:e.children})}return f.jsx(QB,{initialProps:e.initialProps,children:e.children})}function QB(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,i=t.max,s=function(c,u,d){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,c,u,d);var m=!!(u.selected&&o&&(r==null?void 0:r.length)===o);if(!m){var v=!!(!u.selected&&i&&(r==null?void 0:r.length)===i);if(!v){var x=r?_M([],r):[];if(u.selected){var b=x.findIndex(function(w){return lr(c,w)});x.splice(b,1)}else x.push(c);(p=t.onSelect)===null||p===void 0||p.call(t,x,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=i&&r.length>i-1,d=r.some(function(h){return lr(h,c)});return!!(u&&!d)});var l={selected:r,onDayClick:s,modifiers:a};return f.jsx($1.Provider,{value:l,children:n})}function B1(){var e=g.useContext($1);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function e8(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?lr(o,e)&&lr(r,e)?void 0:lr(o,e)?{from:o,to:void 0}:lr(r,e)?void 0:mb(r,e)?{from:e,to:o}:{from:r,to:e}:o?mb(e,o)?{from:o,to:e}:{from:e,to:o}:r?CM(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var V1=g.createContext(void 0);function t8(e){if(!$h(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return f.jsx(V1.Provider,{value:t,children:e.children})}return f.jsx(n8,{initialProps:e.initialProps,children:e.children})}function n8(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},i=o.from,s=o.to,a=t.min,l=t.max,c=function(p,m,v){var x,b;(x=t.onDayClick)===null||x===void 0||x.call(t,p,m,v);var w=e8(p,r);(b=t.onSelect)===null||b===void 0||b.call(t,w,p,m,v)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],s?(u.range_end=[s],lr(i,s)||(u.range_middle=[{after:i,before:s}])):u.range_end=[i]):s&&(u.range_start=[s],u.range_end=[s]),a&&(i&&!s&&u.disabled.push({after:gx(i,a-1),before:Yn(i,a-1)}),i&&s&&u.disabled.push({after:i,before:Yn(i,a-1)}),!i&&s&&u.disabled.push({after:gx(s,a-1),before:Yn(s,a-1)})),l){if(i&&!s&&(u.disabled.push({before:Yn(i,-l+1)}),u.disabled.push({after:Yn(i,l-1)})),i&&s){var d=Bi(s,i)+1,h=l-d;u.disabled.push({before:gx(i,h)}),u.disabled.push({after:Yn(s,h)})}!i&&s&&(u.disabled.push({before:Yn(s,-l+1)}),u.disabled.push({after:Yn(s,l-1)}))}return f.jsx(V1.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function U1(){var e=g.useContext(V1);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function pm(e){return Array.isArray(e)?_M([],e):e!==void 0?[e]:[]}function r8(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=pm(o)}),t}var Vo;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Vo||(Vo={}));var o8=Vo.Selected,Ei=Vo.Disabled,i8=Vo.Hidden,s8=Vo.Today,yx=Vo.RangeEnd,xx=Vo.RangeMiddle,bx=Vo.RangeStart,a8=Vo.Outside;function l8(e,t,n){var r,o=(r={},r[o8]=pm(e.selected),r[Ei]=pm(e.disabled),r[i8]=pm(e.hidden),r[s8]=[e.today],r[yx]=[],r[xx]=[],r[bx]=[],r[a8]=[],r);return e.fromDate&&o[Ei].push({before:e.fromDate}),e.toDate&&o[Ei].push({after:e.toDate}),zh(e)?o[Ei]=o[Ei].concat(t.modifiers[Ei]):$h(e)&&(o[Ei]=o[Ei].concat(n.modifiers[Ei]),o[bx]=n.modifiers[bx],o[xx]=n.modifiers[xx],o[yx]=n.modifiers[yx]),o}var jM=g.createContext(void 0);function c8(e){var t=bt(),n=B1(),r=U1(),o=l8(t,n,r),i=r8(t.modifiers),s=je(je({},o),i);return f.jsx(jM.Provider,{value:s,children:e.children})}function RM(){var e=g.useContext(jM);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function u8(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function d8(e){return!!(e&&typeof e=="object"&&"from"in e)}function f8(e){return!!(e&&typeof e=="object"&&"after"in e)}function h8(e){return!!(e&&typeof e=="object"&&"before"in e)}function p8(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function m8(e,t){var n,r=t.from,o=t.to;if(r&&o){var i=Bi(o,r)<0;i&&(n=[o,r],r=n[0],o=n[1]);var s=Bi(e,r)>=0&&Bi(o,e)>=0;return s}return o?lr(o,e):r?lr(r,e):!1}function g8(e){return D1(e)}function v8(e){return Array.isArray(e)&&e.every(D1)}function y8(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(g8(n))return lr(e,n);if(v8(n))return n.includes(e);if(d8(n))return m8(e,n);if(p8(n))return n.dayOfWeek.includes(e.getDay());if(u8(n)){var r=Bi(n.before,e),o=Bi(n.after,e),i=r>0,s=o<0,a=mb(n.before,n.after);return a?s&&i:i||s}return f8(n)?Bi(e,n.after)>0:h8(n)?Bi(n.before,e)>0:typeof n=="function"?n(e):!1})}function H1(e,t,n){var r=Object.keys(t).reduce(function(i,s){var a=t[s];return y8(e,a)&&i.push(s),i},[]),o={};return r.forEach(function(i){return o[i]=!0}),n&&!z1(e,n)&&(o.outside=!0),o}function x8(e,t){for(var n=hr(e[0]),r=L1(e[e.length-1]),o,i,s=n;s<=r;){var a=H1(s,t),l=!a.disabled&&!a.hidden;if(!l){s=Yn(s,1);continue}if(a.selected)return s;a.today&&!i&&(i=s),o||(o=s),s=Yn(s,1)}return i||o}var b8=365;function IM(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,s=t.retry,a=s===void 0?{count:0,lastFocused:e}:s,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,h={day:Yn,week:pb,month:Bo,year:Y$,startOfWeek:function(x){return o.ISOWeek?_l(x):ui(x,{locale:d,weekStartsOn:l})},endOfWeek:function(x){return o.ISOWeek?bM(x):F1(x,{locale:d,weekStartsOn:l})}},p=h[n](e,r==="after"?1:-1);r==="before"&&c?p=J$([c,p]):r==="after"&&u&&(p=X$([u,p]));var m=!0;if(i){var v=H1(p,i);m=!v.disabled&&!v.hidden}return m?p:a.count>b8?a.lastFocused:IM(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:je(je({},a),{count:a.count+1})})}var AM=g.createContext(void 0);function w8(e){var t=Bh(),n=RM(),r=g.useState(),o=r[0],i=r[1],s=g.useState(),a=s[0],l=s[1],c=x8(t.displayMonths,n),u=o??(a&&t.isDateDisplayed(a))?a:c,d=function(){l(o),i(void 0)},h=function(x){i(x)},p=bt(),m=function(x,b){if(o){var w=IM(o,{moveBy:x,direction:b,context:p,modifiers:n});lr(o,w)||(t.goToDate(w,o),h(w))}},v={focusedDay:o,focusTarget:u,blur:d,focus:h,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return f.jsx(AM.Provider,{value:v,children:e.children})}function W1(){var e=g.useContext(AM);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function S8(e,t){var n=RM(),r=H1(e,n,t);return r}var K1=g.createContext(void 0);function k8(e){if(!Rv(e.initialProps)){var t={selected:void 0};return f.jsx(K1.Provider,{value:t,children:e.children})}return f.jsx(E8,{initialProps:e.initialProps,children:e.children})}function E8(e){var t=e.initialProps,n=e.children,r=function(i,s,a){var l,c,u;if((l=t.onDayClick)===null||l===void 0||l.call(t,i,s,a),s.selected&&!t.required){(c=t.onSelect)===null||c===void 0||c.call(t,void 0,i,s,a);return}(u=t.onSelect)===null||u===void 0||u.call(t,i,i,s,a)},o={selected:t.selected,onDayClick:r};return f.jsx(K1.Provider,{value:o,children:n})}function DM(){var e=g.useContext(K1);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function C8(e,t){var n=bt(),r=DM(),o=B1(),i=U1(),s=W1(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,d=s.blur,h=s.focus,p=s.focusMonthBefore,m=s.focusMonthAfter,v=s.focusYearBefore,x=s.focusYearAfter,b=s.focusStartOfWeek,w=s.focusEndOfWeek,S=function(R){var N,D,z,V;Rv(n)?(N=r.onDayClick)===null||N===void 0||N.call(r,e,t,R):zh(n)?(D=o.onDayClick)===null||D===void 0||D.call(o,e,t,R):$h(n)?(z=i.onDayClick)===null||z===void 0||z.call(i,e,t,R):(V=n.onDayClick)===null||V===void 0||V.call(n,e,t,R)},C=function(R){var N;h(e),(N=n.onDayFocus)===null||N===void 0||N.call(n,e,t,R)},_=function(R){var N;d(),(N=n.onDayBlur)===null||N===void 0||N.call(n,e,t,R)},P=function(R){var N;(N=n.onDayMouseEnter)===null||N===void 0||N.call(n,e,t,R)},O=function(R){var N;(N=n.onDayMouseLeave)===null||N===void 0||N.call(n,e,t,R)},M=function(R){var N;(N=n.onDayPointerEnter)===null||N===void 0||N.call(n,e,t,R)},I=function(R){var N;(N=n.onDayPointerLeave)===null||N===void 0||N.call(n,e,t,R)},L=function(R){var N;(N=n.onDayTouchCancel)===null||N===void 0||N.call(n,e,t,R)},U=function(R){var N;(N=n.onDayTouchEnd)===null||N===void 0||N.call(n,e,t,R)},$=function(R){var N;(N=n.onDayTouchMove)===null||N===void 0||N.call(n,e,t,R)},K=function(R){var N;(N=n.onDayTouchStart)===null||N===void 0||N.call(n,e,t,R)},W=function(R){var N;(N=n.onDayKeyUp)===null||N===void 0||N.call(n,e,t,R)},B=function(R){var N;switch(R.key){case"ArrowLeft":R.preventDefault(),R.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":R.preventDefault(),R.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":R.preventDefault(),R.stopPropagation(),c();break;case"ArrowUp":R.preventDefault(),R.stopPropagation(),u();break;case"PageUp":R.preventDefault(),R.stopPropagation(),R.shiftKey?v():p();break;case"PageDown":R.preventDefault(),R.stopPropagation(),R.shiftKey?x():m();break;case"Home":R.preventDefault(),R.stopPropagation(),b();break;case"End":R.preventDefault(),R.stopPropagation(),w();break}(N=n.onDayKeyDown)===null||N===void 0||N.call(n,e,t,R)},A={onClick:S,onFocus:C,onBlur:_,onKeyDown:B,onKeyUp:W,onMouseEnter:P,onMouseLeave:O,onPointerEnter:M,onPointerLeave:I,onTouchCancel:L,onTouchEnd:U,onTouchMove:$,onTouchStart:K};return A}function _8(){var e=bt(),t=DM(),n=B1(),r=U1(),o=Rv(e)?t.selected:zh(e)?n.selected:$h(e)?r.selected:void 0;return o}function P8(e){return Object.values(Vo).includes(e)}function N8(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var o=e.modifiersClassNames[r];if(o)n.push(o);else if(P8(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function T8(e,t){var n=je({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=je(je({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function O8(e,t,n){var r,o,i,s=bt(),a=W1(),l=S8(e,t),c=C8(e,l),u=_8(),d=!!(s.onDayClick||s.mode!=="default");g.useEffect(function(){var P;l.outside||a.focusedDay&&d&&lr(a.focusedDay,e)&&((P=n.current)===null||P===void 0||P.focus())},[a.focusedDay,e,n,d,l.outside]);var h=N8(s,l).join(" "),p=T8(s,l),m=!!(l.outside&&!s.showOutsideDays||l.hidden),v=(i=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&i!==void 0?i:XB,x=f.jsx(v,{date:e,displayMonth:t,activeModifiers:l}),b={style:p,className:h,children:x,role:"gridcell"},w=a.focusTarget&&lr(a.focusTarget,e)&&!l.outside,S=a.focusedDay&&lr(a.focusedDay,e),C=je(je(je({},b),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=S||w?0:-1,r)),c),_={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:C,divProps:b};return _}function M8(e){var t=g.useRef(null),n=O8(e.date,e.displayMonth,t);return n.isHidden?f.jsx("div",{role:"gridcell"}):n.isButton?f.jsx(fg,je({name:"day",ref:t},n.buttonProps)):f.jsx("div",je({},n.divProps))}function j8(e){var t=e.number,n=e.dates,r=bt(),o=r.onWeekNumberClick,i=r.styles,s=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(t),{locale:a});if(!o)return f.jsx("span",{className:s.weeknumber,style:i.weeknumber,children:u});var d=l(Number(t),{locale:a}),h=function(p){o(t,n,p)};return f.jsx(fg,{name:"week-number","aria-label":d,className:s.weeknumber,style:i.weeknumber,onClick:h,children:u})}function R8(e){var t,n,r=bt(),o=r.styles,i=r.classNames,s=r.showWeekNumber,a=r.components,l=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:M8,c=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:j8,u;return s&&(u=f.jsx("td",{className:i.cell,style:o.cell,children:f.jsx(c,{number:e.weekNumber,dates:e.dates})})),f.jsxs("tr",{className:i.row,style:o.row,children:[u,e.dates.map(function(d){return f.jsx("td",{className:i.cell,style:o.cell,role:"presentation",children:f.jsx(l,{displayMonth:e.displayMonth,date:d})},sB(d))})]})}function MC(e,t,n){for(var r=n!=null&&n.ISOWeek?bM(t):F1(t,n),o=n!=null&&n.ISOWeek?_l(e):ui(e,n),i=Bi(r,o),s=[],a=0;a<=i;a++)s.push(Yn(o,a));var l=s.reduce(function(c,u){var d=n!=null&&n.ISOWeek?oB(u):uB(u,n),h=c.find(function(p){return p.weekNumber===d});return h?(h.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function I8(e,t){var n=MC(hr(e),L1(e),t);if(t!=null&&t.useFixedWeeks){var r=fB(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],s=pb(i,6-r),a=MC(pb(i,1),s,t);n.push.apply(n,a)}}return n}function A8(e){var t,n,r,o=bt(),i=o.locale,s=o.classNames,a=o.styles,l=o.hideHead,c=o.fixedWeeks,u=o.components,d=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,m=I8(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:p,locale:i,weekStartsOn:d,firstWeekContainsDate:h}),v=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:JB,x=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:R8,b=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:GB;return f.jsxs("table",{id:e.id,className:s.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&f.jsx(v,{}),f.jsx("tbody",{className:s.tbody,style:a.tbody,children:m.map(function(w){return f.jsx(x,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),f.jsx(b,{displayMonth:e.displayMonth})]})}function D8(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var L8=D8()?g.useLayoutEffect:g.useEffect,wx=!1,F8=0;function jC(){return"react-day-picker-".concat(++F8)}function z8(e){var t,n=e??(wx?jC():null),r=g.useState(n),o=r[0],i=r[1];return L8(function(){o===null&&i(jC())},[]),g.useEffect(function(){wx===!1&&(wx=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function $8(e){var t,n,r=bt(),o=r.dir,i=r.classNames,s=r.styles,a=r.components,l=Bh().displayMonths,c=z8(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,d=[i.month],h=s.month,p=e.displayIndex===0,m=e.displayIndex===l.length-1,v=!p&&!m;o==="rtl"&&(t=[p,m],m=t[0],p=t[1]),p&&(d.push(i.caption_start),h=je(je({},h),s.caption_start)),m&&(d.push(i.caption_end),h=je(je({},h),s.caption_end)),v&&(d.push(i.caption_between),h=je(je({},h),s.caption_between));var x=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:KB;return f.jsxs("div",{className:d.join(" "),style:h,children:[f.jsx(x,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),f.jsx(A8,{id:u,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function B8(e){var t=bt(),n=t.classNames,r=t.styles;return f.jsx("div",{className:n.months,style:r.months,children:e.children})}function V8(e){var t,n,r=e.initialProps,o=bt(),i=W1(),s=Bh(),a=g.useState(!1),l=a[0],c=a[1];g.useEffect(function(){o.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),c(!0)))},[o.initialFocus,l,i.focus,i.focusTarget,i]);var u=[o.classNames.root,o.className];o.numberOfMonths>1&&u.push(o.classNames.multiple_months),o.showWeekNumber&&u.push(o.classNames.with_weeknumber);var d=je(je({},o.styles.root),o.style),h=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,v){var x;return je(je({},m),(x={},x[v]=r[v],x))},{}),p=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:B8;return f.jsx("div",je({className:u.join(" "),style:d,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:f.jsx(p,{children:s.displayMonths.map(function(m,v){return f.jsx($8,{displayIndex:v,displayMonth:m},v)})})}))}function U8(e){var t=e.children,n=pB(e,["children"]);return f.jsx(NM,{initialProps:n,children:f.jsx(VB,{children:f.jsx(k8,{initialProps:n,children:f.jsx(ZB,{initialProps:n,children:f.jsx(t8,{initialProps:n,children:f.jsx(c8,{children:f.jsx(w8,{children:t})})})})})})})}function H8(e){return f.jsx(U8,je({},e,{children:f.jsx(V8,{initialProps:e})}))}var Iv={},Av={};Av.byteLength=G8;Av.toByteArray=Y8;Av.fromByteArray=Z8;var oi=[],Jr=[],W8=typeof Uint8Array<"u"?Uint8Array:Array,Sx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ql=0,K8=Sx.length;Ql<K8;++Ql)oi[Ql]=Sx[Ql],Jr[Sx.charCodeAt(Ql)]=Ql;Jr[45]=62;Jr[95]=63;function LM(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function G8(e){var t=LM(e),n=t[0],r=t[1];return(n+r)*3/4-r}function q8(e,t,n){return(t+n)*3/4-n}function Y8(e){var t,n=LM(e),r=n[0],o=n[1],i=new W8(q8(e,r,o)),s=0,a=o>0?r-4:r,l;for(l=0;l<a;l+=4)t=Jr[e.charCodeAt(l)]<<18|Jr[e.charCodeAt(l+1)]<<12|Jr[e.charCodeAt(l+2)]<<6|Jr[e.charCodeAt(l+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return o===2&&(t=Jr[e.charCodeAt(l)]<<2|Jr[e.charCodeAt(l+1)]>>4,i[s++]=t&255),o===1&&(t=Jr[e.charCodeAt(l)]<<10|Jr[e.charCodeAt(l+1)]<<4|Jr[e.charCodeAt(l+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function J8(e){return oi[e>>18&63]+oi[e>>12&63]+oi[e>>6&63]+oi[e&63]}function X8(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),o.push(J8(r));return o.join("")}function Z8(e){for(var t,n=e.length,r=n%3,o=[],i=16383,s=0,a=n-r;s<a;s+=i)o.push(X8(e,s,s+i>a?a:s+i));return r===1?(t=e[n-1],o.push(oi[t>>2]+oi[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(oi[t>>10]+oi[t>>4&63]+oi[t<<2&63]+"=")),o.join("")}var G1={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */G1.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+e[t+d],d+=h,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=s*256+e[t+d],d+=h,u-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(p?-1:1)*s*Math.pow(2,i-r)};G1.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,u=(1<<c)-1,d=u>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,m=r?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(s++,l/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*l-1)*Math.pow(2,o),s=s+d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=a&255,p+=m,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+p]=s&255,p+=m,s/=256,c-=8);e[n+p-m]|=v*128};/*!
|
|
43
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mc(e){return Rz(e)||Iz(e)||O1(e)||Az()}function ae(e){"@babel/helpers - typeof";return ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ae(e)}function Dz(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rM(e){var t=Dz(e,"string");return typeof t=="symbol"?t:t+""}function H(e,t,n){return(t=rM(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Vt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SC(Object(n),!0).forEach(function(r){H(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lz(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rM(r.key),r)}}function Tn(e,t,n){return t&&Lz(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ag(e){return ag=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ag(e)}function oM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oM=function(){return!!e})()}function Fz(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zz(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fz(e)}function Hr(e,t,n){return t=ag(t),zz(e,oM()?Reflect.construct(t,[],ag(e).constructor):t.apply(e,n))}function db(e,t){return db=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},db(e,t)}function Wr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&db(e,t)}var Kr=function(){function e(){Nn(this,e)}return Tn(e,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):H({},r,[{message:o,value:i}])}}])}(),iM=Symbol("GetSchema"),sM=Symbol("Path"),$z=Symbol("GetSource");function Bz(e){return e[iM]}var Ie="_type",vt="_ref",fb="_tag";function Vz(e){return ae(e)==="object"&&e!==null&&Ie in e&&e[Ie]==="file"&&vt in e&&typeof e[vt]=="string"}var Uz=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Wr(t,e),Tn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return H({},r,[{message:"Non-optional file was null or undefined.",value:o}]);if(typeof o[vt]!="string")return H({},r,[{message:"File did not have a file reference string. Got: ".concat(ae(o[vt])),value:o}]);if(this.isRemote&&o[Ie]!=="remote")return H({},r,[{message:"Expected a remote file, but got a local file.",value:o,fixes:["file:upload-remote"]}]);if(this.isRemote&&o[Ie]==="remote")return H({},r,[{message:"Remote file was not checked.",value:o,fixes:["file:check-remote"]}]);if(!this.isRemote&&o[Ie]==="remote")return H({},r,[{message:"Expected locale file, but found remote.",value:o,fixes:["file:download-remote"]}]);if(o[Ie]!=="file")return H({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[Ie]),value:o,fixes:["file:change-extension","file:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return H({},r,[{message:"Invalid mime type format. Got: ".concat(l),value:o,fixes:["file:change-extension","file:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(h){return h.trim()}),u=c.some(function(h){if(h==="*/*")return!0;if(h.endsWith("/*")){var p=h.slice(0,-2);return l.startsWith(p)}return h===l});if(!u)return H({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}])}var d=X.filenameToMimeType(o[vt]);return d?d!==l?H({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}]):o.metadata?H({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the mimeType.",value:o,fixes:["file:check-metadata"]}]):H({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}]):H({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[vt]),value:o,fixes:["file:change-extension","file:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected object, got '".concat(ae(o),"'"),typeError:!0}])}:vt in o?Ie in o&&o[Ie]==="file"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt,remote:this.isRemote}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Hz=function(t){return new Uz(t)};function Wz(e){return e[vt].startsWith("/public")?e.patch_id?{url:"/api/val/files"+e[vt]+"?patch_id=".concat(e.patch_id),metadata:e.metadata}:{url:e[vt].slice(7),metadata:e.metadata}:{url:e[vt]+(e.patch_id?"?patch_id=".concat(e.patch_id):""),metadata:e.metadata}}function Kz(e){return ae(e)==="object"&&e!==null&&e!==void 0&&sM in e&&"val"in e}function aM(e){return e[sM]}function zf(e,t){if(ae(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(e)return e.includes(X.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(X.ModuleFilePathSep).concat(JSON.stringify(t))}function _r(e,t){if(ae(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(!e)throw Error("Cannot create val path of array item of empty or missing path: ".concat(e,". Item: ").concat(t));return e.includes(X.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(X.ModuleFilePathSep).concat(JSON.stringify(t))}var lg=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.items=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?H({},r,[{message:"Expected 'object', got 'null'"}]):ae(o)!=="object"?H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'")}]):Array.isArray(o)?H({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=Un(a,2),c=l[0],u=l[1],d=zf(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var h=u.validate(d,o[c]);h&&s?s=Vt(Vt({},h),s):h&&(s=h)}}),s)}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(ae(o)!=="object")return{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])};if(Array.isArray(o))return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])};for(var i=[],s=0,a=Object.keys(this.items);s<a.length;s++){var l=a[s],c=zf(r,l);c?l in o||i.push({message:"Expected key '".concat(l,"' not found in object"),typeError:!0}):i.push({message:"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(l),internalError:!0})}return i.length>0?{success:!1,errors:H({},r,i)}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=Un(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null)return i;for(var s in this.items){var a=o[s];if(a!=null){var l=_r(r,s),c=this.items[s].executePreview(l,a);for(var u in c){var d=u;i[d]=c[d]}}}return i}}])}(Kr),Gz=function(t){return new lg(t)},lM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),H(r,"previewInput",null),r.item=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=this.assert(r,o);if(!i.success)return i.errors;if(i.data===null)return!1;for(var s={},a=0,l=Object.entries(i.data);a<l.length;a++){var c=Un(l[a],2),u=c[0],d=c[1],h=_r(r,Number(u)),p=this.item.validate(h,d);p&&(s=Vt(Vt({},p),s))}return Object.keys(s).length===0?!1:s}},{key:"assert",value:function(r,o){return o===null&&this.opt?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected object of type 'array'",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null)return i;for(var s=0;s<o.length;s++){var a=s,l=o[a];if(l!=null){var c=_r(r,a),u=this.item.executePreview(c,l);for(var d in u){var h=d;i[h]=u[h]}}}if(this.previewInput){var p=this.previewInput,m=p.prepare,v=p.layout;v!=="list"&&(i[r]={status:"error",message:"Unknown layout type: "+v});try{i[r]={status:"success",data:{layout:"list",parent:"array",items:o.map(function(x){var b=m({val:x}),w=b.title,S=b.subtitle,C=b.image;return{title:w,subtitle:S,image:C}})}}}catch(x){i[r]={status:"error",message:x instanceof Error?x.message:"Unknown error"}}}return i}},{key:"preview",value:function(r){return this.previewInput=r,this}}])}(Kr),qz=function(t){return new lM(t)},Ka=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.value=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),value:o}]):o!==this.value?H({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o=="string"&&o===this.value?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Yz=function(t){return new Ka(t)},cM=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),o=Hr(this,t),o.key=n,o.items=r,o.opt=i,o}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i===null)return!1;if(!this.key)return H({},r,[{message:"Missing required first argument in union",schemaError:!0}]);var a=this.key;if(!Array.isArray(this.items))return H({},r,[{message:"A union schema must take more than 1 schema arguments",schemaError:!0}]);if(typeof a=="string"){if(this.items.some(function(M){return!(M instanceof lg)}))return H({},r,[{message:"Key is a string, so all schema items must be objects",schemaError:!0}]);var l=this.items,c=l.map(function(M){return M.serialize()}),u=c.filter(function(M){return M.type!=="object"||M.items[a].type!=="literal"});if(u.length>0)return H({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),schemaError:!0}]);var d=c,h=d.filter(function(M){return M.items[a].opt});if(h.length>1)return H({},r,[{message:"Schema cannot have an optional keys: ".concat(a),schemaError:!0}]);if(ae(i)!=="object")return H({},r,[{message:"Expected an object",typeError:!0}]);var p=i;if(p[a]===void 0)return H({},r,[{message:"Missing required key: ".concat(a),typeError:!0}]);var m=[],v=zc(d),x;try{for(v.s();!(x=v.n()).done;){var b=x.value,w=b.items[a];if(w.type==="literal")if(!m.includes(w.value))m.push(w.value);else return H({},r,[{message:"Found duplicate key in schema: ".concat(w.value),schemaError:!0}])}}catch(M){v.e(M)}finally{v.f()}var S=l.find(function(M){return!M.items[a].validate(r,p[a])});if(!S){var C=zf(r,a);if(!C)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return H({},C,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(M){var I=M.items[a];if(I.type==="literal"&&I.value)return'"'.concat(I.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(I,null,2)))}).join(", "))}])}var _=S.validate(r,p);if(_)return _}else if(a instanceof Ka){if(this.items.some(function(M){return!(M instanceof Ka)}))return H({},r,[{message:"Key is a literal schema, so all schema items must be literals",typeError:!0}]);var P=[a].concat(Mc(this.items));if(typeof i=="string"){var O=P.some(function(M){return!M.validate(r,i)});if(!O)return H({},r,[{message:"Union must match one of the following: ".concat(P.map(function(M){return'"'.concat(M.value,'"')}).join(", "))}])}}else return H({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(!this.key)return{success:!1,errors:H({},r,[{message:"Missing required first argument in union schema",schemaError:!0}])};if(!Array.isArray(this.items))return{success:!1,errors:H({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])};if(this.key instanceof Ka){var i,s=!1,a={},l=zc((i=[this.key]).concat.apply(i,Mc(this.items))),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!(u instanceof Ka))return{success:!1,errors:H({},r,[{message:"Schema of value is a union of string, so all schema items must be literals",schemaError:!0}])};if(typeof o!="string"){a[r]=[{message:"Expected 'string', got '".concat(ae(o),"'"),typeError:!0}];continue}var d=u.assert(r,o);if(d.success){s=!0;break}else for(var h=0,p=Object.entries(d.errors);h<p.length;h++){var m,v=Un(p[h],2),x=v[0],b=v[1];a[x]||(a[x]=[]),(m=a[x]).push.apply(m,Mc(b))}}}catch(W){l.e(W)}finally{l.f()}return s?{success:!0,data:o}:{success:!1,errors:a}}else if(typeof this.key=="string"){var w=!1,S={},C=zc(this.items),_;try{for(C.s();!(_=C.n()).done;){var P=_.value,O=P.assert(r,o);if(O.success){w=!0;break}else for(var M=0,I=Object.entries(O.errors);M<I.length;M++){var L,U=Un(I[M],2),$=U[0],K=U[1];S[$]||(S[$]=[]),(L=S[$]).push.apply(L,Mc(K))}}}catch(W){C.e(W)}finally{C.f()}return w?{success:!0,data:o}:{success:!1,errors:S}}else return{success:!1,errors:H({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])}}},{key:"nullable",value:function(){return new t(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",key:this.key.serialize(),items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null||this.key instanceof Ka)return i;var s=this.key;if(typeof s=="string"){var a=this.items.find(function(d){if(d instanceof lg){var h=d.items[s];if(h instanceof Ka)return ae(o)==="object"&&s in o&&h.value===o[s]}return!1});if(a){var l=a.executePreview(r,o);for(var c in l){var u=c;i[u]=l[u]}return i}i[r]={status:"error",message:"Could not find a matching (object) schema for the union key: ".concat(s)}}return i[r]={status:"error",message:"The schema of this value is wrong. Expected a object union schema, but union key is not a string. Got: '".concat(JSON.stringify(s,null,2),"'")},i}}])}(Kr),Jz=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new cM(t,r)},R1=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Wr(t,e),Tn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return H({},r,[{message:"Non-optional image was null or undefined.",value:o}]);if(this.isRemote&&o[Ie]!=="remote")return H({},r,[{message:"Expected a remote image, but got a local image.",value:o,fixes:["image:upload-remote"]}]);if(this.isRemote&&o[Ie]==="remote")return H({},r,[{message:"Remote image was not checked.",value:o,fixes:["image:check-remote"]}]);if(!this.isRemote&&o[Ie]==="remote")return H({},r,[{message:"Expected locale image, but found remote.",value:o,fixes:["image:download-remote"]}]);if(typeof o[vt]!="string")return H({},r,[{message:"Image did not have a file reference string. Got: ".concat(ae(o[vt])),value:o}]);if(o[Ie]!=="file")return H({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[Ie]),value:o,fixes:["image:change-extension","image:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return H({},r,[{message:"Invalid mime type format. Got: '".concat(l,"'"),value:o,fixes:["image:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(h){return h.trim()}),u=c.some(function(h){if(h==="*/*")return!0;if(h.endsWith("/*")){var p=h.slice(0,-2);return l.startsWith(p)}return h===l});if(!u)return H({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["image:check-metadata"]}])}var d=X.filenameToMimeType(o[vt]);return d?d&&l&&d!==l?H({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["image:check-metadata"]}]):o.metadata?o.metadata.hotspot&&(ae(o.metadata.hotspot)!=="object"||typeof o.metadata.hotspot.x!="number"||typeof o.metadata.hotspot.y!="number")?H({},r,[{message:"Hotspot must be an object with x and y as numbers.",value:o}]):H({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",value:o,fixes:["image:check-metadata"]}]):H({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}]):H({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[vt]),value:o,fixes:["image:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])}:vt in o?Ie in o&&o[Ie]==="file"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRemote)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt,remote:this.isRemote}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Xz=function(t){return new R1(t)},uM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"maxLength",value:function(r){return new t(Vt(Vt({},this.options),{},{maxLength:r}),this.opt)}},{key:"minLength",value:function(r){return new t(Vt(Vt({},this.options),{},{minLength:r}),this.opt)}},{key:"validate",value:function(r,o){var i=this.assert(r,o);if(!i.success)return H({},r,i.errors[r]);var s=i.data;if(s===null&&this.opt)return!1;if(s===null)return H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}]);var a={},l=this.internalValidate(r,s,a);return l||(Object.keys(a).length>0?a:!1)}},{key:"internalValidate",value:function(r,o,i){var s=this,a=0,l=function(m,v,x){var b=function(j,F,J){x[j]||(x[j]=[]),x[j].push({message:F,typeError:J})},w=zc(v),S;try{for(w.s();!(S=w.n()).done;){var C,_,P,O,M,I,L,U,$,K,W,B=S.value,A=_r(m,v.indexOf(B));if(typeof B=="string"){a+=B.length;continue}if(ae(B)!=="object")return H({},A,[{message:"Expected nodes of type 'object' or 'string', got '".concat(ae(B),"'"),typeError:!0}]);if(B===null)return H({},A,[{message:"Expected nodes of type 'object' or 'string', got 'null'",typeError:!0}]);if(!("tag"in B))return H({},A,[{message:"Expected node to either have 'tag' or be of type 'string'",typeError:!0}]);if(typeof B.tag!="string")return H({},A,[{message:"Expected 'string', got '".concat(ae(B.tag),"'"),typeError:!0}]);if(B.tag==="h1"&&!((C=s.options.block)!==null&&C!==void 0&&C.h1)&&b(A,"'h' block is not valid",!1),B.tag==="h2"&&!((_=s.options.block)!==null&&_!==void 0&&_.h2)&&b(A,"'h2' block is not valid",!1),B.tag==="h3"&&!((P=s.options.block)!==null&&P!==void 0&&P.h3)&&b(A,"'h3' block is not valid",!1),B.tag==="h4"&&!((O=s.options.block)!==null&&O!==void 0&&O.h4)&&b(A,"'h4' block is not valid",!1),B.tag==="h5"&&!((M=s.options.block)!==null&&M!==void 0&&M.h5)&&b(A,"'h5' block is not valid",!1),B.tag==="h6"&&!((I=s.options.block)!==null&&I!==void 0&&I.h6)&&b(A,"'h6' block is not valid",!1),B.tag==="ol"&&!((L=s.options.block)!==null&&L!==void 0&&L.ol)&&b(A,"'ol' block is not valid",!1),B.tag==="ul"&&!((U=s.options.block)!==null&&U!==void 0&&U.ul)&&b(A,"'ul' block is not valid",!1),B.tag==="li"&&!(($=s.options.block)!==null&&$!==void 0&&$.ul)&&!((K=s.options.block)!==null&&K!==void 0&&K.ol)&&b(A,"'li' tag is invalid since neither 'ul' nor 'ol' block is not valid",!1),B.tag==="a"&&!((W=s.options.inline)!==null&&W!==void 0&&W.a)&&b(A,"'a' inline is not valid",!1),B.tag==="img"){var R,N;if(!((R=s.options.inline)!==null&&R!==void 0&&R.img))b(A,"'img' inline is not valid",!1);else if((N=s.options.inline)!==null&&N!==void 0&&N.img){var D,z;if(!("src"in B))return H({},A,[{message:"Expected 'src' in 'img'",typeError:!0}]);var V=_r(A,"src"),G=ae((D=s.options.inline)===null||D===void 0?void 0:D.img)==="object"?(z=s.options.inline)===null||z===void 0?void 0:z.img.validate(V,B.src):new R1({},!1,!1).validate(V,B.src);if(G)for(var _e in G){var Se,Be=_e;x[Be]||(x[Be]=[]),(Se=x[Be]).push.apply(Se,Mc(G[Be]))}}}if("styles"in B&&B.tag!=="span")return H({},A,[{message:"Cannot have styles on '".concat(B.tag,"'. This is only allowed on 'span'"),typeError:!0}]);if("styles"in B){if(!Array.isArray(B.styles))return H({},A,[{message:"Expected 'array', got '".concat(ae(B.styles),"'"),typeError:!0}]);for(var Z=_r(A,"styles"),Y=0;Y<B.styles.length;Y++){var ce,Ee,fe,Ae=B.styles[Y],Ce=_r(Z,Y);if(typeof Ae!="string")return H({},Ce,[{message:"Expected 'string', got '".concat(ae(Ae),"'"),typeError:!0}]);Ae==="bold"&&!((ce=s.options.style)!==null&&ce!==void 0&&ce.bold)&&b(Ce,"Style 'bold' is not valid",!1),Ae==="italic"&&!((Ee=s.options.style)!==null&&Ee!==void 0&&Ee.italic)&&b(Ce,"Style 'italic' is not valid",!1),Ae==="lineThrough"&&!((fe=s.options.style)!==null&&fe!==void 0&&fe.lineThrough)&&b(Ce,"Style 'lineThrough' is not valid",!1)}}if("children"in B){if(!Array.isArray(B.children))return H({},A,[{message:"Expected 'array', got '".concat(ae(B.children),"'"),typeError:!0}]);for(var Ye=B.children,pt=0;pt<Ye.length;pt++){var Wt=Ye[pt];if(ae(Wt)==="object"){var T=_r(A,"children"),k=l(T,[Wt],x);if(k)return k}else if(typeof Wt=="string"){a+=Wt.length;continue}else return H({},A,[{message:"Expected 'object' or 'string', got '".concat(ae(Wt),"'"),typeError:!0}])}}}}catch(E){w.e(E)}finally{w.f()}return!1},c=l(r,o,i),u=[];if(this.options.maxLength&&a>this.options.maxLength&&u.push({message:"Maximum length of ".concat(this.options.maxLength," exceeded (current length: ").concat(a,")"),typeError:!1}),this.options.minLength&&a<this.options.minLength&&u.push({message:"Minimum length of ".concat(this.options.minLength," not met (current length: ").concat(a,")"),typeError:!1}),c){if(u.length>0){var d;c[r]||(c[r]=[]),(d=c[r]).push.apply(d,u)}return c}if(Object.keys(i).length>0){if(u.length>0){var h;i[r]||(i[r]=[]),(h=i[r]).push.apply(h,u)}return i}return u.length>0?H({},r,u):!1}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null&&!this.opt)return{success:!1,errors:H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])};if(!Array.isArray(o))return{success:!1,errors:H({},r,[{message:"Expected 'array', got '".concat(ae(o),"'"),typeError:!0}])};for(var i={},s=0;s<o.length;s++)this.recursiveAssert(_r(r,s),o[s],i);return Object.keys(i).length>0?{success:!1,errors:i}:{success:!0,data:o}}},{key:"recursiveAssert",value:function(r,o,i){if(ae(o)!=="object"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0});return}if(Array.isArray(o)){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'array'",typeError:!0});return}if(o===null){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'null'",typeError:!0});return}if("tag"in o&&typeof o.tag!="string"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'string', got '".concat(ae(o.tag),"'"),typeError:!0});return}if("children"in o)if(Array.isArray(o.children))for(var s=0;s<o.children.length;s++){var a=o.children[s],l=_r(_r(r,"children"),s);if(ae(a)==="object")this.recursiveAssert(l,a,i);else{if(typeof a=="string")continue;i[l]||(i[l]=[]),i[l].push({message:"Expected 'object' or 'string', got '".concat(ae(a),"'"),typeError:!0})}}else{i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(ae(o.children),"'"),typeError:!0});return}if("styles"in o)if(!Array.isArray(o.styles))i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(ae(o.styles),"'"),typeError:!0});else for(var c=0;c<o.styles.length;c++){var u=o.styles[c];if(typeof u!="string"){var d=_r(r,c);i[d]||(i[d]=[]),i[d].push({message:"Expected 'string', got '".concat(ae(u),"'"),typeError:!0})}}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){var r={maxLength:this.options.maxLength,minLength:this.options.minLength,style:this.options.style,block:this.options.block,inline:this.options.inline&&{a:this.options.inline.a,img:this.options.inline.img&&ae(this.options.inline.img)==="object"?this.options.inline.img.serialize():this.options.inline.img}};return{type:"richtext",opt:this.opt,options:r}}},{key:"executePreview",value:function(){return{}}}])}(Kr),Zz=function(t){return new uM(t??{})},dM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),H(r,"previewInput",null),r.item=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?H({},r,[{message:"Expected 'object', got 'null'"}]):ae(o)!=="object"?H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'")}]):Array.isArray(o)?H({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=Un(a,2),c=l[0],u=l[1],d=zf(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var h=i.item.validate(d,u);h&&s?s=Vt(Vt({},h),s):h&&(s=h)}}),s)}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:ae(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(ae(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}},{key:"executePreview",value:function(r,o){var i={};if(o===null)return i;for(var s in o){var a=o[s];if(a!=null){var l=_r(r,s),c=this.item.executePreview(l,a);for(var u in c){var d=u;i[d]=c[d]}}}if(this.previewInput){var h=this.previewInput,p=h.prepare,m=h.layout;m!=="list"&&(i[r]={status:"error",message:"Unknown layout type: "+m});try{i[r]={status:"success",data:{layout:"list",parent:"record",items:Object.entries(o).map(function(v){var x=Un(v,2),b=x[0],w=x[1],S=p({key:b,val:w}),C=S.title,_=S.subtitle,P=S.image;return[b,{title:C,subtitle:_,image:P}]})}}}catch(v){i[r]={status:"error",message:v instanceof Error?v.message:"Unknown error"}}}return i}},{key:"preview",value:function(r){return this.previewInput=r,this}}])}(Kr),Qz=function(t){return new dM(t)};function e$(e){var t=e[$z],n=t;return n}function fM(e){var t=e.indexOf(va);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+va.length)]}function hM(e,t){return t===""?e:"".concat(e).concat(va).concat(t)}function t$(e){return e instanceof lg||ae(e)==="object"&&"type"in e&&e.type==="object"}function n$(e){return e instanceof dM||ae(e)==="object"&&"type"in e&&e.type==="record"}function r$(e){return e instanceof lM||ae(e)==="object"&&"type"in e&&e.type==="array"}function o$(e){return e instanceof cM||ae(e)==="object"&&"type"in e&&e.type==="union"}function i$(e){return e instanceof uM||ae(e)==="object"&&"type"in e&&e.type==="richtext"}function s$(e){return e instanceof R1||ae(e)==="object"&&"type"in e&&e.type==="image"}function a$(e,t,n){for(var r=cg(e),o=Mc(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(r$(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(ae(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ae(s)));s=s[u],i=i.item}else if(n$(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ae(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ae(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.item}else if(t$(i)){if(ae(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ae(s)));if(s!==null&&s[u]===void 0)throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s===null?s:s[u],i=i.items[u]}else{if(s$(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(x){return JSON.stringify(x)}).join("."),schema:i,source:s}};if(o$(i)){var d=i.key;if(typeof d!="string")return{v:{path:o.map(function(x){return Number.isNaN(Number(x))?JSON.stringify(x):x}).join("."),schema:i,source:s}};var h=s[d];if(!h)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(d," in path: ").concat(e));var p=i.items.find(function(x){var b;return(x==null||(b=x.items)===null||b===void 0||(b=b[d])===null||b===void 0?void 0:b.value)===h});if(!p)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(d," of value ").concat(h," in path: ").concat(e));i=p.items[u],s=s[u]}else if(i$(i)){if("src"in s&&"tag"in s&&s.tag==="img"&&r.length===0){var m,v;i=(m=i.options)!==null&&m!==void 0&&(m=m.inline)!==null&&m!==void 0&&m.img&&typeof((v=i.options)===null||v===void 0||(v=v.inline)===null||v===void 0?void 0:v.img)!="boolean"?i.options.inline.img:i}s=s[u]}else throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function l$(e){var t=e.split("/").slice(1);return t}function cg(e){for(var t=[],n=0;n<e.length;){var r="";if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&e[n+1]==='"'?(r+='"',n++):r+=e[n],n++;if(e[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(e),"): Missing closing double quote: ").concat((o=e[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(e.length,")"))}}else for(;n<e.length&&e[n]!==".";)r+=e[n],n++;r!==""&&t.push(r),n++}return t}function c$(e){return e.split(",")}function u$(e){var t=fM(e),n=Un(t,2),r=n[0],o=n[1],i=cg(o).slice(0,-1);return i.length>0?hM(r,pM(i)):r}function pM(e){return e.map(function(t){return Number.isInteger(Number(t))?t:JSON.stringify(t)}).join(".")}var d$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?H({},r,[{message:"Expected 'number', got '".concat(ae(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'number', got 'null'",typeError:!0}])}:typeof o=="number"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected 'number', got '".concat(ae(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}},{key:"executePreview",value:function(){return{}}}])}(Kr),f$=function(t){return new d$(t)},h$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return Wr(t,e),Tn(t,[{key:"min",value:function(r){return this.minLength(r)}},{key:"minLength",value:function(r){return new t(Vt(Vt({},this.options),{},{minLength:r}),this.opt,this.isRaw)}},{key:"max",value:function(r){return this.maxLength(r)}},{key:"maxLength",value:function(r){return new t(Vt(Vt({},this.options),{},{maxLength:r}),this.opt,this.isRaw)}},{key:"regexp",value:function(r){return new t(Vt(Vt({},this.options),{},{regexp:r}),this.opt,this.isRaw)}},{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?H({},r,l):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:typeof o=="string"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}},{key:"executePreview",value:function(){return{}}}])}(Kr),p$=function(t){return new h$(t)},m$=function(e){function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Nn(this,t),n=Hr(this,t),n.opt=r,n}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?H({},r,[{message:"Expected 'boolean', got '".concat(ae(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'boolean', got 'null'",typeError:!0}])}:typeof o!="boolean"?{success:!1,errors:H({},r,[{message:"Expected 'boolean', got '".concat(ae(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}},{key:"executePreview",value:function(){return{}}}])}(Kr),g$=function(){return new m$},v$=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Nn(this,t),o=Hr(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return H({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="object"||i.type==="record"))return H({},r,[{message:"Schema in keyOf must be an 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="record"&&typeof o!="string")return H({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(o))return H({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return i.type==="record"?typeof o!="string"?H({},r,[{message:"Value of keyOf (record) must be 'string'. Found: ".concat(ae(o))}]):H({},r,[{fixes:["keyof:check-keys"],message:"Did not validate keyOf (record). This error (keyof:check-keys) should typically be processed by Val internally. Seeing this error most likely means you have a Val version mismatch.",value:{key:o,sourcePath:this.sourcePath}}]):!1}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])};var i=this.schema;if(!i)return{success:!1,errors:H({},r,[{message:"Neither key nor schema was found. keyOf is missing an argument.",typeError:!0}])};var s=i;if(!(s.type==="object"||s.type==="record"))return{success:!1,errors:H({},r,[{message:"Schema of first argument must be either: 'array', 'object' or 'record'. Found '".concat(s.type,"'"),typeError:!0}])};if(s.type==="record"&&typeof o!="string")return{success:!1,errors:H({},r,[{message:"Value of keyOf (record) must be 'string', got '".concat(ae(o),"'"),typeError:!0}])};if(s.type==="object"){var a=Object.keys(s.items);if(!a.includes(o))return{success:!1,errors:H({},r,[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o),typeError:!0}])}}return{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.schema,this.sourcePath,!0)}},{key:"serialize",value:function(){var r=this.sourcePath;if(!r)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module of record schema.");var o=this.schema;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(o.type){case"record":i="string";break;case"object":i=Object.keys(o.items);break;default:throw new Error("Cannot serialize keyOf schema with selector of type '".concat(o.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",path:r,schema:o,opt:this.opt,values:i}}},{key:"executePreview",value:function(){return{}}}])}(Kr),y$=function(t){var n;return new v$(t==null||(n=t[iM])===null||n===void 0?void 0:n.serialize(),aM(t))},x$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Nn(this,t),r=Hr(this,t),r.options=n,r.opt=o,r}return Wr(t,e),Tn(t,[{key:"validate",value:function(r,o){var i,s,a,l;if(this.opt&&o==null)return!1;if(typeof o!="string")return H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),value:o}]);if((i=this.options)!==null&&i!==void 0&&i.from&&(s=this.options)!==null&&s!==void 0&&s.to){if(this.options.from>this.options.to)return H({},r,[{message:"From date ".concat(this.options.from," is after to date ").concat(this.options.to),value:o,typeError:!0}]);if(o<this.options.from||o>this.options.to)return H({},r,[{message:"Date is not between ".concat(this.options.from," and ").concat(this.options.to),value:o}])}else if((a=this.options)!==null&&a!==void 0&&a.from){if(o<this.options.from)return H({},r,[{message:"Date is before the minimum date ".concat(this.options.from),value:o}])}else if((l=this.options)!==null&&l!==void 0&&l.to&&o>this.options.to)return H({},r,[{message:"Date is after the maximum date ".concat(this.options.to),value:o}]);return!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o!="string"?{success:!1,errors:H({},r,[{message:"Expected 'string', got '".concat(ae(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"from",value:function(r){return new t(Vt(Vt({},this.options),{},{from:r}),this.opt)}},{key:"to",value:function(r){return new t(Vt(Vt({},this.options),{},{to:r}),this.opt)}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"date",opt:this.opt,options:this.options}}},{key:"executePreview",value:function(){return{}}}])}(Kr),b$=function(t){return new x$(t)};function w$(){return{string:p$,boolean:g$,array:qz,object:Gz,number:f$,union:Jz,richtext:Zz,image:Xz,literal:Yz,keyOf:y$,record:Qz,file:Hz,date:b$}}function S$(e,t){var n=t.publicProjectId,r=t.coreVersion,o=t.validationHash,i=t.fileHash,s=t.filePath,a=t.bucket;return"".concat(e,"/file/p/").concat(n,"/b/").concat(a,"/v/").concat(r,"/h/").concat(o,"/f/").concat(i,"/p/").concat(s)}var k$=/^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;function mM(e){var t=e.match(k$);return t?t[7].indexOf("public/val/")!==0?{status:"error",error:"Invalid remote ref: "+e}:{status:"success",remoteHost:t[1],projectId:t[2],bucket:t[3],version:t[4],validationHash:t[5],fileHash:t[6],filePath:t[7]}:{status:"error",error:"Invalid remote ref: "+e}}var kC="https://remote.val.build";function E$(e){if(e!=null&&e.patch_id){var t=mM(e[vt]);if(t.status==="success")return{url:"/api/val/files/"+t.filePath+"?patch_id=".concat(e.patch_id,"&remote=true&ref=").concat(encodeURIComponent(e[vt])),metadata:e.metadata};console.warn("Internal Val error: failed to split remote ref: ".concat(e[vt],". The data format is different than what is expected. Check Val versions for mismatches."),t.error)}return{url:e[vt],metadata:e.metadata}}var Fr=Tn(function e(t){Nn(this,e),this.message=t}),C$=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],mt=function(e){return e[e.inputBytes=64]="inputBytes",e[e.inputWords=16]="inputWords",e[e.highIndex=14]="highIndex",e[e.lowIndex=15]="lowIndex",e[e.workWords=64]="workWords",e[e.allocBytes=80]="allocBytes",e[e.allocWords=20]="allocWords",e[e.allocTotal=8e3]="allocTotal",e}(mt||{});function _$(e){return new P$}var P$=function(){function e(){Nn(this,e),H(this,"A",1779033703),H(this,"B",-1150833019),H(this,"C",1013904242),H(this,"D",-1521486534),H(this,"E",1359893119),H(this,"F",-1694144372),H(this,"G",528734635),H(this,"H",1541459225),H(this,"_size",0),H(this,"_sp",0),(!Fp||fd>=mt.allocTotal)&&(Fp=new ArrayBuffer(mt.allocTotal),fd=0),this._byte=new Uint8Array(Fp,fd,mt.allocBytes),this._word=new Int32Array(Fp,fd,mt.allocWords),fd+=mt.allocBytes}return Tn(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+ae(n));var r=n.byteOffset,o=n.byteLength,i=o/mt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%mt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*mt.inputWords);i--;)this._int32(a,s>>2),s+=mt.inputBytes;this._size+=s}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+s,o-s);return this._uint8(c)}return s===o?this:this._uint8(n,s)}},{key:"_uint8",value:function(n,r){var o=this._byte,i=this._word,s=n.length;for(r=r|0;r<s;){for(var a=this._size%mt.inputBytes,l=a;r<s&&l<mt.inputBytes;)o[l++]=n[r++];l>=mt.inputBytes&&this._int32(i),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,i=n.length,s=this._sp,a=0;a<i;){for(var l=this._size%mt.inputBytes,c=l;a<i&&c<mt.inputBytes;){var u=n.charCodeAt(a++)|0;u<128?r[c++]=u:u<2048?(r[c++]=192|u>>>6,r[c++]=128|u&63):u<55296||u>57343?(r[c++]=224|u>>>12,r[c++]=128|u>>>6&63,r[c++]=128|u&63):s?(u=((s&1023)<<10)+(u&1023)+65536,r[c++]=240|u>>>18,r[c++]=128|u>>>12&63,r[c++]=128|u>>>6&63,r[c++]=128|u&63,s=0):s=u}c>=mt.inputBytes&&(this._int32(o),o[0]=o[mt.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,h=0;for(r=r|0;h<mt.inputWords;)Ua[h++]=bo(n[r++]);for(h=mt.inputWords;h<mt.workWords;h++)Ua[h]=A$(Ua[h-2])+Ua[h-7]+I$(Ua[h-15])+Ua[h-16]|0;for(h=0;h<mt.workWords;h++){var p=d+R$(l)+O$(l,c,u)+C$[h]+Ua[h]|0,m=j$(o)+M$(o,i,s)|0;d=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+m|0}this.A=o+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=l+this.E|0,this.F=c+this.F|0,this.G=u+this.G|0,this.H=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%mt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>mt.highIndex){for(;i<mt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<mt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[mt.highIndex]=bo(l)),a&&(o[mt.lowIndex]=bo(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H;return bs(n)+bs(r)+bs(o)+bs(i)+bs(s)+bs(a)+bs(l)+bs(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=bo(n),d[1]=bo(r),d[2]=bo(o),d[3]=bo(i),d[4]=bo(s),d[5]=bo(a),d[6]=bo(l),d[7]=bo(c),u.slice(0,32)}}])}(),Ua=new Int32Array(mt.workWords),Fp,fd=0,bs=function(t){return(t+4294967296).toString(16).substr(-8)},N$=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},T$=function(t){return t},bo=D$()?T$:N$,O$=function(t,n,r){return r^t&(n^r)},M$=function(t,n,r){return t&n|r&(t|n)},j$=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},R$=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},I$=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},A$=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function D$(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var I1=function(t){return _$().update(t).digest("hex")},A1={x3d:"application/vnd.hzn-3d-crossword","3gp":"video/3gpp","3g2":"video/3gpp2",mseq:"application/vnd.mseq",pwn:"application/vnd.3m.post-it-notes",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",acc:"application/vnd.americandynamics.acc",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",adp:"audio/adpcm",aab:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",air:"application/vnd.adobe.air-application-installer-package+zip",swf:"application/x-shockwave-flash",fxp:"application/vnd.adobe.fxp",pdf:"application/pdf",ppd:"application/vnd.cups-ppd",dir:"application/x-director",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",aac:"audio/x-aac",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",ami:"application/vnd.amiga.ami","N/A":"application/andrew-inset",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",dmg:"application/x-apple-diskimage",mpkg:"application/vnd.apple.installer+xml",aw:"application/applixware",mp3:"audio/mpeg",les:"application/vnd.hhe.lesson-player",swi:"application/vnd.aristanetworks.swi",s:"text/x-asm",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",atom:"application/atom+xml",ac:"application/pkix-attr-cert",aif:"audio/x-aiff",avi:"video/x-msvideo",aep:"application/vnd.audiograph",dxf:"image/vnd.dxf",dwf:"model/vnd.dwf",par:"text/plain-bas",bcpio:"application/x-bcpio",bin:"application/octet-stream",bmp:"image/bmp",torrent:"application/x-bittorrent",cod:"application/vnd.rim.cod",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",sh:"application/x-sh",btif:"image/prs.btif",rep:"application/vnd.businessobjects",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",c:"text/x-c",cdxml:"application/vnd.chemdraw+xml",css:"text/css",cdx:"chemical/x-cdx",cml:"chemical/x-cml",csml:"chemical/x-csml",cdbcmsg:"application/vnd.contact.cmsg",cla:"application/vnd.claymore",c4g:"application/vnd.clonk.c4group",sub:"image/vnd.dvb.subtitle",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",ras:"image/x-cmu-raster",dae:"model/vnd.collada+xml",csv:"text/csv",cpt:"application/mac-compactpro",wmlc:"application/vnd.wap.wmlc",cgm:"image/cgm",ice:"x-conference/x-cooltalk",cmx:"image/x-cmx",xar:"application/vnd.xara",cmc:"application/vnd.cosmocaller",cpio:"application/x-cpio",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",cryptonote:"application/vnd.rig.cryptonote",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cu:"application/cu-seeme",cww:"application/prs.cww",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",cmp:"application/vnd.yellowriver-custom-menu",dssc:"application/dssc+der",xdssc:"application/dssc+xml",deb:"application/x-debian-package",uva:"audio/vnd.dece.audio",uvi:"image/vnd.dece.graphic",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvu:"video/vnd.uvvu.mp4",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",dvi:"application/x-dvi",seed:"application/vnd.fdsn.seed",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",eol:"audio/vnd.digital-winds",djvu:"image/vnd.djvu",dtd:"application/xml-dtd",mlp:"application/vnd.dolby.mlp",wad:"application/x-doom",dpg:"application/vnd.dpgraph",dra:"audio/vnd.dra",dfac:"application/vnd.dreamfactory",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dwg:"image/vnd.dwg",geo:"application/vnd.dynageo",es:"application/ecmascript",mag:"application/vnd.ecowin.chart",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",exi:"application/exi",mgz:"application/vnd.proteus.magazine",epub:"application/epub+zip",eml:"message/rfc822",nml:"application/vnd.enliven",xpr:"application/vnd.is-xpr",xif:"image/vnd.xiff",xfdl:"application/vnd.xfdl",emma:"application/emma+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fst:"image/vnd.fst",fvt:"video/vnd.fvt",fbs:"image/vnd.fastbidsheet",fe_launch:"application/vnd.denovo.fcselayout-link",f4v:"video/x-f4v",flv:"video/x-flv",fpx:"image/vnd.fpx",npx:"image/vnd.net-fpx",flx:"text/vnd.fmi.flexstor",fli:"video/x-fli",ftc:"application/vnd.fluxtime.clip",fdf:"application/vnd.fdf",f:"text/x-fortran",mif:"application/vnd.mif",fm:"application/vnd.framemaker",fh:"image/x-freehand",fsc:"application/vnd.fsc.weblaunch",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",spl:"application/x-futuresplash",fzs:"application/vnd.fuzzysheet",g3:"image/g3fax",gmx:"application/vnd.gmx",gtw:"model/vnd.gtw",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gdl:"model/vnd.gdl",gex:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gsf:"application/x-font-ghostscript",bdf:"application/x-font-bdf",gtar:"application/x-gtar",texinfo:"application/x-texinfo",gnumeric:"application/x-gnumeric",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gif:"image/gif",gv:"text/vnd.graphviz",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",h261:"video/h261",h263:"video/h263",h264:"video/h264",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",hdf:"application/x-hdf",rip:"audio/vnd.rip",hbci:"application/vnd.hbci",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",hpgl:"application/vnd.hp-hpgl",hvs:"application/vnd.yamaha.hv-script",hvd:"application/vnd.yamaha.hv-dic",hvp:"application/vnd.yamaha.hv-voice","sfd-hdstx":"application/vnd.hydrostatix.sof-data",stk:"application/hyperstudio",hal:"application/vnd.hal+xml",html:"text/html",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",ics:"text/calendar",icc:"application/vnd.iccprofile",ico:"image/x-icon",igl:"application/vnd.igloader",ief:"image/ief",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",rif:"application/reginfo+xml","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",igs:"model/iges",i2g:"application/vnd.intergeo",cdy:"application/vnd.cinderella",xpw:"application/vnd.intercon.formnet",fcs:"application/vnd.isac.fcs",ipfix:"application/ipfix",cer:"application/pkix-cert",pki:"application/pkixcmp",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",igm:"application/vnd.insors.igm",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",jad:"text/vnd.sun.j2me.app-descriptor",jar:"application/java-archive",class:"application/java-vm",jnlp:"application/x-java-jnlp-file",ser:"application/java-serialized-object",java:"text/x-java-source,java",js:"application/javascript",json:"application/json",joda:"application/vnd.joost.joda-archive",jpm:"video/jpm",jpeg:"image/jpeg",jpg:"image/jpeg",pjpeg:"image/pjpeg",jpgv:"video/jpeg",ktz:"application/vnd.kahootz",mmd:"application/vnd.chipnuts.karaoke-mmd",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",latex:"application/x-latex",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",jam:"application/vnd.jam",123:"application/vnd.lotus-1-2-3",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",lvp:"audio/vnd.lucent.voice",m3u:"audio/x-mpegurl",m4v:"video/x-m4v",hqx:"application/mac-binhex40",portpkg:"application/vnd.macports.portpkg",mgp:"application/vnd.osgeo.mapguide.package",mrc:"application/marc",mrcx:"application/marcxml+xml",mxf:"application/mxf",nbp:"application/vnd.wolfram.player",ma:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mc1:"application/vnd.medcalcdata",mscml:"application/mediaservercontrol+xml",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",msh:"model/mesh",mads:"application/mads+xml",mets:"application/mets+xml",mods:"application/mods+xml",meta4:"application/metalink4+xml",mcd:"application/vnd.mcd",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",es3:"application/vnd.eszigno3+xml",mdb:"application/x-msaccess",asf:"video/x-ms-asf",exe:"application/x-msdownload",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",ims:"application/vnd.ms-ims",application:"application/x-ms-application",clp:"application/x-msclip",mdi:"image/vnd.ms-modi",eot:"application/vnd.ms-fontobject",xls:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",chm:"application/vnd.ms-htmlhelp",crd:"application/x-mscardfile",lrm:"application/vnd.ms-lrm",mvb:"application/x-msmediaview",mny:"application/x-msmoney",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",obd:"application/x-msbinder",thmx:"application/vnd.ms-officetheme",onetoc:"application/onenote",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",ppt:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",pub:"application/x-mspublisher",scd:"application/x-msschedule",xap:"application/x-silverlight-app",stl:"application/vnd.ms-pki.stl",cat:"application/vnd.ms-pki.seccat",vsd:"application/vnd.visio",vsdx:"application/vnd.visio2013",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wax:"audio/x-ms-wax",wmx:"video/x-ms-wmx",wmd:"application/x-ms-wmd",wpl:"application/vnd.ms-wpl",wmz:"application/x-ms-wmz",wmv:"video/x-ms-wmv",wvx:"video/x-ms-wvx",wmf:"application/x-msmetafile",trm:"application/x-msterminal",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wri:"application/x-mswrite",wps:"application/vnd.ms-works",xbap:"application/x-ms-xbap",xps:"application/vnd.ms-xpsdocument",mid:"audio/midi",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",rms:"application/vnd.jcp.javame.midlet-rms",tmo:"application/vnd.tmobile-livetv",prc:"application/x-mobipocket-ebook",mbk:"application/vnd.mobius.mbk",dis:"application/vnd.mobius.dis",plc:"application/vnd.mobius.plc",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",txf:"application/vnd.mobius.txf",daf:"application/vnd.mobius.daf",fly:"text/vnd.fly",mpc:"application/vnd.mophun.certificate",mpn:"application/vnd.mophun.application",mj2:"video/mj2",mpga:"audio/mpeg",mxu:"video/vnd.mpegurl",mpeg:"video/mpeg",m21:"application/mp21",mp4a:"audio/mp4",mp4:"video/mp4",m3u8:"application/vnd.apple.mpegurl",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",mxml:"application/xv+xml",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",ncx:"application/x-dtbncx+xml",nc:"application/x-netcdf",nlu:"application/vnd.neurolanguage.nlu",dna:"application/vnd.dna",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",n3:"text/n3",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",gph:"application/vnd.flographit",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",oda:"application/oda",ogx:"application/ogg",oga:"audio/ogg",ogv:"video/ogg",dd2:"application/vnd.oma.dd2+xml",oth:"application/vnd.oasis.opendocument.text-web",opf:"application/oebps-package+xml",qbo:"application/vnd.intu.qbo",oxt:"application/vnd.openofficeorg.extension",osf:"application/vnd.yamaha.openscoreformat",weba:"audio/webm",webm:"video/webm",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",ktx:"image/ktx",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",otf:"application/x-font-otf",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",dp:"application/vnd.osgi.dp",pdb:"application/vnd.palm",p:"text/x-pascal",paw:"application/vnd.pawaafile",pclxl:"application/vnd.hp-pclxl",efif:"application/vnd.picsel",pcx:"image/x-pcx",psd:"image/vnd.adobe.photoshop",prf:"application/pics-rules",pic:"image/x-pict",chat:"application/x-chat",p10:"application/pkcs10",p12:"application/x-pkcs12",p7m:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p7r:"application/x-pkcs7-certreqresp",p7b:"application/x-pkcs7-certificates",p8:"application/pkcs8",plf:"application/vnd.pocketlearn",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pcf:"application/x-font-pcf",pfr:"application/font-tdpfr",pgn:"application/x-chess-pgn",pgm:"image/x-portable-graymap",png:"image/png",ppm:"image/x-portable-pixmap",pskcxml:"application/pskc+xml",pml:"application/vnd.ctc-posml",ai:"application/postscript",pfa:"application/x-font-type1",pbd:"application/vnd.powerbuilder6",pgp:"application/pgp-signature",box:"application/vnd.previewsystems.box",ptid:"application/vnd.pvi.ptid1",pls:"application/pls+xml",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",dsc:"text/prs.lines.tag",psf:"application/x-font-linux-psf",qps:"application/vnd.publishare-delta-tree",wg:"application/vnd.pmi.widget",qxd:"application/vnd.quark.quarkxpress",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",ssf:"application/vnd.epson.ssf",qam:"application/vnd.epson.quickanime",qfx:"application/vnd.intu.qfx",mov:"video/quicktime",rar:"application/x-rar-compressed",ram:"audio/x-pn-realaudio",rmp:"audio/x-pn-realaudio-plugin",rsd:"application/rsd+xml",rm:"application/vnd.rn-realmedia",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",rnc:"application/relax-ng-compact-syntax",rdz:"application/vnd.data-vision.rdz",rdf:"application/rdf+xml",rp9:"application/vnd.cloanto.rp9",jisp:"application/vnd.jisp",rtf:"application/rtf",rtx:"text/richtext",link66:"application/vnd.route66.link66+xml",rss:"application/rss+xml",shf:"application/shf+xml",st:"application/vnd.sailingtracker.track",svg:"image/svg+xml",sus:"application/vnd.sus-calendar",sru:"application/sru+xml",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",see:"application/vnd.seemail",snf:"application/x-font-snf",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",sdp:"application/sdp",etx:"text/x-setext",movie:"video/x-sgi-movie",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",tfi:"application/thraud+xml",shar:"application/x-shar",rgb:"image/x-rgb",slt:"application/vnd.epson.salt",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",twd:"application/vnd.simtech-mindmapper",csp:"application/vnd.commonspace",saf:"application/vnd.yamaha.smaf-audio",mmf:"application/vnd.smaf",spf:"application/vnd.yamaha.smaf-phrase",teacher:"application/vnd.smart.teacher",svd:"application/vnd.svd",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",ssml:"application/ssml+xml",skp:"application/vnd.koan",sgml:"text/sgml",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",sm:"application/vnd.stepmania.stepchart",sit:"application/x-stuffit",sitx:"application/x-stuffitx",sdkm:"application/vnd.solent.sdkm+xml",xo:"application/vnd.olpc-sugar",au:"audio/basic",wqd:"application/vnd.wqd",sis:"application/vnd.symbian.install",smi:"application/smil+xml",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",sbml:"application/sbml+xml",tsv:"text/tab-separated-values",tiff:"image/tiff",tao:"application/vnd.tao.intent-module-archive",tar:"application/x-tar",tcl:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",tei:"application/tei+xml",txt:"text/plain",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",tsd:"application/timestamped-data",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",t:"text/troff",tra:"application/vnd.trueapp",ttf:"application/x-font-ttf",ttl:"text/turtle",umj:"application/vnd.umajin",uoml:"application/vnd.uoml+xml",unityweb:"application/vnd.unity",ufd:"application/vnd.ufdl",uri:"text/uri-list",utz:"application/vnd.uiq.theme",ustar:"application/x-ustar",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",vcd:"application/x-cdlink",vsf:"application/vnd.vsf",wrl:"model/vrml",vcx:"application/vnd.vcx",mts:"model/vnd.mts",vtu:"model/vnd.vtu",vis:"application/vnd.visionary",viv:"video/vnd.vivo",ccxml:"application/ccxml+xml,",vxml:"application/voicexml+xml",src:"application/x-wais-source",wbxml:"application/vnd.wap.wbxml",wbmp:"image/vnd.wap.wbmp",wav:"audio/x-wav",davmount:"application/davmount+xml",woff:"application/x-font-woff",wspolicy:"application/wspolicy+xml",webp:"image/webp",wtb:"application/vnd.webturbo",wgt:"application/widget",hlp:"application/winhlp",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",wmlsc:"application/vnd.wap.wmlscriptc",wpd:"application/vnd.wordperfect",stf:"application/vnd.wt.stf",wsdl:"application/wsdl+xml",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",der:"application/x-x509-ca-cert",fig:"application/x-xfig",xhtml:"application/xhtml+xml",xml:"application/xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xer:"application/patch-ops-error+xml",rl:"application/resource-lists+xml",rs:"application/rls-services+xml",rld:"application/resource-lists-diff+xml",xslt:"application/xslt+xml",xop:"application/xop+xml",xpi:"application/x-xpinstall",xspf:"application/xspf+xml",xul:"application/vnd.mozilla.xul+xml",xyz:"chemical/x-xyz",yaml:"text/yaml",yang:"application/yang",yin:"application/yin+xml",zir:"application/vnd.zul",zip:"application/zip",zmm:"application/vnd.handheld-entertainment+xml",zaz:"application/vnd.zzazz.deck+xml"},gM=Object.fromEntries(Object.entries(A1).map(function(e){var t=Un(e,2),n=t[0],r=t[1];return[r,n]})),L$=/^data:(.*?);base64,/;function F$(e){var t=L$.exec(e);if(t&&t[1])return t[1]}function z$(e){var t=gM[e];return t||e.split("/")[1]}function $$(e){var t=e.split(".").pop(),n=t&&A1[t];if(n)return n}function vM(e,t,n,r,o){var i="".concat((r==null?void 0:r.width)||"").concat((r==null?void 0:r.height)||"").concat(r==null?void 0:r.mimeType),s={type:t.type,opt:t.opt,options:Vt({},t.options)};return e+JSON.stringify(s)+n+i+o}function B$(e,t,n,r,o,i){return I1(i.encode(vM(e,t,n,r,o))).slice(0,4)}function yM(e){return e.slice(0,12)}function V$(e){return yM(I1(new Uint8Array(e)))}var va="?p=",xM="https://content.val.build",hb="https://app.val.build",X={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:Wz,convertRemoteSource:E$,getSchema:Bz,getValPath:aM,getSource:e$,resolvePath:a$,splitModuleFilePathAndModulePath:fM,joinModuleFilePathAndModulePath:hM,remote:{createRemoteRef:S$,getValidationBasis:vM,getValidationHash:B$,getFileHash:V$,hashToRemoteFileHash:yM,splitRemoteRef:mM},isVal:Kz,isFile:Vz,createValPathOfItem:zf,getSHA256Hash:I1,initSchema:w$,getMimeType:F$,mimeTypeToFileExt:z$,filenameToMimeType:$$,EXT_TO_MIME_TYPES:A1,MIME_TYPES_TO_EXT:gM,ModuleFilePathSep:va,notFileOp:function(t){return t.op!=="file"},isFileOp:function(t){return t.op==="file"&&typeof t.filePath=="string"},createPatchJSONPath:function(t){return"/".concat(t.split(".").map(function(n){return n&&U$(n)}).join("/"))},createPatchPath:function(t){return cg(t)},splitModulePath:cg,splitModuleFilePath:l$,splitJoinedSourcePaths:c$,parentOfSourcePath:u$,patchPathToModulePath:pM,VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session",createFilename:function(t,n,r,o){var i,s;if(!r||!t)return n;var a=o.slice(0,5),l=(i=X.getMimeType(t))!==null&&i!==void 0?i:"unknown",c=(s=X.mimeTypeToFileExt(l))!==null&&s!==void 0?s:"unknown";if(n){var u=n.split(".").slice(0,-1).join(".")||n,d=u.lastIndexOf("_"),h=u.slice(d+1,u.length);h===a&&(u=u.slice(0,d));var p=encodeURIComponent(u).replace(/%[0-9A-Fa-f]{2}/g,"").toLowerCase();return"".concat(p,"_").concat(a,".").concat(c)}return"".concat(o,".").concat(c)}};function U$(e){try{return JSON.parse(e)}catch{return e}}function Ys(e){return Array.isArray(e)}function su(e){"@babel/helpers - typeof";return su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},su(e)}function vn(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Ne(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function We(e){Ne(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||su(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Yn(e,t){Ne(2,arguments);var n=We(e),r=vn(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Bo(e,t){Ne(2,arguments);var n=We(e),r=vn(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());i.setMonth(n.getMonth()+r+1,0);var s=i.getDate();return o>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}function H$(e,t){Ne(2,arguments);var n=We(e).getTime(),r=vn(t);return new Date(n+r)}var W$={};function Aa(){return W$}function ui(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=We(e),p=h.getDay(),m=(p<d?7:0)+p-d;return h.setDate(h.getDate()-m),h.setHours(0,0,0,0),h}function _l(e){return Ne(1,arguments),ui(e,{weekStartsOn:1})}function K$(e){Ne(1,arguments);var t=We(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=_l(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var s=_l(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function G$(e){Ne(1,arguments);var t=K$(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=_l(n);return r}function $f(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function au(e){Ne(1,arguments);var t=We(e);return t.setHours(0,0,0,0),t}var q$=864e5;function Bi(e,t){Ne(2,arguments);var n=au(e),r=au(t),o=n.getTime()-$f(n),i=r.getTime()-$f(r);return Math.round((o-i)/q$)}function pb(e,t){Ne(2,arguments);var n=vn(t),r=n*7;return Yn(e,r)}function Y$(e,t){Ne(2,arguments);var n=vn(t);return Bo(e,n*12)}function J$(e){Ne(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(su(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=We(r);(n===void 0||n<o||isNaN(Number(o)))&&(n=o)}),n||new Date(NaN)}function X$(e){Ne(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(su(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=We(r);(n===void 0||n>o||isNaN(o.getDate()))&&(n=o)}),n||new Date(NaN)}function lr(e,t){Ne(2,arguments);var n=au(e),r=au(t);return n.getTime()===r.getTime()}function D1(e){return Ne(1,arguments),e instanceof Date||su(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Z$(e){if(Ne(1,arguments),!D1(e)&&typeof e!="number")return!1;var t=We(e);return!isNaN(Number(t))}function Bf(e,t){Ne(2,arguments);var n=We(e),r=We(t),o=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return o*12+i}var Q$=6048e5;function e6(e,t,n){Ne(2,arguments);var r=ui(e,n),o=ui(t,n),i=r.getTime()-$f(r),s=o.getTime()-$f(o);return Math.round((i-s)/Q$)}function L1(e){Ne(1,arguments);var t=We(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function hr(e){Ne(1,arguments);var t=We(e);return t.setDate(1),t.setHours(0,0,0,0),t}function t6(e){Ne(1,arguments);var t=We(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function F1(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=We(e),p=h.getDay(),m=(p<d?-7:0)+6-(p-d);return h.setDate(h.getDate()+m),h.setHours(23,59,59,999),h}function bM(e){return Ne(1,arguments),F1(e,{weekStartsOn:1})}function n6(e,t){Ne(2,arguments);var n=vn(t);return H$(e,-n)}var r6=864e5;function o6(e){Ne(1,arguments);var t=We(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),o=n-r;return Math.floor(o/r6)+1}function ug(e){Ne(1,arguments);var t=1,n=We(e),r=n.getUTCDay(),o=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function wM(e){Ne(1,arguments);var t=We(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=ug(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=ug(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function i6(e){Ne(1,arguments);var t=wM(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=ug(n);return r}var s6=6048e5;function a6(e){Ne(1,arguments);var t=We(e),n=ug(t).getTime()-i6(t).getTime();return Math.round(n/s6)+1}function dg(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=We(e),p=h.getUTCDay(),m=(p<d?7:0)+p-d;return h.setUTCDate(h.getUTCDate()-m),h.setUTCHours(0,0,0,0),h}function SM(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=We(e),d=u.getUTCFullYear(),h=Aa(),p=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(d+1,0,p),m.setUTCHours(0,0,0,0);var v=dg(m,t),x=new Date(0);x.setUTCFullYear(d,0,p),x.setUTCHours(0,0,0,0);var b=dg(x,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=b.getTime()?d:d-1}function l6(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),h=SM(e,t),p=new Date(0);p.setUTCFullYear(h,0,d),p.setUTCHours(0,0,0,0);var m=dg(p,t);return m}var c6=6048e5;function u6(e,t){Ne(1,arguments);var n=We(e),r=dg(n,t).getTime()-l6(n,t).getTime();return Math.round(r/c6)+1}function dt(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var ws={y:function(t,n){var r=t.getUTCFullYear(),o=r>0?r:1-r;return dt(n==="yy"?o%100:o,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):dt(r+1,2)},d:function(t,n){return dt(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return dt(t.getUTCHours()%12||12,n.length)},H:function(t,n){return dt(t.getUTCHours(),n.length)},m:function(t,n){return dt(t.getUTCMinutes(),n.length)},s:function(t,n){return dt(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,o=t.getUTCMilliseconds(),i=Math.floor(o*Math.pow(10,r-3));return dt(i,n.length)}},Zl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},d6={G:function(t,n,r){var o=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(o,{width:"abbreviated"});case"GGGGG":return r.era(o,{width:"narrow"});case"GGGG":default:return r.era(o,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var o=t.getUTCFullYear(),i=o>0?o:1-o;return r.ordinalNumber(i,{unit:"year"})}return ws.y(t,n)},Y:function(t,n,r,o){var i=SM(t,o),s=i>0?i:1-i;if(n==="YY"){var a=s%100;return dt(a,2)}return n==="Yo"?r.ordinalNumber(s,{unit:"year"}):dt(s,n.length)},R:function(t,n){var r=wM(t);return dt(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return dt(r,n.length)},Q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(o);case"QQ":return dt(o,2);case"Qo":return r.ordinalNumber(o,{unit:"quarter"});case"QQQ":return r.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(o,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(o);case"qq":return dt(o,2);case"qo":return r.ordinalNumber(o,{unit:"quarter"});case"qqq":return r.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(o,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,n,r){var o=t.getUTCMonth();switch(n){case"M":case"MM":return ws.M(t,n);case"Mo":return r.ordinalNumber(o+1,{unit:"month"});case"MMM":return r.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(o,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(o,{width:"wide",context:"formatting"})}},L:function(t,n,r){var o=t.getUTCMonth();switch(n){case"L":return String(o+1);case"LL":return dt(o+1,2);case"Lo":return r.ordinalNumber(o+1,{unit:"month"});case"LLL":return r.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(o,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(o,{width:"wide",context:"standalone"})}},w:function(t,n,r,o){var i=u6(t,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):dt(i,n.length)},I:function(t,n,r){var o=a6(t);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):dt(o,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):ws.d(t,n)},D:function(t,n,r){var o=o6(t);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):dt(o,n.length)},E:function(t,n,r){var o=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(o,{width:"short",context:"formatting"});case"EEEE":default:return r.day(o,{width:"wide",context:"formatting"})}},e:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(s);case"ee":return dt(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(s);case"cc":return dt(s,n.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var o=t.getUTCDay(),i=o===0?7:o;switch(n){case"i":return String(i);case"ii":return dt(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(o,{width:"short",context:"formatting"});case"iiii":default:return r.day(o,{width:"wide",context:"formatting"})}},a:function(t,n,r){var o=t.getUTCHours(),i=o/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var o=t.getUTCHours(),i;switch(o===12?i=Zl.noon:o===0?i=Zl.midnight:i=o/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var o=t.getUTCHours(),i;switch(o>=17?i=Zl.evening:o>=12?i=Zl.afternoon:o>=4?i=Zl.morning:i=Zl.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var o=t.getUTCHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return ws.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):ws.H(t,n)},K:function(t,n,r){var o=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):dt(o,n.length)},k:function(t,n,r){var o=t.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):dt(o,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):ws.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):ws.s(t,n)},S:function(t,n){return ws.S(t,n)},X:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();if(s===0)return"Z";switch(n){case"X":return CC(s);case"XXXX":case"XX":return Ga(s);case"XXXXX":case"XXX":default:return Ga(s,":")}},x:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"x":return CC(s);case"xxxx":case"xx":return Ga(s);case"xxxxx":case"xxx":default:return Ga(s,":")}},O:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+EC(s,":");case"OOOO":default:return"GMT"+Ga(s,":")}},z:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+EC(s,":");case"zzzz":default:return"GMT"+Ga(s,":")}},t:function(t,n,r,o){var i=o._originalDate||t,s=Math.floor(i.getTime()/1e3);return dt(s,n.length)},T:function(t,n,r,o){var i=o._originalDate||t,s=i.getTime();return dt(s,n.length)}};function EC(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(i===0)return n+String(o);var s=t;return n+String(o)+s+dt(i,2)}function CC(e,t){if(e%60===0){var n=e>0?"-":"+";return n+dt(Math.abs(e)/60,2)}return Ga(e,t)}function Ga(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e),i=dt(Math.floor(o/60),2),s=dt(o%60,2);return r+i+n+s}var _C=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},kM=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},f6=function(t,n){var r=t.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return _C(t,n);var s;switch(o){case"P":s=n.dateTime({width:"short"});break;case"PP":s=n.dateTime({width:"medium"});break;case"PPP":s=n.dateTime({width:"long"});break;case"PPPP":default:s=n.dateTime({width:"full"});break}return s.replace("{{date}}",_C(o,n)).replace("{{time}}",kM(i,n))},h6={p:kM,P:f6},p6=["D","DD"],m6=["YY","YYYY"];function g6(e){return p6.indexOf(e)!==-1}function v6(e){return m6.indexOf(e)!==-1}function PC(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var y6={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},x6=function(t,n,r){var o,i=y6[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:o+" ago":o};function mx(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var b6={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},w6={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},S6={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},k6={date:mx({formats:b6,defaultWidth:"full"}),time:mx({formats:w6,defaultWidth:"full"}),dateTime:mx({formats:S6,defaultWidth:"full"})},E6={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},C6=function(t,n,r,o){return E6[t]};function hd(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):i;o=e.formattingValues[s]||e.formattingValues[i]}else{var a=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[l]||e.values[a]}var c=e.argumentCallback?e.argumentCallback(t):t;return o[c]}}var _6={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},P6={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},N6={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},T6={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},O6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},M6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},j6=function(t,n){var r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},R6={ordinalNumber:j6,era:hd({values:_6,defaultWidth:"wide"}),quarter:hd({values:P6,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:hd({values:N6,defaultWidth:"wide"}),day:hd({values:T6,defaultWidth:"wide"}),dayPeriod:hd({values:O6,defaultWidth:"wide",formattingValues:M6,defaultFormattingWidth:"wide"})};function pd(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;var s=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?A6(a,function(d){return d.test(s)}):I6(a,function(d){return d.test(s)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(s.length);return{value:c,rest:u}}}function I6(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function A6(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function D6(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;var a=t.slice(o.length);return{value:s,rest:a}}}var L6=/^(\d+)(th|st|nd|rd)?/i,F6=/\d+/i,z6={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$6={any:[/^b/i,/^(a|c)/i]},B6={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},V6={any:[/1/i,/2/i,/3/i,/4/i]},U6={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},H6={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},W6={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},K6={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},G6={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},q6={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Y6={ordinalNumber:D6({matchPattern:L6,parsePattern:F6,valueCallback:function(t){return parseInt(t,10)}}),era:pd({matchPatterns:z6,defaultMatchWidth:"wide",parsePatterns:$6,defaultParseWidth:"any"}),quarter:pd({matchPatterns:B6,defaultMatchWidth:"wide",parsePatterns:V6,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:pd({matchPatterns:U6,defaultMatchWidth:"wide",parsePatterns:H6,defaultParseWidth:"any"}),day:pd({matchPatterns:W6,defaultMatchWidth:"wide",parsePatterns:K6,defaultParseWidth:"any"}),dayPeriod:pd({matchPatterns:G6,defaultMatchWidth:"any",parsePatterns:q6,defaultParseWidth:"any"})},EM={code:"en-US",formatDistance:x6,formatLong:k6,formatRelative:C6,localize:R6,match:Y6,options:{weekStartsOn:0,firstWeekContainsDate:1}},J6=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,X6=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Z6=/^'([^]*?)'?$/,Q6=/''/g,eB=/[a-zA-Z]/;function us(e,t,n){var r,o,i,s,a,l,c,u,d,h,p,m,v,x,b,w,S,C;Ne(2,arguments);var _=String(t),P=Aa(),O=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:P.locale)!==null&&r!==void 0?r:EM,M=vn((i=(s=(a=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:P.firstWeekContainsDate)!==null&&s!==void 0?s:(d=P.locale)===null||d===void 0||(h=d.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(M>=1&&M<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var I=vn((p=(m=(v=(x=n==null?void 0:n.weekStartsOn)!==null&&x!==void 0?x:n==null||(b=n.locale)===null||b===void 0||(w=b.options)===null||w===void 0?void 0:w.weekStartsOn)!==null&&v!==void 0?v:P.weekStartsOn)!==null&&m!==void 0?m:(S=P.locale)===null||S===void 0||(C=S.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&p!==void 0?p:0);if(!(I>=0&&I<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!O.localize)throw new RangeError("locale must contain localize property");if(!O.formatLong)throw new RangeError("locale must contain formatLong property");var L=We(e);if(!Z$(L))throw new RangeError("Invalid time value");var U=$f(L),$=n6(L,U),K={firstWeekContainsDate:M,weekStartsOn:I,locale:O,_originalDate:L},W=_.match(X6).map(function(B){var A=B[0];if(A==="p"||A==="P"){var R=h6[A];return R(B,O.formatLong)}return B}).join("").match(J6).map(function(B){if(B==="''")return"'";var A=B[0];if(A==="'")return tB(B);var R=d6[A];if(R)return!(n!=null&&n.useAdditionalWeekYearTokens)&&v6(B)&&PC(B,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&g6(B)&&PC(B,t,String(e)),R($,B,O.localize,K);if(A.match(eB))throw new RangeError("Format string contains an unescaped latin alphabet character `"+A+"`");return B}).join("");return W}function tB(e){var t=e.match(Z6);return t?t[1].replace(Q6,"'"):e}function nB(e){Ne(1,arguments);var t=We(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}var rB=6048e5;function oB(e){Ne(1,arguments);var t=We(e),n=_l(t).getTime()-G$(t).getTime();return Math.round(n/rB)+1}function iB(e){Ne(1,arguments);var t=We(e),n=t.getTime();return n}function sB(e){return Ne(1,arguments),Math.floor(iB(e)/1e3)}function aB(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=We(e),d=u.getFullYear(),h=Aa(),p=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setFullYear(d+1,0,p),m.setHours(0,0,0,0);var v=ui(m,t),x=new Date(0);x.setFullYear(d,0,p),x.setHours(0,0,0,0);var b=ui(x,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=b.getTime()?d:d-1}function lB(e,t){var n,r,o,i,s,a,l,c;Ne(1,arguments);var u=Aa(),d=vn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),h=aB(e,t),p=new Date(0);p.setFullYear(h,0,d),p.setHours(0,0,0,0);var m=ui(p,t);return m}var cB=6048e5;function uB(e,t){Ne(1,arguments);var n=We(e),r=ui(n,t).getTime()-lB(n,t).getTime();return Math.round(r/cB)+1}function dB(e){Ne(1,arguments);var t=We(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function fB(e,t){return Ne(1,arguments),e6(dB(e),hr(e),t)+1}function mb(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getTime()>r.getTime()}function CM(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getTime()<r.getTime()}function z1(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function hB(e,t){Ne(2,arguments);var n=We(e),r=We(t);return n.getFullYear()===r.getFullYear()}function gx(e,t){Ne(2,arguments);var n=vn(t);return Yn(e,-n)}function vx(e,t){Ne(2,arguments);var n=We(e),r=vn(t),o=n.getFullYear(),i=n.getDate(),s=new Date(0);s.setFullYear(o,r,15),s.setHours(0,0,0,0);var a=nB(s);return n.setMonth(r,Math.min(i,a)),n}function NC(e,t){Ne(2,arguments);var n=We(e),r=vn(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var je=function(){return je=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},je.apply(this,arguments)};function pB(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function _M(e,t,n){for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function zh(e){return e.mode==="multiple"}function $h(e){return e.mode==="range"}function Rv(e){return e.mode==="single"}var mB={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function gB(e,t){return us(e,"LLLL y",t)}function vB(e,t){return us(e,"d",t)}function yB(e,t){return us(e,"LLLL",t)}function xB(e){return"".concat(e)}function bB(e,t){return us(e,"cccccc",t)}function wB(e,t){return us(e,"yyyy",t)}var SB=Object.freeze({__proto__:null,formatCaption:gB,formatDay:vB,formatMonthCaption:yB,formatWeekNumber:xB,formatWeekdayName:bB,formatYearCaption:wB}),kB=function(e,t,n){return us(e,"do MMMM (EEEE)",n)},EB=function(){return"Month: "},CB=function(){return"Go to next month"},_B=function(){return"Go to previous month"},PB=function(e,t){return us(e,"cccc",t)},NB=function(e){return"Week n. ".concat(e)},TB=function(){return"Year: "},OB=Object.freeze({__proto__:null,labelDay:kB,labelMonthDropdown:EB,labelNext:CB,labelPrevious:_B,labelWeekNumber:NB,labelWeekday:PB,labelYearDropdown:TB});function MB(){var e="buttons",t=mB,n=EM,r={},o={},i=1,s={},a=new Date;return{captionLayout:e,classNames:t,formatters:SB,labels:OB,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:i,styles:s,today:a,mode:"default"}}function jB(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,s=e.toDate;return r?i=hr(r):t&&(i=new Date(t,0,1)),o?s=L1(o):n&&(s=new Date(n,11,31)),{fromDate:i?au(i):void 0,toDate:s?au(s):void 0}}var PM=g.createContext(void 0);function NM(e){var t,n=e.initialProps,r=MB(),o=jB(n),i=o.fromDate,s=o.toDate,a=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;a!=="buttons"&&(!i||!s)&&(a="buttons");var l;(Rv(n)||zh(n)||$h(n))&&(l=n.onSelect);var c=je(je(je({},r),n),{captionLayout:a,classNames:je(je({},r.classNames),n.classNames),components:je({},n.components),formatters:je(je({},r.formatters),n.formatters),fromDate:i,labels:je(je({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:je(je({},r.modifiers),n.modifiers),modifiersClassNames:je(je({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:je(je({},r.styles),n.styles),toDate:s});return f.jsx(PM.Provider,{value:c,children:e.children})}function bt(){var e=g.useContext(PM);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function TM(e){var t=bt(),n=t.locale,r=t.classNames,o=t.styles,i=t.formatters.formatCaption;return f.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function RB(e){return f.jsx("svg",je({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:f.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function OM(e){var t,n,r=e.onChange,o=e.value,i=e.children,s=e.caption,a=e.className,l=e.style,c=bt(),u=(n=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:RB;return f.jsxs("div",{className:a,style:l,children:[f.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),f.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:o,onChange:r,children:i}),f.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,f.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function IB(e){var t,n=bt(),r=n.fromDate,o=n.toDate,i=n.styles,s=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return f.jsx(f.Fragment,{});if(!o)return f.jsx(f.Fragment,{});var d=[];if(hB(r,o))for(var h=hr(r),p=r.getMonth();p<=o.getMonth();p++)d.push(vx(h,p));else for(var h=hr(new Date),p=0;p<=11;p++)d.push(vx(h,p));var m=function(x){var b=Number(x.target.value),w=vx(hr(e.displayMonth),b);e.onChange(w)},v=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:OM;return f.jsx(v,{name:"months","aria-label":u(),className:l.dropdown_month,style:i.dropdown_month,onChange:m,value:e.displayMonth.getMonth(),caption:a(e.displayMonth,{locale:s}),children:d.map(function(x){return f.jsx("option",{value:x.getMonth(),children:a(x,{locale:s})},x.getMonth())})})}function AB(e){var t,n=e.displayMonth,r=bt(),o=r.fromDate,i=r.toDate,s=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,h=[];if(!o)return f.jsx(f.Fragment,{});if(!i)return f.jsx(f.Fragment,{});for(var p=o.getFullYear(),m=i.getFullYear(),v=p;v<=m;v++)h.push(NC(t6(new Date),v));var x=function(w){var S=NC(hr(n),Number(w.target.value));e.onChange(S)},b=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:OM;return f.jsx(b,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:x,value:n.getFullYear(),caption:u(n,{locale:s}),children:h.map(function(w){return f.jsx("option",{value:w.getFullYear(),children:u(w,{locale:s})},w.getFullYear())})})}function DB(e,t){var n=g.useState(e),r=n[0],o=n[1],i=t===void 0?r:t;return[i,o]}function LB(e){var t=e.month,n=e.defaultMonth,r=e.today,o=t||n||r||new Date,i=e.toDate,s=e.fromDate,a=e.numberOfMonths,l=a===void 0?1:a;if(i&&Bf(i,o)<0){var c=-1*(l-1);o=Bo(i,c)}return s&&Bf(o,s)<0&&(o=s),hr(o)}function FB(){var e=bt(),t=LB(e),n=DB(t,e.month),r=n[0],o=n[1],i=function(s){var a;if(!e.disableNavigation){var l=hr(s);o(l),(a=e.onMonthChange)===null||a===void 0||a.call(e,l)}};return[r,i]}function zB(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=hr(e),i=hr(Bo(o,r)),s=Bf(i,o),a=[],l=0;l<s;l++){var c=Bo(o,l);a.push(c)}return n&&(a=a.reverse()),a}function $B(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=hr(e);if(!n)return Bo(a,s);var l=Bf(n,e);if(!(l<i))return Bo(a,s)}}function BB(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=hr(e);if(!n)return Bo(a,-s);var l=Bf(a,n);if(!(l<=0))return Bo(a,-s)}}var MM=g.createContext(void 0);function VB(e){var t=bt(),n=FB(),r=n[0],o=n[1],i=zB(r,t),s=$B(r,t),a=BB(r,t),l=function(d){return i.some(function(h){return z1(d,h)})},c=function(d,h){l(d)||(h&&CM(d,h)?o(Bo(d,1+t.numberOfMonths*-1)):o(d))},u={currentMonth:r,displayMonths:i,goToMonth:o,goToDate:c,previousMonth:a,nextMonth:s,isDateDisplayed:l};return f.jsx(MM.Provider,{value:u,children:e.children})}function Bh(){var e=g.useContext(MM);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function TC(e){var t,n=bt(),r=n.classNames,o=n.styles,i=n.components,s=Bh().goToMonth,a=function(u){s(Bo(u,e.displayIndex?-e.displayIndex:0))},l=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:TM,c=f.jsx(l,{id:e.id,displayMonth:e.displayMonth});return f.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[f.jsx("div",{className:r.vhidden,children:c}),f.jsx(IB,{onChange:a,displayMonth:e.displayMonth}),f.jsx(AB,{onChange:a,displayMonth:e.displayMonth})]})}function UB(e){return f.jsx("svg",je({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:f.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function HB(e){return f.jsx("svg",je({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:f.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var fg=g.forwardRef(function(e,t){var n=bt(),r=n.classNames,o=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var s=i.join(" "),a=je(je({},o.button_reset),o.button);return e.style&&Object.assign(a,e.style),f.jsx("button",je({},e,{ref:t,type:"button",className:s,style:a}))});function WB(e){var t,n,r=bt(),o=r.dir,i=r.locale,s=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!e.nextMonth&&!e.previousMonth)return f.jsx(f.Fragment,{});var h=c(e.previousMonth,{locale:i}),p=[s.nav_button,s.nav_button_previous].join(" "),m=u(e.nextMonth,{locale:i}),v=[s.nav_button,s.nav_button_next].join(" "),x=(t=d==null?void 0:d.IconRight)!==null&&t!==void 0?t:HB,b=(n=d==null?void 0:d.IconLeft)!==null&&n!==void 0?n:UB;return f.jsxs("div",{className:s.nav,style:a.nav,children:[!e.hidePrevious&&f.jsx(fg,{name:"previous-month","aria-label":h,className:p,style:a.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?f.jsx(x,{className:s.nav_icon,style:a.nav_icon}):f.jsx(b,{className:s.nav_icon,style:a.nav_icon})}),!e.hideNext&&f.jsx(fg,{name:"next-month","aria-label":m,className:v,style:a.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?f.jsx(b,{className:s.nav_icon,style:a.nav_icon}):f.jsx(x,{className:s.nav_icon,style:a.nav_icon})})]})}function OC(e){var t=bt().numberOfMonths,n=Bh(),r=n.previousMonth,o=n.nextMonth,i=n.goToMonth,s=n.displayMonths,a=s.findIndex(function(m){return z1(e.displayMonth,m)}),l=a===0,c=a===s.length-1,u=t>1&&(l||!c),d=t>1&&(c||!l),h=function(){r&&i(r)},p=function(){o&&i(o)};return f.jsx(WB,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:d,nextMonth:o,previousMonth:r,onPreviousClick:h,onNextClick:p})}function KB(e){var t,n=bt(),r=n.classNames,o=n.disableNavigation,i=n.styles,s=n.captionLayout,a=n.components,l=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:TM,c;return o?c=f.jsx(l,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?c=f.jsx(TC,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?c=f.jsxs(f.Fragment,{children:[f.jsx(TC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),f.jsx(OC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):c=f.jsxs(f.Fragment,{children:[f.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),f.jsx(OC,{displayMonth:e.displayMonth,id:e.id})]}),f.jsx("div",{className:r.caption,style:i.caption,children:c})}function GB(e){var t=bt(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?f.jsx("tfoot",{className:o,style:r.tfoot,children:f.jsx("tr",{children:f.jsx("td",{colSpan:8,children:n})})}):f.jsx(f.Fragment,{})}function qB(e,t,n){for(var r=n?_l(new Date):ui(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var s=Yn(r,i);o.push(s)}return o}function YB(){var e=bt(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,i=e.weekStartsOn,s=e.ISOWeek,a=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,c=qB(o,i,s);return f.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&f.jsx("td",{style:n.head_cell,className:t.head_cell}),c.map(function(u,d){return f.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":l(u,{locale:o}),children:a(u,{locale:o})},d)})]})}function JB(){var e,t=bt(),n=t.classNames,r=t.styles,o=t.components,i=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:YB;return f.jsx("thead",{style:r.head,className:n.head,children:f.jsx(i,{})})}function XB(e){var t=bt(),n=t.locale,r=t.formatters.formatDay;return f.jsx(f.Fragment,{children:r(e.date,{locale:n})})}var $1=g.createContext(void 0);function ZB(e){if(!zh(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return f.jsx($1.Provider,{value:t,children:e.children})}return f.jsx(QB,{initialProps:e.initialProps,children:e.children})}function QB(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,i=t.max,s=function(c,u,d){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,c,u,d);var m=!!(u.selected&&o&&(r==null?void 0:r.length)===o);if(!m){var v=!!(!u.selected&&i&&(r==null?void 0:r.length)===i);if(!v){var x=r?_M([],r):[];if(u.selected){var b=x.findIndex(function(w){return lr(c,w)});x.splice(b,1)}else x.push(c);(p=t.onSelect)===null||p===void 0||p.call(t,x,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=i&&r.length>i-1,d=r.some(function(h){return lr(h,c)});return!!(u&&!d)});var l={selected:r,onDayClick:s,modifiers:a};return f.jsx($1.Provider,{value:l,children:n})}function B1(){var e=g.useContext($1);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function e8(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?lr(o,e)&&lr(r,e)?void 0:lr(o,e)?{from:o,to:void 0}:lr(r,e)?void 0:mb(r,e)?{from:e,to:o}:{from:r,to:e}:o?mb(e,o)?{from:o,to:e}:{from:e,to:o}:r?CM(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var V1=g.createContext(void 0);function t8(e){if(!$h(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return f.jsx(V1.Provider,{value:t,children:e.children})}return f.jsx(n8,{initialProps:e.initialProps,children:e.children})}function n8(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},i=o.from,s=o.to,a=t.min,l=t.max,c=function(p,m,v){var x,b;(x=t.onDayClick)===null||x===void 0||x.call(t,p,m,v);var w=e8(p,r);(b=t.onSelect)===null||b===void 0||b.call(t,w,p,m,v)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],s?(u.range_end=[s],lr(i,s)||(u.range_middle=[{after:i,before:s}])):u.range_end=[i]):s&&(u.range_start=[s],u.range_end=[s]),a&&(i&&!s&&u.disabled.push({after:gx(i,a-1),before:Yn(i,a-1)}),i&&s&&u.disabled.push({after:i,before:Yn(i,a-1)}),!i&&s&&u.disabled.push({after:gx(s,a-1),before:Yn(s,a-1)})),l){if(i&&!s&&(u.disabled.push({before:Yn(i,-l+1)}),u.disabled.push({after:Yn(i,l-1)})),i&&s){var d=Bi(s,i)+1,h=l-d;u.disabled.push({before:gx(i,h)}),u.disabled.push({after:Yn(s,h)})}!i&&s&&(u.disabled.push({before:Yn(s,-l+1)}),u.disabled.push({after:Yn(s,l-1)}))}return f.jsx(V1.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function U1(){var e=g.useContext(V1);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function pm(e){return Array.isArray(e)?_M([],e):e!==void 0?[e]:[]}function r8(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=pm(o)}),t}var Vo;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Vo||(Vo={}));var o8=Vo.Selected,Ei=Vo.Disabled,i8=Vo.Hidden,s8=Vo.Today,yx=Vo.RangeEnd,xx=Vo.RangeMiddle,bx=Vo.RangeStart,a8=Vo.Outside;function l8(e,t,n){var r,o=(r={},r[o8]=pm(e.selected),r[Ei]=pm(e.disabled),r[i8]=pm(e.hidden),r[s8]=[e.today],r[yx]=[],r[xx]=[],r[bx]=[],r[a8]=[],r);return e.fromDate&&o[Ei].push({before:e.fromDate}),e.toDate&&o[Ei].push({after:e.toDate}),zh(e)?o[Ei]=o[Ei].concat(t.modifiers[Ei]):$h(e)&&(o[Ei]=o[Ei].concat(n.modifiers[Ei]),o[bx]=n.modifiers[bx],o[xx]=n.modifiers[xx],o[yx]=n.modifiers[yx]),o}var jM=g.createContext(void 0);function c8(e){var t=bt(),n=B1(),r=U1(),o=l8(t,n,r),i=r8(t.modifiers),s=je(je({},o),i);return f.jsx(jM.Provider,{value:s,children:e.children})}function RM(){var e=g.useContext(jM);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function u8(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function d8(e){return!!(e&&typeof e=="object"&&"from"in e)}function f8(e){return!!(e&&typeof e=="object"&&"after"in e)}function h8(e){return!!(e&&typeof e=="object"&&"before"in e)}function p8(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function m8(e,t){var n,r=t.from,o=t.to;if(r&&o){var i=Bi(o,r)<0;i&&(n=[o,r],r=n[0],o=n[1]);var s=Bi(e,r)>=0&&Bi(o,e)>=0;return s}return o?lr(o,e):r?lr(r,e):!1}function g8(e){return D1(e)}function v8(e){return Array.isArray(e)&&e.every(D1)}function y8(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(g8(n))return lr(e,n);if(v8(n))return n.includes(e);if(d8(n))return m8(e,n);if(p8(n))return n.dayOfWeek.includes(e.getDay());if(u8(n)){var r=Bi(n.before,e),o=Bi(n.after,e),i=r>0,s=o<0,a=mb(n.before,n.after);return a?s&&i:i||s}return f8(n)?Bi(e,n.after)>0:h8(n)?Bi(n.before,e)>0:typeof n=="function"?n(e):!1})}function H1(e,t,n){var r=Object.keys(t).reduce(function(i,s){var a=t[s];return y8(e,a)&&i.push(s),i},[]),o={};return r.forEach(function(i){return o[i]=!0}),n&&!z1(e,n)&&(o.outside=!0),o}function x8(e,t){for(var n=hr(e[0]),r=L1(e[e.length-1]),o,i,s=n;s<=r;){var a=H1(s,t),l=!a.disabled&&!a.hidden;if(!l){s=Yn(s,1);continue}if(a.selected)return s;a.today&&!i&&(i=s),o||(o=s),s=Yn(s,1)}return i||o}var b8=365;function IM(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,s=t.retry,a=s===void 0?{count:0,lastFocused:e}:s,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,h={day:Yn,week:pb,month:Bo,year:Y$,startOfWeek:function(x){return o.ISOWeek?_l(x):ui(x,{locale:d,weekStartsOn:l})},endOfWeek:function(x){return o.ISOWeek?bM(x):F1(x,{locale:d,weekStartsOn:l})}},p=h[n](e,r==="after"?1:-1);r==="before"&&c?p=J$([c,p]):r==="after"&&u&&(p=X$([u,p]));var m=!0;if(i){var v=H1(p,i);m=!v.disabled&&!v.hidden}return m?p:a.count>b8?a.lastFocused:IM(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:je(je({},a),{count:a.count+1})})}var AM=g.createContext(void 0);function w8(e){var t=Bh(),n=RM(),r=g.useState(),o=r[0],i=r[1],s=g.useState(),a=s[0],l=s[1],c=x8(t.displayMonths,n),u=o??(a&&t.isDateDisplayed(a))?a:c,d=function(){l(o),i(void 0)},h=function(x){i(x)},p=bt(),m=function(x,b){if(o){var w=IM(o,{moveBy:x,direction:b,context:p,modifiers:n});lr(o,w)||(t.goToDate(w,o),h(w))}},v={focusedDay:o,focusTarget:u,blur:d,focus:h,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return f.jsx(AM.Provider,{value:v,children:e.children})}function W1(){var e=g.useContext(AM);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function S8(e,t){var n=RM(),r=H1(e,n,t);return r}var K1=g.createContext(void 0);function k8(e){if(!Rv(e.initialProps)){var t={selected:void 0};return f.jsx(K1.Provider,{value:t,children:e.children})}return f.jsx(E8,{initialProps:e.initialProps,children:e.children})}function E8(e){var t=e.initialProps,n=e.children,r=function(i,s,a){var l,c,u;if((l=t.onDayClick)===null||l===void 0||l.call(t,i,s,a),s.selected&&!t.required){(c=t.onSelect)===null||c===void 0||c.call(t,void 0,i,s,a);return}(u=t.onSelect)===null||u===void 0||u.call(t,i,i,s,a)},o={selected:t.selected,onDayClick:r};return f.jsx(K1.Provider,{value:o,children:n})}function DM(){var e=g.useContext(K1);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function C8(e,t){var n=bt(),r=DM(),o=B1(),i=U1(),s=W1(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,d=s.blur,h=s.focus,p=s.focusMonthBefore,m=s.focusMonthAfter,v=s.focusYearBefore,x=s.focusYearAfter,b=s.focusStartOfWeek,w=s.focusEndOfWeek,S=function(R){var N,D,z,V;Rv(n)?(N=r.onDayClick)===null||N===void 0||N.call(r,e,t,R):zh(n)?(D=o.onDayClick)===null||D===void 0||D.call(o,e,t,R):$h(n)?(z=i.onDayClick)===null||z===void 0||z.call(i,e,t,R):(V=n.onDayClick)===null||V===void 0||V.call(n,e,t,R)},C=function(R){var N;h(e),(N=n.onDayFocus)===null||N===void 0||N.call(n,e,t,R)},_=function(R){var N;d(),(N=n.onDayBlur)===null||N===void 0||N.call(n,e,t,R)},P=function(R){var N;(N=n.onDayMouseEnter)===null||N===void 0||N.call(n,e,t,R)},O=function(R){var N;(N=n.onDayMouseLeave)===null||N===void 0||N.call(n,e,t,R)},M=function(R){var N;(N=n.onDayPointerEnter)===null||N===void 0||N.call(n,e,t,R)},I=function(R){var N;(N=n.onDayPointerLeave)===null||N===void 0||N.call(n,e,t,R)},L=function(R){var N;(N=n.onDayTouchCancel)===null||N===void 0||N.call(n,e,t,R)},U=function(R){var N;(N=n.onDayTouchEnd)===null||N===void 0||N.call(n,e,t,R)},$=function(R){var N;(N=n.onDayTouchMove)===null||N===void 0||N.call(n,e,t,R)},K=function(R){var N;(N=n.onDayTouchStart)===null||N===void 0||N.call(n,e,t,R)},W=function(R){var N;(N=n.onDayKeyUp)===null||N===void 0||N.call(n,e,t,R)},B=function(R){var N;switch(R.key){case"ArrowLeft":R.preventDefault(),R.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":R.preventDefault(),R.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":R.preventDefault(),R.stopPropagation(),c();break;case"ArrowUp":R.preventDefault(),R.stopPropagation(),u();break;case"PageUp":R.preventDefault(),R.stopPropagation(),R.shiftKey?v():p();break;case"PageDown":R.preventDefault(),R.stopPropagation(),R.shiftKey?x():m();break;case"Home":R.preventDefault(),R.stopPropagation(),b();break;case"End":R.preventDefault(),R.stopPropagation(),w();break}(N=n.onDayKeyDown)===null||N===void 0||N.call(n,e,t,R)},A={onClick:S,onFocus:C,onBlur:_,onKeyDown:B,onKeyUp:W,onMouseEnter:P,onMouseLeave:O,onPointerEnter:M,onPointerLeave:I,onTouchCancel:L,onTouchEnd:U,onTouchMove:$,onTouchStart:K};return A}function _8(){var e=bt(),t=DM(),n=B1(),r=U1(),o=Rv(e)?t.selected:zh(e)?n.selected:$h(e)?r.selected:void 0;return o}function P8(e){return Object.values(Vo).includes(e)}function N8(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var o=e.modifiersClassNames[r];if(o)n.push(o);else if(P8(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function T8(e,t){var n=je({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=je(je({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function O8(e,t,n){var r,o,i,s=bt(),a=W1(),l=S8(e,t),c=C8(e,l),u=_8(),d=!!(s.onDayClick||s.mode!=="default");g.useEffect(function(){var P;l.outside||a.focusedDay&&d&&lr(a.focusedDay,e)&&((P=n.current)===null||P===void 0||P.focus())},[a.focusedDay,e,n,d,l.outside]);var h=N8(s,l).join(" "),p=T8(s,l),m=!!(l.outside&&!s.showOutsideDays||l.hidden),v=(i=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&i!==void 0?i:XB,x=f.jsx(v,{date:e,displayMonth:t,activeModifiers:l}),b={style:p,className:h,children:x,role:"gridcell"},w=a.focusTarget&&lr(a.focusTarget,e)&&!l.outside,S=a.focusedDay&&lr(a.focusedDay,e),C=je(je(je({},b),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=S||w?0:-1,r)),c),_={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:C,divProps:b};return _}function M8(e){var t=g.useRef(null),n=O8(e.date,e.displayMonth,t);return n.isHidden?f.jsx("div",{role:"gridcell"}):n.isButton?f.jsx(fg,je({name:"day",ref:t},n.buttonProps)):f.jsx("div",je({},n.divProps))}function j8(e){var t=e.number,n=e.dates,r=bt(),o=r.onWeekNumberClick,i=r.styles,s=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(t),{locale:a});if(!o)return f.jsx("span",{className:s.weeknumber,style:i.weeknumber,children:u});var d=l(Number(t),{locale:a}),h=function(p){o(t,n,p)};return f.jsx(fg,{name:"week-number","aria-label":d,className:s.weeknumber,style:i.weeknumber,onClick:h,children:u})}function R8(e){var t,n,r=bt(),o=r.styles,i=r.classNames,s=r.showWeekNumber,a=r.components,l=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:M8,c=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:j8,u;return s&&(u=f.jsx("td",{className:i.cell,style:o.cell,children:f.jsx(c,{number:e.weekNumber,dates:e.dates})})),f.jsxs("tr",{className:i.row,style:o.row,children:[u,e.dates.map(function(d){return f.jsx("td",{className:i.cell,style:o.cell,role:"presentation",children:f.jsx(l,{displayMonth:e.displayMonth,date:d})},sB(d))})]})}function MC(e,t,n){for(var r=n!=null&&n.ISOWeek?bM(t):F1(t,n),o=n!=null&&n.ISOWeek?_l(e):ui(e,n),i=Bi(r,o),s=[],a=0;a<=i;a++)s.push(Yn(o,a));var l=s.reduce(function(c,u){var d=n!=null&&n.ISOWeek?oB(u):uB(u,n),h=c.find(function(p){return p.weekNumber===d});return h?(h.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function I8(e,t){var n=MC(hr(e),L1(e),t);if(t!=null&&t.useFixedWeeks){var r=fB(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],s=pb(i,6-r),a=MC(pb(i,1),s,t);n.push.apply(n,a)}}return n}function A8(e){var t,n,r,o=bt(),i=o.locale,s=o.classNames,a=o.styles,l=o.hideHead,c=o.fixedWeeks,u=o.components,d=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,m=I8(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:p,locale:i,weekStartsOn:d,firstWeekContainsDate:h}),v=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:JB,x=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:R8,b=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:GB;return f.jsxs("table",{id:e.id,className:s.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&f.jsx(v,{}),f.jsx("tbody",{className:s.tbody,style:a.tbody,children:m.map(function(w){return f.jsx(x,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),f.jsx(b,{displayMonth:e.displayMonth})]})}function D8(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var L8=D8()?g.useLayoutEffect:g.useEffect,wx=!1,F8=0;function jC(){return"react-day-picker-".concat(++F8)}function z8(e){var t,n=e??(wx?jC():null),r=g.useState(n),o=r[0],i=r[1];return L8(function(){o===null&&i(jC())},[]),g.useEffect(function(){wx===!1&&(wx=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function $8(e){var t,n,r=bt(),o=r.dir,i=r.classNames,s=r.styles,a=r.components,l=Bh().displayMonths,c=z8(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,d=[i.month],h=s.month,p=e.displayIndex===0,m=e.displayIndex===l.length-1,v=!p&&!m;o==="rtl"&&(t=[p,m],m=t[0],p=t[1]),p&&(d.push(i.caption_start),h=je(je({},h),s.caption_start)),m&&(d.push(i.caption_end),h=je(je({},h),s.caption_end)),v&&(d.push(i.caption_between),h=je(je({},h),s.caption_between));var x=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:KB;return f.jsxs("div",{className:d.join(" "),style:h,children:[f.jsx(x,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),f.jsx(A8,{id:u,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function B8(e){var t=bt(),n=t.classNames,r=t.styles;return f.jsx("div",{className:n.months,style:r.months,children:e.children})}function V8(e){var t,n,r=e.initialProps,o=bt(),i=W1(),s=Bh(),a=g.useState(!1),l=a[0],c=a[1];g.useEffect(function(){o.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),c(!0)))},[o.initialFocus,l,i.focus,i.focusTarget,i]);var u=[o.classNames.root,o.className];o.numberOfMonths>1&&u.push(o.classNames.multiple_months),o.showWeekNumber&&u.push(o.classNames.with_weeknumber);var d=je(je({},o.styles.root),o.style),h=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,v){var x;return je(je({},m),(x={},x[v]=r[v],x))},{}),p=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:B8;return f.jsx("div",je({className:u.join(" "),style:d,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:f.jsx(p,{children:s.displayMonths.map(function(m,v){return f.jsx($8,{displayIndex:v,displayMonth:m},v)})})}))}function U8(e){var t=e.children,n=pB(e,["children"]);return f.jsx(NM,{initialProps:n,children:f.jsx(VB,{children:f.jsx(k8,{initialProps:n,children:f.jsx(ZB,{initialProps:n,children:f.jsx(t8,{initialProps:n,children:f.jsx(c8,{children:f.jsx(w8,{children:t})})})})})})})}function H8(e){return f.jsx(U8,je({},e,{children:f.jsx(V8,{initialProps:e})}))}var Iv={},Av={};Av.byteLength=G8;Av.toByteArray=Y8;Av.fromByteArray=Z8;var oi=[],Jr=[],W8=typeof Uint8Array<"u"?Uint8Array:Array,Sx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ql=0,K8=Sx.length;Ql<K8;++Ql)oi[Ql]=Sx[Ql],Jr[Sx.charCodeAt(Ql)]=Ql;Jr[45]=62;Jr[95]=63;function LM(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function G8(e){var t=LM(e),n=t[0],r=t[1];return(n+r)*3/4-r}function q8(e,t,n){return(t+n)*3/4-n}function Y8(e){var t,n=LM(e),r=n[0],o=n[1],i=new W8(q8(e,r,o)),s=0,a=o>0?r-4:r,l;for(l=0;l<a;l+=4)t=Jr[e.charCodeAt(l)]<<18|Jr[e.charCodeAt(l+1)]<<12|Jr[e.charCodeAt(l+2)]<<6|Jr[e.charCodeAt(l+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return o===2&&(t=Jr[e.charCodeAt(l)]<<2|Jr[e.charCodeAt(l+1)]>>4,i[s++]=t&255),o===1&&(t=Jr[e.charCodeAt(l)]<<10|Jr[e.charCodeAt(l+1)]<<4|Jr[e.charCodeAt(l+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function J8(e){return oi[e>>18&63]+oi[e>>12&63]+oi[e>>6&63]+oi[e&63]}function X8(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),o.push(J8(r));return o.join("")}function Z8(e){for(var t,n=e.length,r=n%3,o=[],i=16383,s=0,a=n-r;s<a;s+=i)o.push(X8(e,s,s+i>a?a:s+i));return r===1?(t=e[n-1],o.push(oi[t>>2]+oi[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(oi[t>>10]+oi[t>>4&63]+oi[t<<2&63]+"=")),o.join("")}var G1={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */G1.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+e[t+d],d+=h,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=s*256+e[t+d],d+=h,u-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(p?-1:1)*s*Math.pow(2,i-r)};G1.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,u=(1<<c)-1,d=u>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,m=r?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(s++,l/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*l-1)*Math.pow(2,o),s=s+d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=a&255,p+=m,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+p]=s&255,p+=m,s/=256,c-=8);e[n+p-m]|=v*128};/*!
|
|
44
44
|
* The buffer module from node.js, for the browser.
|
|
45
45
|
*
|
|
46
46
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
47
47
|
* @license MIT
|
|
48
|
-
*/(function(e){var t=Av,n=G1,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50;var o=2147483647;e.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var T=new Uint8Array(1),k={foo:function(){return 42}};return Object.setPrototypeOf(k,Uint8Array.prototype),Object.setPrototypeOf(T,k),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(T){if(T>o)throw new RangeError('The value "'+T+'" is invalid for option "size"');var k=new Uint8Array(T);return Object.setPrototypeOf(k,a.prototype),k}function a(T,k,E){if(typeof T=="number"){if(typeof k=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(T)}return l(T,k,E)}a.poolSize=8192;function l(T,k,E){if(typeof T=="string")return h(T,k);if(ArrayBuffer.isView(T))return m(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(Ye(T,ArrayBuffer)||T&&Ye(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ye(T,SharedArrayBuffer)||T&&Ye(T.buffer,SharedArrayBuffer)))return v(T,k,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var j=T.valueOf&&T.valueOf();if(j!=null&&j!==T)return a.from(j,k,E);var F=x(T);if(F)return F;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),k,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,k,E){return l(T,k,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function u(T,k,E){return c(T),T<=0?s(T):k!==void 0?typeof E=="string"?s(T).fill(k,E):s(T).fill(k):s(T)}a.alloc=function(T,k,E){return u(T,k,E)};function d(T){return c(T),s(T<0?0:b(T)|0)}a.allocUnsafe=function(T){return d(T)},a.allocUnsafeSlow=function(T){return d(T)};function h(T,k){if((typeof k!="string"||k==="")&&(k="utf8"),!a.isEncoding(k))throw new TypeError("Unknown encoding: "+k);var E=S(T,k)|0,j=s(E),F=j.write(T,k);return F!==E&&(j=j.slice(0,F)),j}function p(T){for(var k=T.length<0?0:b(T.length)|0,E=s(k),j=0;j<k;j+=1)E[j]=T[j]&255;return E}function m(T){if(Ye(T,Uint8Array)){var k=new Uint8Array(T);return v(k.buffer,k.byteOffset,k.byteLength)}return p(T)}function v(T,k,E){if(k<0||T.byteLength<k)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<k+(E||0))throw new RangeError('"length" is outside of buffer bounds');var j;return k===void 0&&E===void 0?j=new Uint8Array(T):E===void 0?j=new Uint8Array(T,k):j=new Uint8Array(T,k,E),Object.setPrototypeOf(j,a.prototype),j}function x(T){if(a.isBuffer(T)){var k=b(T.length)|0,E=s(k);return E.length===0||T.copy(E,0,0,k),E}if(T.length!==void 0)return typeof T.length!="number"||pt(T.length)?s(0):p(T);if(T.type==="Buffer"&&Array.isArray(T.data))return p(T.data)}function b(T){if(T>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return T|0}function w(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==a.prototype},a.compare=function(k,E){if(Ye(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),Ye(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(k)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===E)return 0;for(var j=k.length,F=E.length,J=0,ee=Math.min(j,F);J<ee;++J)if(k[J]!==E[J]){j=k[J],F=E[J];break}return j<F?-1:F<j?1:0},a.isEncoding=function(k){switch(String(k).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(k,E){if(!Array.isArray(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return a.alloc(0);var j;if(E===void 0)for(E=0,j=0;j<k.length;++j)E+=k[j].length;var F=a.allocUnsafe(E),J=0;for(j=0;j<k.length;++j){var ee=k[j];if(Ye(ee,Uint8Array))J+ee.length>F.length?a.from(ee).copy(F,J):Uint8Array.prototype.set.call(F,ee,J);else if(a.isBuffer(ee))ee.copy(F,J);else throw new TypeError('"list" argument must be an Array of Buffers');J+=ee.length}return F};function S(T,k){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||Ye(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&E===0)return 0;for(var F=!1;;)switch(k){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return ce(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return Ie(T).length;default:if(F)return j?-1:ce(T).length;k=(""+k).toLowerCase(),F=!0}}a.byteLength=S;function C(T,k,E){var j=!1;if((k===void 0||k<0)&&(k=0),k>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,k>>>=0,E<=k))return"";for(T||(T="utf8");;)switch(T){case"hex":return D(this,k,E);case"utf8":case"utf-8":return W(this,k,E);case"ascii":return R(this,k,E);case"latin1":case"binary":return N(this,k,E);case"base64":return K(this,k,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,k,E);default:if(j)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),j=!0}}a.prototype._isBuffer=!0;function _(T,k,E){var j=T[k];T[k]=T[E],T[E]=j}a.prototype.swap16=function(){var k=this.length;if(k%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<k;E+=2)_(this,E,E+1);return this},a.prototype.swap32=function(){var k=this.length;if(k%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<k;E+=4)_(this,E,E+3),_(this,E+1,E+2);return this},a.prototype.swap64=function(){var k=this.length;if(k%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<k;E+=8)_(this,E,E+7),_(this,E+1,E+6),_(this,E+2,E+5),_(this,E+3,E+4);return this},a.prototype.toString=function(){var k=this.length;return k===0?"":arguments.length===0?W(this,0,k):C.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(k){if(!a.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k?!0:a.compare(this,k)===0},a.prototype.inspect=function(){var k="",E=e.INSPECT_MAX_BYTES;return k=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(k+=" ... "),"<Buffer "+k+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(k,E,j,F,J){if(Ye(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),!a.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(E===void 0&&(E=0),j===void 0&&(j=k?k.length:0),F===void 0&&(F=0),J===void 0&&(J=this.length),E<0||j>k.length||F<0||J>this.length)throw new RangeError("out of range index");if(F>=J&&E>=j)return 0;if(F>=J)return-1;if(E>=j)return 1;if(E>>>=0,j>>>=0,F>>>=0,J>>>=0,this===k)return 0;for(var ee=J-F,Je=j-E,st=Math.min(ee,Je),yt=this.slice(F,J),ln=k.slice(E,j),ct=0;ct<st;++ct)if(yt[ct]!==ln[ct]){ee=yt[ct],Je=ln[ct];break}return ee<Je?-1:Je<ee?1:0};function P(T,k,E,j,F){if(T.length===0)return-1;if(typeof E=="string"?(j=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,pt(E)&&(E=F?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(F)return-1;E=T.length-1}else if(E<0)if(F)E=0;else return-1;if(typeof k=="string"&&(k=a.from(k,j)),a.isBuffer(k))return k.length===0?-1:O(T,k,E,j,F);if(typeof k=="number")return k=k&255,typeof Uint8Array.prototype.indexOf=="function"?F?Uint8Array.prototype.indexOf.call(T,k,E):Uint8Array.prototype.lastIndexOf.call(T,k,E):O(T,[k],E,j,F);throw new TypeError("val must be string, number or Buffer")}function O(T,k,E,j,F){var J=1,ee=T.length,Je=k.length;if(j!==void 0&&(j=String(j).toLowerCase(),j==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(T.length<2||k.length<2)return-1;J=2,ee/=2,Je/=2,E/=2}function st(ps,ed){return J===1?ps[ed]:ps.readUInt16BE(ed*J)}var yt;if(F){var ln=-1;for(yt=E;yt<ee;yt++)if(st(T,yt)===st(k,ln===-1?0:yt-ln)){if(ln===-1&&(ln=yt),yt-ln+1===Je)return ln*J}else ln!==-1&&(yt-=yt-ln),ln=-1}else for(E+Je>ee&&(E=ee-Je),yt=E;yt>=0;yt--){for(var ct=!0,yo=0;yo<Je;yo++)if(st(T,yt+yo)!==st(k,yo)){ct=!1;break}if(ct)return yt}return-1}a.prototype.includes=function(k,E,j){return this.indexOf(k,E,j)!==-1},a.prototype.indexOf=function(k,E,j){return P(this,k,E,j,!0)},a.prototype.lastIndexOf=function(k,E,j){return P(this,k,E,j,!1)};function M(T,k,E,j){E=Number(E)||0;var F=T.length-E;j?(j=Number(j),j>F&&(j=F)):j=F;var J=k.length;j>J/2&&(j=J/2);for(var ee=0;ee<j;++ee){var Je=parseInt(k.substr(ee*2,2),16);if(pt(Je))return ee;T[E+ee]=Je}return ee}function I(T,k,E,j){return Ce(ce(k,T.length-E),T,E,j)}function L(T,k,E,j){return Ce(Ee(k),T,E,j)}function U(T,k,E,j){return Ce(Ie(k),T,E,j)}function $(T,k,E,j){return Ce(fe(k,T.length-E),T,E,j)}a.prototype.write=function(k,E,j,F){if(E===void 0)F="utf8",j=this.length,E=0;else if(j===void 0&&typeof E=="string")F=E,j=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(j)?(j=j>>>0,F===void 0&&(F="utf8")):(F=j,j=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var J=this.length-E;if((j===void 0||j>J)&&(j=J),k.length>0&&(j<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");for(var ee=!1;;)switch(F){case"hex":return M(this,k,E,j);case"utf8":case"utf-8":return I(this,k,E,j);case"ascii":case"latin1":case"binary":return L(this,k,E,j);case"base64":return U(this,k,E,j);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,k,E,j);default:if(ee)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),ee=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function K(T,k,E){return k===0&&E===T.length?t.fromByteArray(T):t.fromByteArray(T.slice(k,E))}function W(T,k,E){E=Math.min(T.length,E);for(var j=[],F=k;F<E;){var J=T[F],ee=null,Je=J>239?4:J>223?3:J>191?2:1;if(F+Je<=E){var st,yt,ln,ct;switch(Je){case 1:J<128&&(ee=J);break;case 2:st=T[F+1],(st&192)===128&&(ct=(J&31)<<6|st&63,ct>127&&(ee=ct));break;case 3:st=T[F+1],yt=T[F+2],(st&192)===128&&(yt&192)===128&&(ct=(J&15)<<12|(st&63)<<6|yt&63,ct>2047&&(ct<55296||ct>57343)&&(ee=ct));break;case 4:st=T[F+1],yt=T[F+2],ln=T[F+3],(st&192)===128&&(yt&192)===128&&(ln&192)===128&&(ct=(J&15)<<18|(st&63)<<12|(yt&63)<<6|ln&63,ct>65535&&ct<1114112&&(ee=ct))}}ee===null?(ee=65533,Je=1):ee>65535&&(ee-=65536,j.push(ee>>>10&1023|55296),ee=56320|ee&1023),j.push(ee),F+=Je}return A(j)}var B=4096;function A(T){var k=T.length;if(k<=B)return String.fromCharCode.apply(String,T);for(var E="",j=0;j<k;)E+=String.fromCharCode.apply(String,T.slice(j,j+=B));return E}function R(T,k,E){var j="";E=Math.min(T.length,E);for(var F=k;F<E;++F)j+=String.fromCharCode(T[F]&127);return j}function N(T,k,E){var j="";E=Math.min(T.length,E);for(var F=k;F<E;++F)j+=String.fromCharCode(T[F]);return j}function D(T,k,E){var j=T.length;(!k||k<0)&&(k=0),(!E||E<0||E>j)&&(E=j);for(var F="",J=k;J<E;++J)F+=Wt[T[J]];return F}function z(T,k,E){for(var j=T.slice(k,E),F="",J=0;J<j.length-1;J+=2)F+=String.fromCharCode(j[J]+j[J+1]*256);return F}a.prototype.slice=function(k,E){var j=this.length;k=~~k,E=E===void 0?j:~~E,k<0?(k+=j,k<0&&(k=0)):k>j&&(k=j),E<0?(E+=j,E<0&&(E=0)):E>j&&(E=j),E<k&&(E=k);var F=this.subarray(k,E);return Object.setPrototypeOf(F,a.prototype),F};function V(T,k,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+k>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=this[k],J=1,ee=0;++ee<E&&(J*=256);)F+=this[k+ee]*J;return F},a.prototype.readUintBE=a.prototype.readUIntBE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=this[k+--E],J=1;E>0&&(J*=256);)F+=this[k+--E]*J;return F},a.prototype.readUint8=a.prototype.readUInt8=function(k,E){return k=k>>>0,E||V(k,1,this.length),this[k]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(k,E){return k=k>>>0,E||V(k,2,this.length),this[k]|this[k+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(k,E){return k=k>>>0,E||V(k,2,this.length),this[k]<<8|this[k+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(k,E){return k=k>>>0,E||V(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+this[k+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]*16777216+(this[k+1]<<16|this[k+2]<<8|this[k+3])},a.prototype.readIntLE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=this[k],J=1,ee=0;++ee<E&&(J*=256);)F+=this[k+ee]*J;return J*=128,F>=J&&(F-=Math.pow(2,8*E)),F},a.prototype.readIntBE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=E,J=1,ee=this[k+--F];F>0&&(J*=256);)ee+=this[k+--F]*J;return J*=128,ee>=J&&(ee-=Math.pow(2,8*E)),ee},a.prototype.readInt8=function(k,E){return k=k>>>0,E||V(k,1,this.length),this[k]&128?(255-this[k]+1)*-1:this[k]},a.prototype.readInt16LE=function(k,E){k=k>>>0,E||V(k,2,this.length);var j=this[k]|this[k+1]<<8;return j&32768?j|4294901760:j},a.prototype.readInt16BE=function(k,E){k=k>>>0,E||V(k,2,this.length);var j=this[k+1]|this[k]<<8;return j&32768?j|4294901760:j},a.prototype.readInt32LE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},a.prototype.readInt32BE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},a.prototype.readFloatLE=function(k,E){return k=k>>>0,E||V(k,4,this.length),n.read(this,k,!0,23,4)},a.prototype.readFloatBE=function(k,E){return k=k>>>0,E||V(k,4,this.length),n.read(this,k,!1,23,4)},a.prototype.readDoubleLE=function(k,E){return k=k>>>0,E||V(k,8,this.length),n.read(this,k,!0,52,8)},a.prototype.readDoubleBE=function(k,E){return k=k>>>0,E||V(k,8,this.length),n.read(this,k,!1,52,8)};function G(T,k,E,j,F,J){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(k>F||k<J)throw new RangeError('"value" argument is out of bounds');if(E+j>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(k,E,j,F){if(k=+k,E=E>>>0,j=j>>>0,!F){var J=Math.pow(2,8*j)-1;G(this,k,E,j,J,0)}var ee=1,Je=0;for(this[E]=k&255;++Je<j&&(ee*=256);)this[E+Je]=k/ee&255;return E+j},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(k,E,j,F){if(k=+k,E=E>>>0,j=j>>>0,!F){var J=Math.pow(2,8*j)-1;G(this,k,E,j,J,0)}var ee=j-1,Je=1;for(this[E+ee]=k&255;--ee>=0&&(Je*=256);)this[E+ee]=k/Je&255;return E+j},a.prototype.writeUint8=a.prototype.writeUInt8=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,1,255,0),this[E]=k&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,65535,0),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,65535,0),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,4294967295,0),this[E+3]=k>>>24,this[E+2]=k>>>16,this[E+1]=k>>>8,this[E]=k&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,4294967295,0),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4},a.prototype.writeIntLE=function(k,E,j,F){if(k=+k,E=E>>>0,!F){var J=Math.pow(2,8*j-1);G(this,k,E,j,J-1,-J)}var ee=0,Je=1,st=0;for(this[E]=k&255;++ee<j&&(Je*=256);)k<0&&st===0&&this[E+ee-1]!==0&&(st=1),this[E+ee]=(k/Je>>0)-st&255;return E+j},a.prototype.writeIntBE=function(k,E,j,F){if(k=+k,E=E>>>0,!F){var J=Math.pow(2,8*j-1);G(this,k,E,j,J-1,-J)}var ee=j-1,Je=1,st=0;for(this[E+ee]=k&255;--ee>=0&&(Je*=256);)k<0&&st===0&&this[E+ee+1]!==0&&(st=1),this[E+ee]=(k/Je>>0)-st&255;return E+j},a.prototype.writeInt8=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,1,127,-128),k<0&&(k=255+k+1),this[E]=k&255,E+1},a.prototype.writeInt16LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,32767,-32768),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeInt16BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,32767,-32768),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeInt32LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,2147483647,-2147483648),this[E]=k&255,this[E+1]=k>>>8,this[E+2]=k>>>16,this[E+3]=k>>>24,E+4},a.prototype.writeInt32BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4};function _e(T,k,E,j,F,J){if(E+j>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function Se(T,k,E,j,F){return k=+k,E=E>>>0,F||_e(T,k,E,4),n.write(T,k,E,j,23,4),E+4}a.prototype.writeFloatLE=function(k,E,j){return Se(this,k,E,!0,j)},a.prototype.writeFloatBE=function(k,E,j){return Se(this,k,E,!1,j)};function Be(T,k,E,j,F){return k=+k,E=E>>>0,F||_e(T,k,E,8),n.write(T,k,E,j,52,8),E+8}a.prototype.writeDoubleLE=function(k,E,j){return Be(this,k,E,!0,j)},a.prototype.writeDoubleBE=function(k,E,j){return Be(this,k,E,!1,j)},a.prototype.copy=function(k,E,j,F){if(!a.isBuffer(k))throw new TypeError("argument should be a Buffer");if(j||(j=0),!F&&F!==0&&(F=this.length),E>=k.length&&(E=k.length),E||(E=0),F>0&&F<j&&(F=j),F===j||k.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(j<0||j>=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),k.length-E<F-j&&(F=k.length-E+j);var J=F-j;return this===k&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,j,F):Uint8Array.prototype.set.call(k,this.subarray(j,F),E),J},a.prototype.fill=function(k,E,j,F){if(typeof k=="string"){if(typeof E=="string"?(F=E,E=0,j=this.length):typeof j=="string"&&(F=j,j=this.length),F!==void 0&&typeof F!="string")throw new TypeError("encoding must be a string");if(typeof F=="string"&&!a.isEncoding(F))throw new TypeError("Unknown encoding: "+F);if(k.length===1){var J=k.charCodeAt(0);(F==="utf8"&&J<128||F==="latin1")&&(k=J)}}else typeof k=="number"?k=k&255:typeof k=="boolean"&&(k=Number(k));if(E<0||this.length<E||this.length<j)throw new RangeError("Out of range index");if(j<=E)return this;E=E>>>0,j=j===void 0?this.length:j>>>0,k||(k=0);var ee;if(typeof k=="number")for(ee=E;ee<j;++ee)this[ee]=k;else{var Je=a.isBuffer(k)?k:a.from(k,F),st=Je.length;if(st===0)throw new TypeError('The value "'+k+'" is invalid for argument "value"');for(ee=0;ee<j-E;++ee)this[ee+E]=Je[ee%st]}return this};var Z=/[^+/0-9A-Za-z-_]/g;function Y(T){if(T=T.split("=")[0],T=T.trim().replace(Z,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function ce(T,k){k=k||1/0;for(var E,j=T.length,F=null,J=[],ee=0;ee<j;++ee){if(E=T.charCodeAt(ee),E>55295&&E<57344){if(!F){if(E>56319){(k-=3)>-1&&J.push(239,191,189);continue}else if(ee+1===j){(k-=3)>-1&&J.push(239,191,189);continue}F=E;continue}if(E<56320){(k-=3)>-1&&J.push(239,191,189),F=E;continue}E=(F-55296<<10|E-56320)+65536}else F&&(k-=3)>-1&&J.push(239,191,189);if(F=null,E<128){if((k-=1)<0)break;J.push(E)}else if(E<2048){if((k-=2)<0)break;J.push(E>>6|192,E&63|128)}else if(E<65536){if((k-=3)<0)break;J.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((k-=4)<0)break;J.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return J}function Ee(T){for(var k=[],E=0;E<T.length;++E)k.push(T.charCodeAt(E)&255);return k}function fe(T,k){for(var E,j,F,J=[],ee=0;ee<T.length&&!((k-=2)<0);++ee)E=T.charCodeAt(ee),j=E>>8,F=E%256,J.push(F),J.push(j);return J}function Ie(T){return t.toByteArray(Y(T))}function Ce(T,k,E,j){for(var F=0;F<j&&!(F+E>=k.length||F>=T.length);++F)k[F+E]=T[F];return F}function Ye(T,k){return T instanceof k||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===k.name}function pt(T){return T!==T}var Wt=function(){for(var T="0123456789abcdef",k=new Array(256),E=0;E<16;++E)for(var j=E*16,F=0;F<16;++F)k[j+F]=T[E]+T[F];return k}()})(Iv);var Qe;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Qe||(Qe={}));var gb;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(gb||(gb={}));const he=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bs=e=>{switch(typeof e){case"undefined":return he.undefined;case"string":return he.string;case"number":return isNaN(e)?he.nan:he.number;case"boolean":return he.boolean;case"function":return he.function;case"bigint":return he.bigint;case"symbol":return he.symbol;case"object":return Array.isArray(e)?he.array:e===null?he.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?he.promise:typeof Map<"u"&&e instanceof Map?he.map:typeof Set<"u"&&e instanceof Set?he.set:typeof Date<"u"&&e instanceof Date?he.date:he.object;default:return he.unknown}},Q=Qe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Q8=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ir extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof Ir))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ir.create=e=>new Ir(e);const lu=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===he.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Qe.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qe.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qe.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${Qe.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Qe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,Qe.assertNever(e)}return{message:n}};let FM=lu;function eV(e){FM=e}function hg(){return FM}const pg=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},tV=[];function de(e,t){const n=hg(),r=pg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===lu?void 0:lu].filter(o=>!!o)});e.common.issues.push(r)}class Hn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Re;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return Hn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Re;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const Re=Object.freeze({status:"aborted"}),jc=e=>({status:"dirty",value:e}),Zn=e=>({status:"valid",value:e}),vb=e=>e.status==="aborted",yb=e=>e.status==="dirty",Vf=e=>e.status==="valid",Uf=e=>typeof Promise<"u"&&e instanceof Promise;function mg(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function zM(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var be;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(be||(be={}));var Pd,Nd;class di{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const RC=(e,t)=>{if(Vf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ir(e.common.issues);return this._error=n,this._error}}};function Fe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{var l,c;const{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class Ue{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Bs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Hn,ctx:{common:t.parent.common,data:t.data,parsedType:Bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Uf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bs(t)},i=this._parseSync({data:t,path:o.path,parent:o});return RC(o,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bs(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Uf(o)?o:Promise.resolve(o));return RC(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),a=()=>i.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Uo({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return li.create(this,this._def)}nullable(){return wa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fo.create(this,this._def)}promise(){return uu.create(this,this._def)}or(t){return Gf.create([this,t],this._def)}and(t){return qf.create(this,t,this._def)}transform(t){return new Uo({...Fe(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Qf({...Fe(this._def),innerType:this,defaultValue:n,typeName:Me.ZodDefault})}brand(){return new q1({typeName:Me.ZodBranded,type:this,...Fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new eh({...Fe(this._def),innerType:this,catchValue:n,typeName:Me.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Vh.create(this,t)}readonly(){return th.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nV=/^c[^\s-]{8,}$/i,rV=/^[0-9a-z]+$/,oV=/^[0-9A-HJKMNP-TV-Z]{26}$/,iV=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,sV=/^[a-z0-9_-]{21}$/i,aV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,lV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kx;const uV=/^(?:(?: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])$/,dV=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,fV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$M="((\\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])))",hV=new RegExp(`^${$M}$`);function BM(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function pV(e){return new RegExp(`^${BM(e)}$`)}function VM(e){let t=`${$M}T${BM(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function mV(e,t){return!!((t==="v4"||!t)&&uV.test(e)||(t==="v6"||!t)&&dV.test(e))}class Ro extends Ue{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==he.string){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.string,received:i.parsedType}),Re}const r=new Hn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?de(o,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&de(o,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")lV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"email",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")kx||(kx=new RegExp(cV,"u")),kx.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"emoji",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")iV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"uuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")sV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"nanoid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")nV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")rV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid2",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")oV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ulid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),de(o,{validation:"url",code:Q.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"regex",code:Q.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?VM(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?hV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?pV(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?aV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"duration",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?mV(t.data,i.version)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ip",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"base64",code:Q.invalid_string,message:i.message}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:Q.invalid_string,...be.errToObj(r)})}_addCheck(t){return new Ro({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...be.errToObj(t)})}url(t){return this._addCheck({kind:"url",...be.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...be.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...be.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...be.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...be.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...be.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...be.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...be.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...be.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...be.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...be.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...be.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...be.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...be.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...be.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...be.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...be.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...be.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...be.errToObj(n)})}nonempty(t){return this.min(1,be.errToObj(t))}trim(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ro.create=e=>{var t;return new Ro({checks:[],typeName:Me.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Fe(e)})};function gV(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),s=parseInt(t.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class ya extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==he.number){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.number,received:i.parsedType}),Re}let r;const o=new Hn;for(const i of this._def.checks)i.kind==="int"?Qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:Q.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?gV(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_finite,message:i.message}),o.dirty()):Qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,o){return new ya({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(o)}]})}_addCheck(t){return new ya({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:be.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:be.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:be.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:be.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Qe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}ya.create=e=>new ya({checks:[],typeName:Me.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class xa extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==he.bigint){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.bigint,received:i.parsedType}),Re}let r;const o=new Hn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,o){return new xa({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(o)}]})}_addCheck(t){return new xa({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}xa.create=e=>{var t;return new xa({checks:[],typeName:Me.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Fe(e)})};class Hf extends Ue{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==he.boolean){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.boolean,received:r.parsedType}),Re}return Zn(t.data)}}Hf.create=e=>new Hf({typeName:Me.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class Pl extends Ue{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==he.date){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.date,received:i.parsedType}),Re}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_date}),Re}const r=new Hn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Pl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:be.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:be.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Pl.create=e=>new Pl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Me.ZodDate,...Fe(e)});class gg extends Ue{_parse(t){if(this._getType(t)!==he.symbol){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.symbol,received:r.parsedType}),Re}return Zn(t.data)}}gg.create=e=>new gg({typeName:Me.ZodSymbol,...Fe(e)});class Wf extends Ue{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.undefined,received:r.parsedType}),Re}return Zn(t.data)}}Wf.create=e=>new Wf({typeName:Me.ZodUndefined,...Fe(e)});class Kf extends Ue{_parse(t){if(this._getType(t)!==he.null){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.null,received:r.parsedType}),Re}return Zn(t.data)}}Kf.create=e=>new Kf({typeName:Me.ZodNull,...Fe(e)});class cu extends Ue{constructor(){super(...arguments),this._any=!0}_parse(t){return Zn(t.data)}}cu.create=e=>new cu({typeName:Me.ZodAny,...Fe(e)});class dl extends Ue{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Zn(t.data)}}dl.create=e=>new dl({typeName:Me.ZodUnknown,...Fe(e)});class ts extends Ue{_parse(t){const n=this._getOrReturnCtx(t);return de(n,{code:Q.invalid_type,expected:he.never,received:n.parsedType}),Re}}ts.create=e=>new ts({typeName:Me.ZodNever,...Fe(e)});class vg extends Ue{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.void,received:r.parsedType}),Re}return Zn(t.data)}}vg.create=e=>new vg({typeName:Me.ZodVoid,...Fe(e)});class Fo extends Ue{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==he.array)return de(n,{code:Q.invalid_type,expected:he.array,received:n.parsedType}),Re;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(de(n,{code:s?Q.too_big:Q.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(de(n,{code:Q.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(de(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new di(n,s,n.path,a)))).then(s=>Hn.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new di(n,s,n.path,a)));return Hn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Fo({...this._def,minLength:{value:t,message:be.toString(n)}})}max(t,n){return new Fo({...this._def,maxLength:{value:t,message:be.toString(n)}})}length(t,n){return new Fo({...this._def,exactLength:{value:t,message:be.toString(n)}})}nonempty(t){return this.min(1,t)}}Fo.create=(e,t)=>new Fo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...Fe(t)});function dc(e){if(e instanceof Mt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=li.create(dc(r))}return new Mt({...e._def,shape:()=>t})}else return e instanceof Fo?new Fo({...e._def,type:dc(e.element)}):e instanceof li?li.create(dc(e.unwrap())):e instanceof wa?wa.create(dc(e.unwrap())):e instanceof fi?fi.create(e.items.map(t=>dc(t))):e}class Mt extends Ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Qe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==he.object){const c=this._getOrReturnCtx(t);return de(c,{code:Q.invalid_type,expected:he.object,received:c.parsedType}),Re}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ts&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new di(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof ts){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(de(o,{code:Q.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new di(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Hn.mergeObjectSync(r,c)):Hn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return be.errToObj,new Mt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,s,a;const l=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=be.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Mt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Mt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Me.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Mt({...this._def,catchall:t})}pick(t){const n={};return Qe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}omit(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}deepPartial(){return dc(this)}partial(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Mt({...this._def,shape:()=>n})}required(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof li;)i=i._def.innerType;n[r]=i}}),new Mt({...this._def,shape:()=>n})}keyof(){return UM(Qe.objectKeys(this.shape))}}Mt.create=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strip",catchall:ts.create(),typeName:Me.ZodObject,...Fe(t)});Mt.strictCreate=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strict",catchall:ts.create(),typeName:Me.ZodObject,...Fe(t)});Mt.lazycreate=(e,t)=>new Mt({shape:e,unknownKeys:"strip",catchall:ts.create(),typeName:Me.ZodObject,...Fe(t)});class Gf extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new Ir(a.ctx.common.issues));return de(n,{code:Q.invalid_union,unionErrors:s}),Re}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new Ir(l));return de(n,{code:Q.invalid_union,unionErrors:a}),Re}}get options(){return this._def.options}}Gf.create=(e,t)=>new Gf({options:e,typeName:Me.ZodUnion,...Fe(t)});const Ti=e=>e instanceof Jf?Ti(e.schema):e instanceof Uo?Ti(e.innerType()):e instanceof Xf?[e.value]:e instanceof ba?e.options:e instanceof Zf?Qe.objectValues(e.enum):e instanceof Qf?Ti(e._def.innerType):e instanceof Wf?[void 0]:e instanceof Kf?[null]:e instanceof li?[void 0,...Ti(e.unwrap())]:e instanceof wa?[null,...Ti(e.unwrap())]:e instanceof q1||e instanceof th?Ti(e.unwrap()):e instanceof eh?Ti(e._def.innerType):[];class Dv extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.object)return de(n,{code:Q.invalid_type,expected:he.object,received:n.parsedType}),Re;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(de(n,{code:Q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const s=Ti(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new Dv({typeName:Me.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Fe(r)})}}function xb(e,t){const n=Bs(e),r=Bs(t);if(e===t)return{valid:!0,data:e};if(n===he.object&&r===he.object){const o=Qe.objectKeys(t),i=Qe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(const a of i){const l=xb(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===he.array&&r===he.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const s=e[i],a=t[i],l=xb(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===he.date&&r===he.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class qf extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(vb(i)||vb(s))return Re;const a=xb(i.value,s.value);return a.valid?((yb(i)||yb(s))&&n.dirty(),{status:n.value,value:a.data}):(de(r,{code:Q.invalid_intersection_types}),Re)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}qf.create=(e,t,n)=>new qf({left:e,right:t,typeName:Me.ZodIntersection,...Fe(n)});class fi extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.array)return de(r,{code:Q.invalid_type,expected:he.array,received:r.parsedType}),Re;if(r.data.length<this._def.items.length)return de(r,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Re;!this._def.rest&&r.data.length>this._def.items.length&&(de(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new di(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Hn.mergeArray(n,s)):Hn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new fi({...this._def,rest:t})}}fi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fi({items:e,typeName:Me.ZodTuple,rest:null,...Fe(t)})};class Yf extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.object)return de(r,{code:Q.invalid_type,expected:he.object,received:r.parsedType}),Re;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new di(r,a,r.path,a)),value:s._parse(new di(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Hn.mergeObjectAsync(n,o):Hn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ue?new Yf({keyType:t,valueType:n,typeName:Me.ZodRecord,...Fe(r)}):new Yf({keyType:Ro.create(),valueType:t,typeName:Me.ZodRecord,...Fe(n)})}}class yg extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.map)return de(r,{code:Q.invalid_type,expected:he.map,received:r.parsedType}),Re;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new di(r,a,r.path,[c,"key"])),value:i._parse(new di(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}yg.create=(e,t,n)=>new yg({valueType:t,keyType:e,typeName:Me.ZodMap,...Fe(n)});class Nl extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.set)return de(r,{code:Q.invalid_type,expected:he.set,received:r.parsedType}),Re;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(de(r,{code:Q.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(de(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Re;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new di(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new Nl({...this._def,minSize:{value:t,message:be.toString(n)}})}max(t,n){return new Nl({...this._def,maxSize:{value:t,message:be.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Nl.create=(e,t)=>new Nl({valueType:e,minSize:null,maxSize:null,typeName:Me.ZodSet,...Fe(t)});class $c extends Ue{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.function)return de(n,{code:Q.invalid_type,expected:he.function,received:n.parsedType}),Re;function r(a,l){return pg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,hg(),lu].filter(c=>!!c),issueData:{code:Q.invalid_arguments,argumentsError:l}})}function o(a,l){return pg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,hg(),lu].filter(c=>!!c),issueData:{code:Q.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof uu){const a=this;return Zn(async function(...l){const c=new Ir([]),u=await a._def.args.parseAsync(l,i).catch(p=>{throw c.addIssue(r(l,p)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw c.addIssue(o(d,p)),c})})}else{const a=this;return Zn(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new Ir([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,i);if(!d.success)throw new Ir([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new $c({...this._def,args:fi.create(t).rest(dl.create())})}returns(t){return new $c({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new $c({args:t||fi.create([]).rest(dl.create()),returns:n||dl.create(),typeName:Me.ZodFunction,...Fe(r)})}}class Jf extends Ue{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Jf.create=(e,t)=>new Jf({getter:e,typeName:Me.ZodLazy,...Fe(t)});class Xf extends Ue{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return de(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),Re}return{status:"valid",value:t.data}}get value(){return this._def.value}}Xf.create=(e,t)=>new Xf({value:e,typeName:Me.ZodLiteral,...Fe(t)});function UM(e,t){return new ba({values:e,typeName:Me.ZodEnum,...Fe(t)})}class ba extends Ue{constructor(){super(...arguments),Pd.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{expected:Qe.joinValues(r),received:n.parsedType,code:Q.invalid_type}),Re}if(mg(this,Pd)||zM(this,Pd,new Set(this._def.values)),!mg(this,Pd).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{received:n.data,code:Q.invalid_enum_value,options:r}),Re}return Zn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return ba.create(t,{...this._def,...n})}exclude(t,n=this._def){return ba.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Pd=new WeakMap;ba.create=UM;class Zf extends Ue{constructor(){super(...arguments),Nd.set(this,void 0)}_parse(t){const n=Qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==he.string&&r.parsedType!==he.number){const o=Qe.objectValues(n);return de(r,{expected:Qe.joinValues(o),received:r.parsedType,code:Q.invalid_type}),Re}if(mg(this,Nd)||zM(this,Nd,new Set(Qe.getValidEnumValues(this._def.values))),!mg(this,Nd).has(t.data)){const o=Qe.objectValues(n);return de(r,{received:r.data,code:Q.invalid_enum_value,options:o}),Re}return Zn(t.data)}get enum(){return this._def.values}}Nd=new WeakMap;Zf.create=(e,t)=>new Zf({values:e,typeName:Me.ZodNativeEnum,...Fe(t)});class uu extends Ue{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.promise&&n.common.async===!1)return de(n,{code:Q.invalid_type,expected:he.promise,received:n.parsedType}),Re;const r=n.parsedType===he.promise?n.data:Promise.resolve(n.data);return Zn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}uu.create=(e,t)=>new uu({type:e,typeName:Me.ZodPromise,...Fe(t)});class Uo extends Ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{de(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Re;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Re:l.status==="dirty"||n.value==="dirty"?jc(l.value):l});{if(n.value==="aborted")return Re;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Re:a.status==="dirty"||n.value==="dirty"?jc(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Re:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Re:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Vf(s))return s;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Vf(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);Qe.assertNever(o)}}Uo.create=(e,t,n)=>new Uo({schema:e,typeName:Me.ZodEffects,effect:t,...Fe(n)});Uo.createWithPreprocess=(e,t,n)=>new Uo({schema:t,effect:{type:"preprocess",transform:e},typeName:Me.ZodEffects,...Fe(n)});class li extends Ue{_parse(t){return this._getType(t)===he.undefined?Zn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}li.create=(e,t)=>new li({innerType:e,typeName:Me.ZodOptional,...Fe(t)});class wa extends Ue{_parse(t){return this._getType(t)===he.null?Zn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wa.create=(e,t)=>new wa({innerType:e,typeName:Me.ZodNullable,...Fe(t)});class Qf extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===he.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Qf.create=(e,t)=>new Qf({innerType:e,typeName:Me.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Fe(t)});class eh extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Uf(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ir(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ir(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eh.create=(e,t)=>new eh({innerType:e,typeName:Me.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Fe(t)});class xg extends Ue{_parse(t){if(this._getType(t)!==he.nan){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.nan,received:r.parsedType}),Re}return{status:"valid",value:t.data}}}xg.create=e=>new xg({typeName:Me.ZodNaN,...Fe(e)});const vV=Symbol("zod_brand");class q1 extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Vh extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Re:i.status==="dirty"?(n.dirty(),jc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Re:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Vh({in:t,out:n,typeName:Me.ZodPipeline})}}class th extends Ue{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Vf(o)&&(o.value=Object.freeze(o.value)),o);return Uf(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}th.create=(e,t)=>new th({innerType:e,typeName:Me.ZodReadonly,...Fe(t)});function HM(e,t={},n){return e?cu.create().superRefine((r,o)=>{var i,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(i=a.fatal)!==null&&i!==void 0?i:n)!==null&&s!==void 0?s:!0,c=typeof a=="string"?{message:a}:a;o.addIssue({code:"custom",...c,fatal:l})}}):cu.create()}const yV={object:Mt.lazycreate};var Me;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Me||(Me={}));const xV=(e,t={message:`Input not instance of ${e.name}`})=>HM(n=>n instanceof e,t),WM=Ro.create,KM=ya.create,bV=xg.create,wV=xa.create,GM=Hf.create,SV=Pl.create,kV=gg.create,EV=Wf.create,CV=Kf.create,_V=cu.create,PV=dl.create,NV=ts.create,TV=vg.create,OV=Fo.create,MV=Mt.create,jV=Mt.strictCreate,RV=Gf.create,IV=Dv.create,AV=qf.create,DV=fi.create,LV=Yf.create,FV=yg.create,zV=Nl.create,$V=$c.create,BV=Jf.create,VV=Xf.create,UV=ba.create,HV=Zf.create,WV=uu.create,IC=Uo.create,KV=li.create,GV=wa.create,qV=Uo.createWithPreprocess,YV=Vh.create,JV=()=>WM().optional(),XV=()=>KM().optional(),ZV=()=>GM().optional(),QV={string:e=>Ro.create({...e,coerce:!0}),number:e=>ya.create({...e,coerce:!0}),boolean:e=>Hf.create({...e,coerce:!0}),bigint:e=>xa.create({...e,coerce:!0}),date:e=>Pl.create({...e,coerce:!0})},eU=Re;var y=Object.freeze({__proto__:null,defaultErrorMap:lu,setErrorMap:eV,getErrorMap:hg,makeIssue:pg,EMPTY_PATH:tV,addIssueToContext:de,ParseStatus:Hn,INVALID:Re,DIRTY:jc,OK:Zn,isAborted:vb,isDirty:yb,isValid:Vf,isAsync:Uf,get util(){return Qe},get objectUtil(){return gb},ZodParsedType:he,getParsedType:Bs,ZodType:Ue,datetimeRegex:VM,ZodString:Ro,ZodNumber:ya,ZodBigInt:xa,ZodBoolean:Hf,ZodDate:Pl,ZodSymbol:gg,ZodUndefined:Wf,ZodNull:Kf,ZodAny:cu,ZodUnknown:dl,ZodNever:ts,ZodVoid:vg,ZodArray:Fo,ZodObject:Mt,ZodUnion:Gf,ZodDiscriminatedUnion:Dv,ZodIntersection:qf,ZodTuple:fi,ZodRecord:Yf,ZodMap:yg,ZodSet:Nl,ZodFunction:$c,ZodLazy:Jf,ZodLiteral:Xf,ZodEnum:ba,ZodNativeEnum:Zf,ZodPromise:uu,ZodEffects:Uo,ZodTransformer:Uo,ZodOptional:li,ZodNullable:wa,ZodDefault:Qf,ZodCatch:eh,ZodNaN:xg,BRAND:vV,ZodBranded:q1,ZodPipeline:Vh,ZodReadonly:th,custom:HM,Schema:Ue,ZodSchema:Ue,late:yV,get ZodFirstPartyTypeKind(){return Me},coerce:QV,any:_V,array:OV,bigint:wV,boolean:GM,date:SV,discriminatedUnion:IV,effect:IC,enum:UV,function:$V,instanceof:xV,intersection:AV,lazy:BV,literal:VV,map:FV,nan:bV,nativeEnum:HV,never:NV,null:CV,nullable:GV,number:KM,object:MV,oboolean:ZV,onumber:XV,optional:KV,ostring:JV,pipeline:YV,preprocess:qV,promise:WV,record:LV,set:zV,strictObject:jV,string:WM,symbol:kV,transformer:IC,tuple:DV,undefined:EV,union:RV,unknown:PV,void:TV,NEVER:eU,ZodIssueCode:Q,quotelessJson:Q8,ZodError:Ir});function Y1(e){return e instanceof Error&&e.name==="ZodError"&&"issues"in e&&Array.isArray(e.issues)}var bb=class extends Error{constructor(n,r){super(n,r);$t(this,"name");$t(this,"details");this.name="ZodValidationError",this.details=tU(r)}toString(){return this.message}};function tU(e){if(e){const t=e.cause;if(Y1(t))return t.issues}return[]}function qM(e){return e.length!==0}var nU=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function rU(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+oU(n)+'"]';if(!nU.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function oU(e){return e.replace(/"/g,'\\"')}var iU="; ",sU=99,YM="Validation error",aU=": ",lU=", or ";function cU(e={}){const{issueSeparator:t=iU,unionSeparator:n=lU,prefixSeparator:r=aU,prefix:o=YM,includePath:i=!0,maxIssuesInMessage:s=sU}=e;return a=>{const l=a.slice(0,s).map(c=>mm({issue:c,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return uU(l,o,r)}}function mm(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:o}=e;if(t.code===Q.invalid_union)return t.unionErrors.reduce((i,s)=>{const a=s.issues.map(l=>mm({issue:l,issueSeparator:n,unionSeparator:r,includePath:o})).join(n);return i.includes(a)||i.push(a),i},[]).join(r);if(t.code===Q.invalid_arguments)return[t.message,...t.argumentsError.issues.map(i=>mm({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(t.code===Q.invalid_return_type)return[t.message,...t.returnTypeError.issues.map(i=>mm({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(o&&qM(t.path)){if(t.path.length===1){const i=t.path[0];if(typeof i=="number")return`${t.message} at index ${i}`}return`${t.message} at "${rU(t.path)}"`}return t.message}function uU(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:YM}function AC(e,t={}){if(!Y1(e))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${hU.name}" method instead?`);return JM(e,t)}function JM(e,t={}){const n=e.errors;let r;return qM(n)?r=dU(t)(n):r=e.message,new bb(r,{cause:e})}function dU(e){return"messageBuilder"in e?e.messageBuilder:cU(e)}var fU=(e={})=>t=>Y1(t)?JM(t,e):t instanceof Error?new bb(t.message,{cause:t}):new bb("Unknown error");function hU(e,t={}){return fU(t)(e)}function pU(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mU(e){var t=pU(e,"string");return typeof t=="symbol"?t:t+""}function ut(e,t,n){return(t=mU(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ai(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DC(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function J1(e,t){if(e){if(typeof e=="string")return wb(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wb(e,t):void 0}}function X1(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=J1(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
49
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function gU(e,t,n){var r={},o=[],i=0,s=X1((e==null?void 0:e.content)||[]),a;try{for(s.s();!(a=s.n()).done;){var l=a.value,c=vU([(i++).toString()],l,r,t,n);o.push(c)}}catch(u){s.e(u)}finally{s.f()}return{blocks:o,files:r}}function vU(e,t,n,r,o){if(t.type==="heading"){var i,s,a=((i=t.attrs)===null||i===void 0?void 0:i.level)||1;if(Number.isNaN(a))throw new Error("Invalid header depth");return{tag:"h".concat(a),children:((s=t.content)===null||s===void 0?void 0:s.map(function(c,u){return yU(e.concat("children",u.toString()),c,n,r,o)}))||[]}}else{if(t.type==="paragraph")return XM(e,t,n,r,o);if(t.type==="bulletList")return ej(e,t,n,r,o);if(t.type==="orderedList")return tj(e,t,n,r,o);var l=t;throw new Error("Unhandled node type: ".concat("type"in l?"exhaustiveCheck.type":"unknown"))}}function yU(e,t,n,r,o){if(t.type==="text")return ZM(t);if(t.type==="hardBreak")return{tag:"br"};if(t.type==="image")return nj(e,t,n,r,o);var i=t;throw new Error("Unexpected heading child type: ".concat(JSON.stringify(i,null,2)))}function XM(e,t,n,r,o){var i;return{tag:"p",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="text")return ZM(s);if(s.type==="hardBreak")return{tag:"br"};if(s.type==="image")return nj(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected paragraph child type: ".concat(JSON.stringify(l,null,2)))}))||[]}}function ZM(e){if(e.type==="text"){var t,n,r=((t=e.marks)===null||t===void 0?void 0:t.flatMap(function(a){return a.type!=="link"?a.type==="strike"?["line-through"]:[a.type]:[]}))||[];if((n=e.marks)!==null&&n!==void 0&&n.some(function(a){return a.type==="link"})){var o;if(r.length>0){var i;return{tag:"a",href:((i=e.marks.find(function(a){return a.type==="link"}))===null||i===void 0?void 0:i.attrs.href)||"",children:[{tag:"span",styles:r,children:[e.text]}]}}return{tag:"a",href:((o=e.marks.find(function(a){return a.type==="link"}))===null||o===void 0?void 0:o.attrs.href)||"",children:[e.text]}}return r.length>0?{tag:"span",styles:r,children:[e.text]}:e.text}else{var s=e.type;throw new Error("Unexpected node type: ".concat(s))}}function QM(e,t,n,r,o){var i;return{tag:"li",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="paragraph")return XM(e.concat("children",a.toString()),s,n,r,o);if(s.type==="bulletList")return ej(e.concat("children",a.toString()),s,n,r,o);if(s.type==="orderedList")return tj(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected list child type: ".concat(l))}))||[]}}function ej(e,t,n,r,o){var i;return{tag:"ul",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return QM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected bullet list child type: ".concat(l))}))||[]}}function tj(e,t,n,r,o){var i;return{tag:"ol",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return QM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected ordered list child type: ".concat(l))}))||[]}}var LC=function(t){if(t==null)return 0;if(typeof t=="number")return t;var n=parseInt(t,10);return isNaN(n)?0:n},xU=new TextEncoder;function nj(e,t,n,r,o){if(t.attrs&&t.attrs.src.startsWith("data:")){var i=Iv.Buffer.from(t.attrs.src.split(",")[1],"base64"),s=X.getSHA256Hash(new Uint8Array(i)),a=X.getMimeType(t.attrs.src);if(a===void 0)throw new Error("Could not detect Mime Type for image: ".concat(t.attrs.src));var l=X.createFilename(t.attrs.src,t.attrs.fileName||"",{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:a},s),c=r!=null&&r.endsWith("/")?r:"".concat(r,"/"),u="".concat(c).concat(l),d=n[u],h=e.concat("src"),p=X.remote.hashToRemoteFileHash(s),m=o?X.remote.createRemoteRef(o.remoteHost,Ai(Ai({},o),{},{fileHash:p,validationHash:X.remote.getValidationHash(o.coreVersion,o.schema,a,{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0},p,xU),filePath:u.slice(1)})):u;return d?d.patchPaths.push(h):n[u]={value:t.attrs.src,filePathOrRef:m,metadata:{height:LC(t.attrs.height),width:LC(t.attrs.width),mimeType:a},patchPaths:[h]},{tag:"img",src:Ai(Ai(ut({},vt,m),o?ut({},
|
|
50
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CU(e){return SU(e)||kU(e)||J1(e)||EU()}function zp(e){return{type:"doc",content:e.map(function(t){return _U(t)})}}function _U(e){switch(e.tag){case"h1":return ec(1,e.children);case"h2":return ec(2,e.children);case"h3":return ec(3,e.children);case"h4":return ec(4,e.children);case"h5":return ec(5,e.children);case"h6":return ec(6,e.children);case"p":return hj(e.children);case"ul":return vj(e);case"ol":return yj(e);default:{var t=e;throw Error("Unexpected child node: "+JSON.stringify(t))}}}function ec(e,t){return{type:"heading",attrs:{level:e},content:t.flatMap(dj)}}function Lv(e){return{type:"text",text:e}}function dj(e){return typeof e=="string"?[Lv(e)]:e.tag==="img"?[gj(e)]:e.tag==="br"?[pj()]:e.tag==="a"?mj(e):fj(e)}function fj(e){if(e.styles.length===0&&e.children.length===1){if(typeof e.children[0]=="string")return[Lv(e.children[0])];throw Error("Unexpected amount of children in span node: "+JSON.stringify(e,null,2))}var t=Array.from(new Set(e.styles));return e.children.map(function(n){return{type:"text",text:n,marks:t.map(function(r){switch(r){case"bold":return{type:"bold"};case"italic":return{type:"italic"};case"line-through":return{type:"strike"};default:{var o=r;throw Error("Unexpected span class: "+o)}}})}})}function hj(e){return{type:"paragraph",content:e.flatMap(function(t){if(typeof t=="string")return[Lv(t)];switch(t.tag){case"span":return fj(t);case"a":return mj(t);case"img":return[gj(t)];case"br":return[pj()];default:{var n=t;throw Error("Unexpected paragraph child: "+JSON.stringify(n))}}})}}function pj(){return{type:"hardBreak",marks:[]}}function mj(e){return e.children.flatMap(dj).map(function(t){return t.type!=="text"?t:Ai(Ai({},t),{},{marks:(t.marks||[]).concat({type:"link",attrs:{href:e.href,auto:!1,target:null}})})})}function gj(e){var t,n,r,o=e.src;if(!(De in o)||o[De]!=="file"&&o[De]!=="remote")throw Error("Expected file source in image node");var i;return o[De]==="remote"?i=X.convertRemoteSource(o):i=X.convertFileSource(o),{type:"image",attrs:{height:(t=o.metadata)===null||t===void 0?void 0:t.height,width:(n=o.metadata)===null||n===void 0?void 0:n.width,alt:(r=o.metadata)===null||r===void 0?void 0:r.alt,src:i.url}}}function vj(e){return{type:"bulletList",content:e.children.map(xj)}}function yj(e){return{type:"orderedList",content:e.children.map(xj)}}function xj(e){return{type:"listItem",content:PU(e.children)}}function PU(e){var t=[],n=X1(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,i=t[t.length-1];i||(i={type:"paragraph",content:[]},t.push(i));var s=i.content;if(typeof o=="string")s.push(Lv(o));else switch(o.tag){case"ol":{t.push(yj(o));break}case"ul":{t.push(vj(o));break}case"p":{var a=hj(o.children);i.type==="paragraph"&&a.type==="paragraph"?a.content&&s.push.apply(s,CU(a.content)):t.push(a);break}default:{var l=o;throw Error("Unexpected list item child: "+JSON.stringify(l))}}}}catch(c){n.e(c)}finally{n.f()}return t}var Ss=X.VAL_SESSION_COOKIE,tc=X.VAL_STATE_COOKIE,md=X.VAL_ENABLE_COOKIE_NAME;function Td(){Td=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(A,R,N){A[R]=N.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(A,R,N){return Object.defineProperty(A,R,{value:N,enumerable:!0,configurable:!0,writable:!0}),A[R]}try{c({},"")}catch{c=function(R,N,D){return R[N]=D}}function u(A,R,N,D){var z=R&&R.prototype instanceof b?R:b,V=Object.create(z.prototype),G=new W(D||[]);return o(V,"_invoke",{value:L(A,N,G)}),V}function d(A,R,N){try{return{type:"normal",arg:A.call(R,N)}}catch(D){return{type:"throw",arg:D}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",m="executing",v="completed",x={};function b(){}function w(){}function S(){}var C={};c(C,s,function(){return this});var _=Object.getPrototypeOf,P=_&&_(_(B([])));P&&P!==n&&r.call(P,s)&&(C=P);var O=S.prototype=b.prototype=Object.create(C);function M(A){["next","throw","return"].forEach(function(R){c(A,R,function(N){return this._invoke(R,N)})})}function I(A,R){function N(z,V,G,_e){var Se=d(A[z],A,V);if(Se.type!=="throw"){var Be=Se.arg,Z=Be.value;return Z&&typeof Z=="object"&&r.call(Z,"__await")?R.resolve(Z.__await).then(function(Y){N("next",Y,G,_e)},function(Y){N("throw",Y,G,_e)}):R.resolve(Z).then(function(Y){Be.value=Y,G(Be)},function(Y){return N("throw",Y,G,_e)})}_e(Se.arg)}var D;o(this,"_invoke",{value:function(z,V){function G(){return new R(function(_e,Se){N(z,V,_e,Se)})}return D=D?D.then(G,G):G()}})}function L(A,R,N){var D=h;return function(z,V){if(D===m)throw Error("Generator is already running");if(D===v){if(z==="throw")throw V;return{value:e,done:!0}}for(N.method=z,N.arg=V;;){var G=N.delegate;if(G){var _e=U(G,N);if(_e){if(_e===x)continue;return _e}}if(N.method==="next")N.sent=N._sent=N.arg;else if(N.method==="throw"){if(D===h)throw D=v,N.arg;N.dispatchException(N.arg)}else N.method==="return"&&N.abrupt("return",N.arg);D=m;var Se=d(A,R,N);if(Se.type==="normal"){if(D=N.done?v:p,Se.arg===x)continue;return{value:Se.arg,done:N.done}}Se.type==="throw"&&(D=v,N.method="throw",N.arg=Se.arg)}}}function U(A,R){var N=R.method,D=A.iterator[N];if(D===e)return R.delegate=null,N==="throw"&&A.iterator.return&&(R.method="return",R.arg=e,U(A,R),R.method==="throw")||N!=="return"&&(R.method="throw",R.arg=new TypeError("The iterator does not provide a '"+N+"' method")),x;var z=d(D,A.iterator,R.arg);if(z.type==="throw")return R.method="throw",R.arg=z.arg,R.delegate=null,x;var V=z.arg;return V?V.done?(R[A.resultName]=V.value,R.next=A.nextLoc,R.method!=="return"&&(R.method="next",R.arg=e),R.delegate=null,x):V:(R.method="throw",R.arg=new TypeError("iterator result is not an object"),R.delegate=null,x)}function $(A){var R={tryLoc:A[0]};1 in A&&(R.catchLoc=A[1]),2 in A&&(R.finallyLoc=A[2],R.afterLoc=A[3]),this.tryEntries.push(R)}function K(A){var R=A.completion||{};R.type="normal",delete R.arg,A.completion=R}function W(A){this.tryEntries=[{tryLoc:"root"}],A.forEach($,this),this.reset(!0)}function B(A){if(A||A===""){var R=A[s];if(R)return R.call(A);if(typeof A.next=="function")return A;if(!isNaN(A.length)){var N=-1,D=function z(){for(;++N<A.length;)if(r.call(A,N))return z.value=A[N],z.done=!1,z;return z.value=e,z.done=!0,z};return D.next=D}}throw new TypeError(typeof A+" is not iterable")}return w.prototype=S,o(O,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,l,"GeneratorFunction"),t.isGeneratorFunction=function(A){var R=typeof A=="function"&&A.constructor;return!!R&&(R===w||(R.displayName||R.name)==="GeneratorFunction")},t.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,S):(A.__proto__=S,c(A,l,"GeneratorFunction")),A.prototype=Object.create(O),A},t.awrap=function(A){return{__await:A}},M(I.prototype),c(I.prototype,a,function(){return this}),t.AsyncIterator=I,t.async=function(A,R,N,D,z){z===void 0&&(z=Promise);var V=new I(u(A,R,N,D),z);return t.isGeneratorFunction(R)?V:V.next().then(function(G){return G.done?G.value:V.next()})},M(O),c(O,l,"Generator"),c(O,s,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),t.keys=function(A){var R=Object(A),N=[];for(var D in R)N.push(D);return N.reverse(),function z(){for(;N.length;){var V=N.pop();if(V in R)return z.value=V,z.done=!1,z}return z.done=!0,z}},t.values=B,W.prototype={constructor:W,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(K),!A)for(var R in this)R.charAt(0)==="t"&&r.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=e)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if(A.type==="throw")throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var R=this;function N(Se,Be){return V.type="throw",V.arg=A,R.next=Se,Be&&(R.method="next",R.arg=e),!!Be}for(var D=this.tryEntries.length-1;D>=0;--D){var z=this.tryEntries[D],V=z.completion;if(z.tryLoc==="root")return N("end");if(z.tryLoc<=this.prev){var G=r.call(z,"catchLoc"),_e=r.call(z,"finallyLoc");if(G&&_e){if(this.prev<z.catchLoc)return N(z.catchLoc,!0);if(this.prev<z.finallyLoc)return N(z.finallyLoc)}else if(G){if(this.prev<z.catchLoc)return N(z.catchLoc,!0)}else{if(!_e)throw Error("try statement without catch or finally");if(this.prev<z.finallyLoc)return N(z.finallyLoc)}}}},abrupt:function(A,R){for(var N=this.tryEntries.length-1;N>=0;--N){var D=this.tryEntries[N];if(D.tryLoc<=this.prev&&r.call(D,"finallyLoc")&&this.prev<D.finallyLoc){var z=D;break}}z&&(A==="break"||A==="continue")&&z.tryLoc<=R&&R<=z.finallyLoc&&(z=null);var V=z?z.completion:{};return V.type=A,V.arg=R,z?(this.method="next",this.next=z.finallyLoc,x):this.complete(V)},complete:function(A,R){if(A.type==="throw")throw A.arg;return A.type==="break"||A.type==="continue"?this.next=A.arg:A.type==="return"?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):A.type==="normal"&&R&&(this.next=R),x},finish:function(A){for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R];if(N.finallyLoc===A)return this.complete(N.completion,N.afterLoc),K(N),x}},catch:function(A){for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R];if(N.tryLoc===A){var D=N.completion;if(D.type==="throw"){var z=D.arg;K(N)}return z}}throw Error("illegal catch attempt")},delegateYield:function(A,R,N){return this.delegate={iterator:B(A),resultName:R,nextLoc:N},this.method==="next"&&(this.arg=e),x}},t}function FC(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(r,o)}function zC(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){FC(i,r,o,s,a,"next",l)}function a(l){FC(i,r,o,s,a,"throw",l)}s(void 0)})}}var Ki=y.lazy(function(){return y.union([y.string(),y.number(),y.boolean(),y.null(),y.array(Ki),y.record(Ki)])}),bj=function(t){return y.object({op:y.literal("file"),path:t,filePath:y.string(),value:y.string(),remote:y.boolean(),nestedFilePath:y.array(y.string()).optional(),metadata:Ki.optional()})},NU=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.string(),value:Ki}).strict(),y.object({op:y.literal("remove"),path:y.string()}).strict(),y.object({op:y.literal("replace"),path:y.string(),value:Ki}).strict(),y.object({op:y.literal("move"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("copy"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("test"),path:y.string(),value:Ki}).strict(),bj(y.string()).strict()]);y.array(NU);var TU=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.array(y.string()),value:Ki}).strict(),y.object({op:y.literal("remove"),path:y.array(y.string()).nonempty()}).strict(),y.object({op:y.literal("replace"),path:y.array(y.string()),value:Ki}).strict(),y.object({op:y.literal("move"),from:y.array(y.string()).nonempty(),path:y.array(y.string())}).strict(),y.object({op:y.literal("copy"),from:y.array(y.string()),path:y.array(y.string())}).strict(),y.object({op:y.literal("test"),path:y.array(y.string()),value:Ki}).strict(),bj(y.array(y.string())).strict()]),wj=y.array(TU),Kt=y.string().refine(function(e){return!0}),OU=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Kt})]);y.object({patch:wj,parentRef:OU});var MU=y.string().transform(function(e){return e}),jU=y.object({type:y.literal("string"),options:y.object({maxLength:y.number().optional(),minLength:y.number().optional(),regexp:y.object({source:y.string(),flags:y.string()}).optional()}).optional(),opt:y.boolean(),raw:y.boolean()}),Sb=y.object({type:y.literal("literal"),value:y.string(),opt:y.boolean()}),RU=y.object({type:y.literal("boolean"),opt:y.boolean()}),IU=y.object({type:y.literal("number"),options:y.object({max:y.number().optional(),min:y.number().optional()}).optional(),opt:y.boolean()}),Sj=y.lazy(function(){return y.object({type:y.literal("object"),items:y.record(Uh),opt:y.boolean()})}),AU=y.lazy(function(){return y.object({type:y.literal("array"),item:Uh,opt:y.boolean()})}),DU=y.lazy(function(){return y.union([y.object({type:y.literal("union"),key:Sb,items:y.array(Sb),opt:y.boolean()}),y.object({type:y.literal("union"),key:y.string(),items:y.array(Sj),opt:y.boolean()})])}),LU=y.object({ext:y.union([y.tuple([y.literal("jpg")]),y.tuple([y.literal("webp")])]).optional(),directory:y.string().optional(),prefix:y.string().optional(),accept:y.string().optional()}),kj=y.object({type:y.literal("image"),options:LU.optional(),opt:y.boolean()}),FU=y.object({style:y.object({bold:y.boolean().optional(),italic:y.boolean().optional(),lineThrough:y.boolean().optional()}).optional(),block:y.object({h1:y.boolean().optional(),h2:y.boolean().optional(),h3:y.boolean().optional(),h4:y.boolean().optional(),h5:y.boolean().optional(),h6:y.boolean().optional(),ul:y.boolean().optional(),ol:y.boolean().optional()}).optional(),inline:y.object({a:y.boolean().optional(),img:y.union([y.boolean(),kj]).optional()}).optional()}),zU=y.object({type:y.literal("richtext"),options:FU.optional(),opt:y.boolean()}),$U=y.lazy(function(){return y.object({type:y.literal("record"),item:Uh,opt:y.boolean()})}),BU=y.lazy(function(){return y.object({type:y.literal("keyOf"),path:MU,schema:Uh,values:y.union([y.literal("string"),y.array(y.string())]),opt:y.boolean()})}),VU=y.object({accept:y.string().optional()}),UU=y.object({type:y.literal("file"),options:VU.optional(),opt:y.boolean()}),HU=y.object({type:y.literal("date"),opt:y.boolean()}),Uh=y.union([jU,Sb,RU,IU,Sj,AU,DU,zU,$U,BU,UU,HU,kj]),Z1=y.object({commitSha:y.string(),clientCommitSha:y.string(),parentCommitSha:y.string(),branch:y.string(),creator:y.string(),createdAt:y.string(),commitMessage:y.string().nullable()}),qa=y.string().refine(function(e){return!0}),Cx=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Kt})]),$C=y.object({project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.string()}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional()}),WU=y.union([y.literal("image:change-extension"),y.literal("image:add-metadata"),y.literal("image:check-metadata"),y.literal("image:check-remote"),y.literal("image:upload-remote"),y.literal("image:download-remote"),y.literal("file:change-extension"),y.literal("file:add-metadata"),y.literal("file:check-metadata"),y.literal("file:check-remote"),y.literal("file:upload-remote"),y.literal("file:download-remote"),y.literal("keyof:check-keys")]),KU=y.object({message:y.string(),value:y.unknown().optional(),fatal:y.boolean().optional(),fixes:y.array(WU).optional()}),Ci=y.object({status:y.literal(401),json:y.object({message:y.string()})}),GU=y.object({status:y.literal(404),json:y.object({message:y.string()})}),Tt=y.object({message:y.string()}),BC=y.union([y.object({patchId:Kt,message:y.string()}),y.object({parentPatchId:y.string(),message:y.string()})]),_x=y.object({message:y.string(),path:qa.optional()});y.union([y.literal("val_session"),y.literal("val_enable"),y.literal("val_state")]);var $p=y.object({value:y.literal("true"),options:y.object({httpOnly:y.literal(!1),sameSite:y.literal("lax")})}),qU={"/draft/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/stat":{GET:{req:{cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(200),json:y.object({draftMode:y.boolean()})})])}},"/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut({},md,$p),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut({},md,$p))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut({},md,y.object({value:y.literal("false")})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/authorize":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut({},md,$p),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/callback":{GET:{req:{query:{code:y.string().optional(),state:y.string().optional()},cookies:ut({},tc,y.string())},res:y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut(ut({},tc,y.object({value:y.literal(null)})),md,$p.optional()),Ss,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})}},"/session":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({mode:y.union([y.literal("local"),y.literal("proxy")]),enabled:y.boolean()})}),y.object({status:y.union([y.literal(400),y.literal(401),y.literal(403),y.literal(404),y.literal(500),y.literal(501)]),json:y.object({message:y.string()})}),y.object({status:y.literal(401),json:y.object({message:y.string(),details:y.union([y.string(),y.object({reason:y.string()}),y.object({sub:y.string(),exp:y.number(),token:y.string(),org:y.string(),project:y.string()})])})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/logout":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(200),cookies:y.object(ut(ut({},Ss,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut({},Ss,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})])}},"/remote/settings":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({publicProjectId:y.string(),coreVersion:y.string(),remoteFileBuckets:y.array(y.object({bucket:y.string()}))})}),y.object({status:y.literal(400),json:y.object({errorCode:y.union([y.literal("project-not-configured"),y.literal("error-could-not-get-settings"),y.literal("project-not-configured"),y.literal("pat-error"),y.literal("api-key-missing")]),message:y.string()})}),y.object({status:y.literal(401),json:y.object({errorCode:y.literal("unauthorized").optional(),message:y.string()})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/stat":{POST:{req:{body:y.object({sourcesSha:y.string(),schemaSha:y.string(),baseSha:y.string(),patches:y.array(y.string()).optional()}).nullable(),cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(500),json:Tt}),y.object({status:y.literal(503),json:Tt}),y.object({status:y.literal(200),json:y.union([y.object({type:y.union([y.literal("request-again"),y.literal("no-change"),y.literal("did-change")]),baseSha:y.string(),schemaSha:y.string(),sourcesSha:y.string(),patches:y.array(Kt),config:$C,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])}),y.object({type:y.literal("use-websocket"),url:y.string(),nonce:y.string(),baseSha:y.string(),schemaSha:y.string(),sourcesSha:y.string(),commitSha:y.string(),patches:y.array(Kt),commits:y.array(Z1),config:$C,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])})])})])}},"/upload/patches":{POST:{req:{path:y.string().optional(),body:y.object({parentRef:Cx,filePath:y.string(),data:y.any(),type:y.union([y.literal("file"),y.literal("image")]),metadata:y.any(),remote:y.boolean()})},res:y.union([y.object({status:y.literal(400),json:Tt}),y.object({status:y.literal(200),json:y.object({filePath:y.string(),patchId:Kt})})])}},"/direct-file-upload-settings":{POST:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(400),json:Tt}),y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(500),json:Tt}),y.object({status:y.literal(200),json:y.object({nonce:y.string().nullable(),baseUrl:y.string()})})])}},"/patches":{DELETE:{req:{query:{id:y.array(Kt)},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(500),json:y.object({message:y.string(),errors:y.array(BC)})}),y.object({status:y.literal(200),json:y.array(Kt)})])},PUT:{req:{body:y.object({parentRef:Cx,patches:y.array(y.object({path:qa,patchId:Kt,patch:y.any()}))}),cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(409),json:y.object({type:y.literal("patch-head-conflict"),message:y.string()})}),y.object({status:y.literal(400),json:y.object({type:y.literal("patch-error"),message:y.string(),errors:y.record(qa,y.array(y.object({error:Tt})))})}),y.object({status:y.literal(200),json:y.object({newPatchIds:y.array(Kt),parentRef:Cx})})])},GET:{req:{query:{patch_id:y.array(Kt).optional(),exclude_patch_ops:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(500),json:y.object({message:y.string(),patchErrors:y.array(BC)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),error:Tt})}),y.object({status:y.literal(200),json:y.object({patches:y.array(y.object({path:qa,patch:wj.optional(),patchId:Kt,createdAt:y.string(),authorId:y.string().nullable(),appliedAt:y.object({commitSha:y.string()}).nullable()})),baseSha:y.string(),error:Tt.optional(),errors:y.record(Kt,Tt).optional()})})])}},"/schema":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(_x)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Tt)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),schemas:y.record(qa,Uh)})})])}},"/sources/~":{PUT:{req:{path:y.string().optional(),query:{validate_sources:y.boolean().optional(),validate_binary_files:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.union([y.array(_x),Tt])})}),y.object({status:y.literal(409),json:y.object({message:y.string()})}),y.object({status:y.literal(400),json:y.object({message:y.string(),details:y.array(_x)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),sourcesSha:y.string(),modules:y.record(qa,y.object({preview:y.any(),source:y.any(),patches:y.object({applied:y.array(Kt),skipped:y.array(Kt).optional(),errors:y.record(Kt,Tt).optional()}).optional(),validationErrors:y.record(y.string(),y.array(KU)).optional()}))})})])}},"/profiles":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(200),json:y.object({profiles:y.array(y.object({profileId:y.string(),fullName:y.string(),email:y.string().optional(),avatar:y.object({url:y.string()}).nullable()}))})})])}},"/commit-summary":{GET:{req:{query:{patch_id:y.array(Kt)},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(400),json:y.object({message:y.string()})}),y.object({status:y.literal(200),json:y.object({patchIds:y.array(Kt),baseSha:y.string(),commitSummary:y.string().nullable()})})])}},"/save":{POST:{req:{body:y.object({message:y.string().optional(),patchIds:y.array(Kt)}),cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(200),json:y.object({})}),y.object({status:y.literal(409),json:y.object({message:y.string(),isNotFastForward:y.literal(!0)})}),y.object({status:y.literal(400),json:y.union([y.object({message:y.string(),details:y.union([y.object({sourceFilePatchErrors:y.record(qa,y.array(Tt)),binaryFilePatchErrors:y.record(Tt)}),y.array(Tt)]).optional()}),y.object({message:y.string(),errorCode:y.union([y.literal("project-not-configured"),y.literal("pat-error")])})])})])}},"/files":{GET:{req:{path:y.string(),query:{patch_id:Kt.optional(),remote:y.string().optional()}},res:y.union([Ci,GU,y.object({status:y.literal(200),body:y.instanceof(ReadableStream)})])}}},Ej=function(t,n){var r=qU;return function(){var o=zC(Td().mark(function i(s,a,l){var c,u,d,h,p,m,v,x,b,w,S,C,_,P,O,M,I,L;return Td().wrap(function($){for(;;)switch($.prev=$.next){case 0:if(d=l,h=s,d!=null&&d.path&&d.path.length>0&&(h+=d.path),d.query){for(p=[],m=0,v=Object.keys(d.query);m<v.length;m++)if(b=v[m],Array.isArray((x=d.query)===null||x===void 0?void 0:x[b])){S=X1(((w=d.query)===null||w===void 0?void 0:w[b])||[]);try{for(S.s();!(C=S.n()).done;)_=C.value,_!==void 0&&p.push([b,_.toString()])}catch(K){S.e(K)}finally{S.f()}}else((P=d.query)===null||P===void 0?void 0:P[b])!==void 0&&p.push([b,d==null||(O=d.query)===null||O===void 0?void 0:O[b].toString()]);d!=null&&d.query&&p.length>0&&(h+="?".concat(new URLSearchParams(p).toString()))}if(M=r==null||(c=r[s])===null||c===void 0?void 0:c[a],M){$.next=7;break}return $.abrupt("return",{status:null,json:{message:"Invalid route ".concat(s," with method ").concat(a,". This is most likely a Val bug."),type:"client_side_validation_error",details:{validationError:"Route ".concat(s," with method ").concat(a," not found."),data:{routes:Object.keys(r||{}),methods:Object.keys((r==null?void 0:r[s])||{}),route:s,method:a}}}});case 7:if(I=(u=M.req.body)===null||u===void 0?void 0:u.safeParse(d.body),!(I&&!I.success)){$.next=11;break}return console.error("Got an invalid request body while validating client-side. This is most likely a Val bug.",{path:s,method:a,body:d.body,error:I.error}),$.abrupt("return",{status:null,json:{message:"There was an issue validating your data. This is most likely a Val bug.",type:"client_side_validation_error",details:{validationError:AC(I.error).toString(),data:d.body}}});case 11:return $.prev=11,$.next=14,fetch("".concat(t).concat(h),{method:a,headers:{"Content-Type":"application/json"},body:d.body!==void 0?JSON.stringify(d.body):void 0}).then(function(){var K=zC(Td().mark(function W(B){var A,R,N,D,z;return Td().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(R=B.headers.get("content-type"),B.status!==413){G.next=3;break}return G.abrupt("return",{status:413,json:{message:"Request too large.",method:a,path:s}});case 3:if(R!=null&&R.includes("application/json")){G.next=5;break}return G.abrupt("return",{status:null,json:{type:"client_side_validation_error",message:"Invalid response (expected JSON, but got something else). This could be a result of mismatched Val versions or a transient error. ".concat(B.status),details:{validationError:"Invalid content type",data:{status:B.status,contentType:R}}}});case 5:return G.next=7,B.json();case 7:if(N=G.sent,D={status:B.status,json:N},B.status!==500){G.next=12;break}return console.error("Server responded with an error",N),G.abrupt("return",{status:500,json:Ai({type:"unknown",message:N.message},N)});case 12:if(z=(A=M.res)===null||A===void 0?void 0:A.safeParse(D),!(z&&!z.success)){G.next=15;break}return G.abrupt("return",{status:null,json:{message:"Response could not be validated. This could also be a result of mismatched Val versions.",type:"client_side_validation_error",details:{validationError:AC(z.error).toString(),data:D}}});case 15:return G.abrupt("return",{status:B.status,json:N});case 16:case"end":return G.stop()}},W)}));return function(W){return K.apply(this,arguments)}}());case 14:return L=$.sent,$.abrupt("return",L);case 18:return $.prev=18,$.t0=$.catch(11),$.abrupt("return",{status:null,json:{message:"Failed to fetch data",type:"network_error",retryable:YU($.t0),details:$.t0 instanceof Error?$.t0.message:JSON.stringify($.t0)}});case 21:case"end":return $.stop()}},i,null,[[11,18]])}));return function(i,s,a){return o.apply(this,arguments)}}()};function YU(e){if(e instanceof TypeError)return!0;if(e instanceof Error&&"code"in e){var t=e.code,n=["ECONNRESET","ETIMEDOUT","ENOTFOUND","EAI_AGAIN"];return n.includes(t)}return!1}function JU(e){if(Array.isArray(e))return e}function XU(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function ZU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
51
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QU(e,t){return JU(e)||XU(e,t)||J1(e,t)||ZU()}var nh=function(){var t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1];if(n){var r=Object.entries(n).flatMap(function(i){var s=QU(i,2),a=s[0],l=s[1];return l?[[a,l.toString()]]:[]}),o=new URLSearchParams(r);return"".concat(t+"?"+o.toString())}return"".concat(t)},VC="val-config",e9="val-config-received",t9=y.object({contentHostUrl:y.string().optional(),appHostUrl:y.string().optional(),project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.literal("/public/val")}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional(),defaultTheme:y.enum(["dark","light"]).optional(),ai:y.object({commitMessages:y.object({disabled:y.boolean().optional()}).optional()}).optional()}),Cj=y.object({deploymentId:y.string(),deploymentState:y.string(),commitSha:y.string(),updatedAt:y.string(),createdAt:y.string()});const _j=y.string().uuid().refine(e=>!0),n9=y.union([y.object({type:y.literal("patches"),patches:y.array(_j)}),y.object({type:y.literal("deployment"),deployment:Cj}),y.object({type:y.literal("commit"),commit:Z1}),y.object({type:y.literal("subscribed")}),y.object({type:y.literal("error"),message:y.string(),reconnect:y.boolean().optional()})]);y.object({type:y.union([y.literal("did-change"),y.literal("no-change"),y.literal("request-again"),y.literal("use-websocket")]),profileId:y.string().nullable(),config:y.object({project:y.string().optional(),files:y.object({directory:y.string()}).optional()}),commitSha:y.string().optional(),sourcesSha:y.string(),schemaSha:y.string(),baseSha:y.string(),patches:y.array(_j),commits:y.array(Z1).optional(),deployments:y.array(Cj).optional(),mode:y.union([y.literal("fs"),y.literal("http")])});function r9(e){const[t,n]=g.useState({status:"not-asked"}),r=g.useRef(null),{authenticationState:o,setAuthenticationLoadingIfNotAuthenticated:i,setIsAuthenticated:s}=o9(),[a,l]=g.useState(),c=g.useRef(0);return g.useEffect(()=>{if(t.status==="updated-request-again"||t.status==="error"||t.status==="ws-message-received")if(t.wait===0)console.debug("Executing stat immediately",t.status,t.status==="error"?t.error:"no error","Now:",Date.now()),Px(e,r,c,t,n,i,s,l);else{console.debug("Executing stat in ",t.wait," status: ",t.status,"Now:",Date.now());const u=setTimeout(()=>{Px(e,r,c,t,n,i,s,l)},t.wait);return()=>clearTimeout(u)}},[e,t]),g.useEffect(()=>{t.status==="not-asked"&&(n({status:"initializing"}),console.debug("Initializing stat"),Px(e,r,c,t,n,i,s,l))},[e,t.status]),[t,n,o,i,s,a]}const gd=10*1e3;async function Px(e,t,n,r,o,i,s,a){const l=++n.current;let c=null;return"data"in r&&r.data&&(c={schemaSha:r.data.schemaSha,sourcesSha:r.data.sourcesSha,baseSha:r.data.baseSha,patches:r.data.patches}),i(),e("/stat","POST",{body:c}).then(u=>{if(u.status===401){s("login-required");return}else s("authorized");if(u.status===503){a(!0),o(d=>({status:"error",error:"Service unavailable",retries:("retries"in d?d.retries:0)+1,waitStart:Date.now(),wait:5e3}));return}if(a(!1),!(n.current!==0&&n.current!==l))if(u.status===200){if(u.json.type==="did-change"||u.json.type==="no-change"||u.json.type==="request-again")o({status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:t.current?gd:0});else if(u.json.type==="use-websocket"){o(m=>({...m,status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:gd})),t.current&&(console.debug("Closing existing WebSocket"),t.current.close());const d=u.json.url;console.debug("Connecting to WebSocket",d),t.current=new WebSocket(d);const h=u.json.nonce;t.current.onopen=()=>{var m;(m=t.current)==null||m.send(JSON.stringify({nonce:h,type:"subscribe"}))},t.current.onmessage=m=>{try{const v=n9.safeParse(JSON.parse(m.data));if(!v.success){console.error("Could not parse WebSocket message",v.error);return}const x=v.data;x.type==="error"?o(b=>vd(b,x.message)):x.type==="patches"?o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,patches:x.patches},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):gd}:b):x.type==="subscribed"?console.debug("Subscribed!"):x.type==="commit"?(console.debug("Commit",x.commit),o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,commits:(b.data.commits||[]).concat(x.commit)},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):gd}:b)):x.type==="deployment"?(console.debug("Deployment",x.deployment),o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,deployments:(b.data.deployments||[]).concat({commitSha:x.deployment.commitSha,deploymentId:x.deployment.deploymentId,deploymentState:x.deployment.deploymentState,createdAt:x.deployment.createdAt,updatedAt:x.deployment.updatedAt})},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):gd}:b)):console.warn("Unknown WebSocket message",x)}catch(v){console.error("Could not parse WebSocket message",v)}};const p=t.current;t.current.onclose=()=>{p===t.current&&(console.debug("WebSocket closed"),o(m=>vd(m,"WebSocket closed")))},t.current.onerror=()=>{console.warn("WebSocket error"),o(m=>vd(m,"Got an error while syncing with Val (reason: WebSocket error)"))}}}else o(d=>vd(d,u.json.message))}).catch(u=>{n.current!==0&&n.current!==l||o(d=>vd(d,u.message))})}function vd(e,t){const n="retries"in e?e.retries+1:0,r=e.status==="error"&&e.retries>1?Math.min(500,e.retries*50+Math.floor(Math.random()*100))*10:0;return{status:"error",error:t,data:"data"in e?e.data:void 0,retries:n,waitStart:"waitStart"in e?e.waitStart:Date.now(),wait:r}}function o9(){const[e,t]=g.useState("not-asked"),n=g.useCallback(()=>{e==="not-asked"&&t("loading")},[e]);return{authenticationState:e,setIsAuthenticated:t,setAuthenticationLoadingIfNotAuthenticated:n}}function Od(e){var t,n,r,o,i;if(e.type==="file")return!!e.remote;if(e.type==="image")return!!e.remote;if(e.type==="richtext")return!!(typeof((n=(t=e.options)==null?void 0:t.inline)==null?void 0:n.img)!="boolean"&&((i=(o=(r=e.options)==null?void 0:r.inline)==null?void 0:o.img)!=null&&i.remote));if(e.type==="array")return Od(e.item);if(e.type==="record")return Od(e.item);if(e.type==="union"){for(const s of e.items)if(Od(s))return!0;return!1}else if(e.type==="object"){for(const s in e.items)if(Od(e.items[s]))return!0;return!1}else{if(e.type==="boolean"||e.type==="number"||e.type==="string"||e.type==="date"||e.type==="keyOf"||e.type==="literal")return!1;{const s=e;return console.error(`Val: requiresRemoteFiles: unexpected schema type ${typeof s=="object"&&"type"in s&&s.type}`,e),null}}}function fn(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,s=r;i<s.length;i++){var a=s[i];t=a(t)}return t}function Pj(e){return M1(e)}function du(e,t){if(e===t)return!0;if(ae(e)==="object"&&ae(t)==="object"&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!du(e[n],t[n]))return!1;return!0}else if(!Array.isArray(e)&&!Array.isArray(t)){var r=Object.entries(e);if(r.length!==Object.keys(t).length)return!1;for(var o=0,i=r;o<i.length;o++){var s=Un(i[o],2),a=s[0],l=s[1],c=t[a];if(c===void 0||!du(l,c))return!1}return!0}}return!1}function ti(e){return Array.isArray(e)?e.map(ti):ae(e)==="object"&&e!==null?Object.fromEntries(Object.entries(e).map(function(t){var n=Un(t,2),r=n[0],o=n[1];return[r,ti(o)]})):e}function Q1(e){return/^(0|[1-9][0-9]*)$/g.test(e)?En(Number(e)):Vn(new Fr('Invalid array index "'.concat(e,'"')))}function i9(e,t){return e==="-"?En(t.length):fn(Q1(e),jv(function(n){return n<=t.length},function(){return new Fr("Array index out of bounds")}))}function Nj(e,t){return fn(Q1(e),jv(function(n){return n<t.length},function(){return new Fr("Array index out of bounds")}))}function s9(e,t,n){if(Array.isArray(e))return fn(Nj(t,e),to(function(o){var i=e[o];return e[o]=n,i}));if(ae(e)==="object"&&e!==null)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];return e[t]=n,En(r)}else return Vn(new Fr("Cannot replace object element which does not exist"));return Vn(new Fr("Cannot replace in non-object/array"))}function a9(e,t,n){return Pj(t)?fn(eS(e,t),Cl(function(r){var o=Un(r,2),i=o[0],s=o[1];return s9(i,s,n)}),to(function(r){return[e,r]})):En([n,e])}function Tj(e,t){return Array.isArray(e)?fn(Q1(t),Cl(function(n){return n>=e.length?Vn(new Fr("Array index out of bounds")):En(e[n])})):ae(e)==="object"&&e!==null?Object.prototype.hasOwnProperty.call(e,t)?En(e[t]):En(void 0):Vn(new Fr("Cannot access non-object/array"))}function eS(e,t){for(var n=e,r=t[0],o=0;o<t.length-1;++o,r=t[o]){var i=Tj(n,r);if(Mv(i))return i;if(i.value===void 0)return Vn(new Fr("Path refers to non-existing object/array"));n=i.value}return En([n,r])}function Nx(e,t){return fn(t,j1(function(n,r){return fn(Tj(n,r),jv(function(o){return o!==void 0},function(){return new Fr("Path refers to non-existing object/array")}))},e))}function l9(e,t){if(Array.isArray(e))return fn(Nj(t,e),to(function(r){var o=e.splice(r,1),i=Un(o,1),s=i[0];return s}));if(ae(e)==="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];return delete e[t],En(n)}return Vn(new Fr("Cannot remove from non-object/array"))}function UC(e,t){return fn(eS(e,t),Cl(function(n){var r=Un(n,2),o=r[0],i=r[1];return l9(o,i)}))}function c9(e,t,n){if(Array.isArray(e))return fn(i9(t,e),to(function(o){e.splice(o,0,n)}));if(ae(e)==="object"&&e!==null){var r;return Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t]),e[t]=n,En(r)}return Vn(new Fr("Cannot add to non-object/array"))}function Tx(e,t,n){return Pj(t)?fn(eS(e,t),Cl(function(r){var o=Un(r,2),i=o[0],s=o[1];return c9(i,s,n)}),to(function(r){return[e,r]})):En([n,e])}function Bp(e){var t=Un(e,1),n=t[0];return n}var u9=function(){function e(){Nn(this,e)}return Tn(e,[{key:"get",value:function(n,r){return Nx(n,r)}},{key:"add",value:function(n,r,o){return fn(Tx(n,r,o),to(Bp))}},{key:"remove",value:function(n,r){return fn(UC(n,r),to(function(){return n}))}},{key:"replace",value:function(n,r,o){return fn(a9(n,r,o),to(Bp))}},{key:"move",value:function(n,r,o){return fn(UC(n,r),Cl(function(i){return Tx(n,o,i)}),to(Bp))}},{key:"copy",value:function(n,r,o){return fn(Nx(n,r),Cl(function(i){return Tx(n,o,ti(i))}),to(Bp))}},{key:"test",value:function(n,r,o){return fn(Nx(n,r),to(function(i){return du(o,i)}))}}])}();function d9(e,t,n){switch(n.op){case"add":return t.add(e,n.path,n.value);case"remove":return t.remove(e,n.path);case"replace":return t.replace(e,n.path,n.value);case"move":return t.move(e,n.from,n.path);case"copy":return t.copy(e,n.from,n.path);case"test":return t.test(e,n.path,n.value)?En(e):Vn(new Fr("Test failed"));case"file":return Vn(new Fr("Cannot apply a file patch here"))}}function f9(e,t,n){return fn(n,j1(function(r,o){return d9(r,t,o)},e))}function h9(e,t){return!e||!t?!1:e.length===1&&e[0].op==="replace"&&t.length===1&&t[0].op==="replace"?e[0].path.join("/")===t[0].path.join("/"):!1}function fc(e,t){if(!t||t.length===0)return new Set([e.type]);const n=new Set;let r=e,o=-1;for(const i of t){if(o++,!r)break;if(r.type==="array")r=r.item;else if(r.type==="record")r=r.item;else if(r.type==="object")r=r.items[i];else if(r.type==="union")if(typeof r.key=="string"){const s=r.items;for(const a of s){const l=fc(a,t.slice(o));for(const c of Array.from(l.values()))n.add(c)}return n}else{if(o!==t.length-1)throw new Error("Found string union (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else if(r.type==="boolean"||r.type==="number"||r.type==="string"||r.type==="date"||r.type==="file"||r.type==="image"||r.type==="keyOf"||r.type==="literal"||r.type==="richtext"){if((r.type==="image"||r.type==="file")&&t[o]==="metadata")break;if(o!==t.length-1)throw new Error("Found "+r.type+" (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else{const a=r.type;return console.error(`Unexecpted resolved schema type: ${a} in ${t.join("/")} at ${i}`),new Set([a])}}return r&&(n.add(r.type),r.type==="union"&&(typeof r.key=="string"?n.add("object"):n.add("string"))),n}class yd{constructor(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}reset(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}getInsertedPatches(){return this.insertedPatches}insertPath(t,n,r,o,i,s,a,l){let c=n.length>0?`${t}?${n.join("/")}`:t;const u=[];for(let d=this.orderedInsertKeys.length-1;d>=0;d--){const h=this.orderedInsertKeys[d];c!==h?c.startsWith(h)?(c=h,this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c)):h.startsWith(c)&&u.push(d):(this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c))}for(const d of u){const h=this.orderedInsertKeys[d];this.orderedInsertKeys.splice(d,1);const p=this.patchSetMetadata[h];if(this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:Array.from(a),lastUpdated:o,lastUpdatedBy:i}),p)for(const m of p.patches.slice())this.patchSetMetadata[c].patches.unshift(m),m.author!==null&&this.patchSetMetadata[c].authors.unshift(m.author),this.patchSetMetadata[c].opTypes.unshift(m.opType);else throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${h}`);h!==c&&delete this.patchSetMetadata[h]}this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:a,lastUpdated:o,lastUpdatedBy:i}),i!==null&&!this.patchSetMetadata[c].authors.includes(i)&&this.patchSetMetadata[c].authors.unshift(i),this.patchSetMetadata[c].lastUpdatedBy=i,this.patchSetMetadata[c].lastUpdated=o,this.patchSetMetadata[c].opTypes.includes(s)||this.patchSetMetadata[c].opTypes.unshift(s),this.patchSetMetadata[c].patches.unshift({patchPath:l,patchId:r,author:i,createdAt:o,opType:s,schemaTypes:a}),this.orderedInsertKeys.includes(c)||this.orderedInsertKeys.unshift(c)}insert(t,n,r,o,i,s){if(!this.insertedPatches.has(o)){if(!n){this.insertPath(t,[],o,i,s,r.op,[],r.path);return}if(this.insertedPatches.add(o),!(r.op==="file"||r.op==="test"))try{if(r.op==="replace"){const a=fc(n,r.path);this.insertPath(t,r.path,o,i,s,r.op,Array.from(a),r.path)}else if(r.op==="add"||r.op==="remove"||r.op==="move"||r.op==="copy"){const a=r.path.slice(0,-1),l=fc(n,a);if(l.size===1&&l.has("array")){if(this.insertPath(t,a,o,i,s,r.op,Array.from(l),r.path),r.op==="move"){const c=r.from.slice(0,-1),u=fc(n,c);this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path)}}else if(l.size===1&&l.has("record")){const c=r.path,u=fc(n,c);if(this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path),r.op==="move"){const d=r.from,h=fc(n,d);this.insertPath(t,d,o,i,s,r.op,Array.from(h),r.path)}}else{if(l.size===1&&!(l.has("image")||l.has("file")))throw new Error(`Cannot perform op: '${r.op}' on non-array or non-record schema. Type: ${l.values().next().value}`);this.insertPath(t,a,o,i,s,r.op,[n.type],r.path)}}else{const a=r;throw new Error("Unreachable op: "+a)}}catch(a){a instanceof Error?console.error("Could not resolve path while creating patch set",a.message):console.error("Could not resolve path while creating patch set",a),this.insertPath(t,[],o,i,s,r.op,[n.type],r.path)}}}isInserted(t){return this.insertedPatches.has(t)}serialize(){return this.orderedInsertKeys.map(t=>{if(t in this.patchSetMetadata)return this.patchSetMetadata[t];throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${t}`)})}}class p9{constructor(t,n=void 0){this.client=t,this.overlayEmitter=n,this.autoPublish=!1,this.isSyncing=!1,this.MIN_WAIT_SECONDS=1,this.MAX_WAIT_SECONDS=5,this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.baseSha=null,this.sourcesSha=null,this.mode=null,this.optimisticClientSources={},this.serverSources=null,this.previews=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new yd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedPreviewSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0}setAutoPublish(t,n){this.autoPublish=n;try{localStorage.setItem("val-auto-publish",n.toString())}catch{}return this.invalidateAutoPublish(),this.sync(t)}loadAutoPublish(){try{this.autoPublish=localStorage.getItem("val-auto-publish")==="true",this.invalidateAutoPublish()}catch{}}async init(t,n,r,o,i,s,a,l){this.mode=t,this.baseSha=n,this.commitSha=a,this.sourcesSha=o,this.authorId=s;const c=Date.now();t==="fs"?this.loadAutoPublish():this.autoPublish=!1;const u=await this.syncWithUpdatedStat(t,n,r,o,i,s,a,l);return u.status==="done"&&(await this.syncPatches(!0,l),this.publishDisabled=!1,this.invalidatePublishDisabled(),this.initializedAt=l+(Date.now()-c),this.invalidateInitializedAt()),u}reset(){console.debug("Resetting ValSyncEngine"),this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.sourcesSha=null,this.optimisticClientSources={},this.serverSources=null,this.previews=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new yd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedPreviewSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0,this.invalidateInitializedAt()}subscribe(t,n){const r=n||Dn;return o=>{const i=this.listeners;i[t]||(i[t]={}),i[t][r]||(i[t][r]=[]);const s=i[t][r].push(o)-1;return()=>{var a;(a=i[t])==null||a[r].splice(s,1)}}}emit(t){if(t)for(const n of t)n()}setCommitSha(t){this.commitSha=t}invalidateInitializedAt(){var t;this.cachedInitializedAtSnapshot=null,this.emit((t=this.listeners["initialized-at"])==null?void 0:t[Dn])}invalidateSource(t){var n;this.cachedSourceSnapshots!==null&&(this.cachedSourceSnapshots={...this.cachedSourceSnapshots,[t]:void 0}),this.cachedAllSourcesSnapshot=null,this.emit((n=this.listeners.source)==null?void 0:n[t])}invalidatePreview(t){var n;this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedPreviewSnapshots={...this.cachedPreviewSnapshots,[t]:null},this.emit((n=this.listeners.preview)==null?void 0:n[t])}invalidateSyncStatus(t){var n;this.cachedSyncStatus={...this.cachedSyncStatus,[t]:void 0},this.emit((n=this.listeners["sync-status"])==null?void 0:n[t])}invalidateValidationError(t){var n;this.emit((n=this.listeners["validation-error"])==null?void 0:n[t])}invalidateAllValidationErrors(){var t;this.cachedValidationErrors=null,this.emit((t=this.listeners["all-validation-errors"])==null?void 0:t[Dn])}invalidateGlobalTransientErrors(){var t;this.cachedGlobalTransientErrorSnapshot=null,this.emit((t=this.listeners["global-transient-errors"])==null?void 0:t[Dn])}invalidateNetworkError(){var t;this.cachedNetworkErrorSnapshot=void 0,this.emit((t=this.listeners["network-error"])==null?void 0:t[Dn])}invalidatePatchSets(){var t;this.cachedSerializedPatchSetsSnapshot=null,this.emit((t=this.listeners["patch-sets"])==null?void 0:t[Dn])}invalidatePendingOps(){var t;this.cachedPendingOpsCountSnapshot=null,this.emit((t=this.listeners["pending-ops-count"])==null?void 0:t[Dn])}invalidateAllPatches(){var t;this.cachedPatchData=null,this.emit((t=this.listeners["all-patches"])==null?void 0:t[Dn])}invalidateSchema(){var t,n;this.cachedAllSchemasSnapshot=null,this.cachedSchemaSnapshots=null,this.cachedAllSourcesSnapshot=null,this.emit((t=this.listeners.schema)==null?void 0:t[Dn]),this.invalidateAllValidationErrors();for(const r in((n=this.listeners)==null?void 0:n["validation-error"])||{}){const o=r;this.invalidateValidationError(o)}}invalidateParentRef(){var t;this.cachedParentRef=void 0,this.emit((t=this.listeners["parent-ref"])==null?void 0:t[Dn])}invalidateGlobalServerSidePatchIds(){var t;this.cachedGlobalServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["global-server-side-patch-ids"])==null?void 0:t[Dn])}invalidatePendingClientSidePatchIds(){var t;this.cachedPendingClientSidePatchIdsSnapshot=null,this.emit((t=this.listeners["pending-client-side-patch-ids"])==null?void 0:t[Dn])}invalidateSyncedServerSidePatchIds(){var t;this.cachedSyncedServerSidePatchIdsSnapshot=null,this.emit((t=this.listeners["synced-server-side-patch-ids"])==null?void 0:t[Dn])}invalidateSavedServerSidePatchIds(){var t;this.cachedSavedServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["saved-server-side-patch-ids"])==null?void 0:t[Dn])}invalidatePublishDisabled(){var t;this.cachedPublishDisabledSnapshot=null,this.emit((t=this.listeners["publish-disabled"])==null?void 0:t[Dn])}invalidateAutoPublish(){var t;this.cachedAutoPublishSnapshot=null,this.emit((t=this.listeners["auto-publish"])==null?void 0:t[Dn])}getSchemaSnapshot(t){if(this.cachedSchemaSnapshots===null&&(this.cachedSchemaSnapshots={}),this.cachedSchemaSnapshots[t]===void 0)if(!this.schemas)this.cachedSchemaSnapshots[t]={status:"no-schemas"};else{const n=this.schemas[t];n?this.cachedSchemaSnapshots[t]={status:"success",data:ti(n)}:this.cachedSchemaSnapshots[t]={status:"module-schema-not-found"}}return this.cachedSchemaSnapshots[t]}getPreviewSnapshot(t){var n;return this.cachedPreviewSnapshots===null&&(this.cachedPreviewSnapshots={}),this.cachedPreviewSnapshots[t]===null&&(this.cachedPreviewSnapshots[t]=((n=this.previews)==null?void 0:n[t])||null),this.cachedPreviewSnapshots[t]}getSourceSnapshot(t){var n;if(this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedSourceSnapshots[t]===void 0){const r=this.optimisticClientSources[t]!==void 0?this.optimisticClientSources[t]:(n=this.serverSources)==null?void 0:n[t];this.schemas===null?this.cachedSourceSnapshots[t]={status:"no-schemas"}:this.schemas[t]?r===void 0?this.cachedSourceSnapshots[t]={status:"source-not-found"}:this.cachedSourceSnapshots[t]={status:"success",data:ti(r),optimistic:this.optimisticClientSources[t]!==void 0}:this.cachedSourceSnapshots[t]={status:"schema-not-found"}}return this.cachedSourceSnapshots[t]}getAllSourcesSnapshot(){var t;if(this.cachedAllSourcesSnapshot===null){this.cachedAllSourcesSnapshot={};for(const n in this.schemas||{}){const r=n,o=this.optimisticClientSources[r]||((t=this.serverSources)==null?void 0:t[r]);o&&(this.cachedAllSourcesSnapshot[r]=ti(o))}}return this.cachedAllSourcesSnapshot}getAllSchemasSnapshot(){var t;this.cachedAllSchemasSnapshot===null&&(this.cachedAllSchemasSnapshot={});for(const n in this.schemas||{}){const r=n,o=(t=this.schemas)==null?void 0:t[r];o&&(this.cachedAllSchemasSnapshot[r]=ti(o))}return this.cachedAllSchemasSnapshot}getValidationErrorSnapshot(t){const n=this.getAllValidationErrorsSnapshot();return n==null?void 0:n[t]}getAllValidationErrorsSnapshot(){if(!this.cachedValidationErrors){this.cachedValidationErrors={};for(const t in this.errors.validationErrors){const n=t,r=[];for(const o of this.errors.validationErrors[n]||[])o&&r.push(o);r.length>0&&(this.cachedValidationErrors[n]=r)}}return this.cachedValidationErrors}getSyncStatusSnapshot(t){return this.cachedSyncStatus===null&&(this.cachedSyncStatus={}),this.cachedSyncStatus[t]===void 0&&(this.cachedSyncStatus[t]=this.syncStatus[t]||null),this.syncStatus[t]}getPendingOpsSnapshot(){return this.cachedPendingOpsCountSnapshot===null&&(this.cachedPendingOpsCountSnapshot=this.pendingOps.length),this.cachedPendingOpsCountSnapshot}getSerializedPatchSetsSnapshot(){return this.cachedSerializedPatchSetsSnapshot||(this.cachedSerializedPatchSetsSnapshot=this.patchSets.serialize()),this.cachedSerializedPatchSetsSnapshot}getInitializedAtSnapshot(){return this.cachedInitializedAtSnapshot===null&&(this.cachedInitializedAtSnapshot={data:this.initializedAt}),this.cachedInitializedAtSnapshot}getAllPatchesSnapshot(){if(!this.cachedPatchData){this.cachedPatchData={};for(const t in this.patchDataByPatchId){const n=t,r=this.patchDataByPatchId[n];r&&(this.cachedPatchData[n]=ti(r))}}return this.cachedPatchData}getGlobalServerSidePatchIdsSnapshot(){var t;return this.cachedGlobalServerSidePatchIdsSnapshot===null&&(this.cachedGlobalServerSidePatchIdsSnapshot=((t=this.globalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedGlobalServerSidePatchIdsSnapshot}getPendingClientSidePatchIdsSnapshot(){var t;return this.cachedPendingClientSidePatchIdsSnapshot===null&&(this.cachedPendingClientSidePatchIdsSnapshot=((t=this.pendingClientPatchIds)==null?void 0:t.slice())||[]),this.cachedPendingClientSidePatchIdsSnapshot}getSyncedServerSidePatchIdsSnapshot(){var t;return this.cachedSyncedServerSidePatchIdsSnapshot===null&&(this.cachedSyncedServerSidePatchIdsSnapshot=((t=this.syncedServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSyncedServerSidePatchIdsSnapshot}getSavedServerSidePatchIdsSnapshot(){var t;return this.cachedSavedServerSidePatchIdsSnapshot===null&&(this.cachedSavedServerSidePatchIdsSnapshot=((t=this.savedButNotYetGlobalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSavedServerSidePatchIdsSnapshot}getPublishDisabledSnapshot(){return this.cachedPublishDisabledSnapshot===null&&(this.cachedPublishDisabledSnapshot=this.publishDisabled),this.cachedPublishDisabledSnapshot}getAutoPublishSnapshot(){return this.cachedAutoPublishSnapshot===null&&(this.cachedAutoPublishSnapshot=this.autoPublish),this.cachedAutoPublishSnapshot}getGlobalTransientErrorsSnapshot(){var t;return this.cachedGlobalTransientErrorSnapshot===null&&(this.cachedGlobalTransientErrorSnapshot=((t=this.errors.globalTransientErrorQueue)==null?void 0:t.slice())||[]),this.cachedGlobalTransientErrorSnapshot}getNetworkErrorSnapshot(){return this.cachedNetworkErrorSnapshot===void 0&&(this.cachedNetworkErrorSnapshot=this.errors.hasNetworkErrorTimestamp||null),this.cachedNetworkErrorSnapshot}getParentRefSnapshot(){return this.cachedParentRef===void 0&&(this.cachedParentRef=this.getParentRef()),this.cachedParentRef}addPatchOnClientOnly(t,n,r){var a;const[o]=X.splitModuleFilePathAndModulePath(t);if(this.serverSources===null||((a=this.serverSources)==null?void 0:a[o])===void 0)return this.addGlobalTransientError(`Content at '${o}' is not yet initialized`,r),{status:"patch-error",message:`Content at '${o}' is not yet initialized`,moduleFilePath:o};this.optimisticClientSources[o]===void 0&&(this.optimisticClientSources[o]=this.serverSources[o]);const i=n.filter(l=>l.op!=="file"),s=f9(ti(this.optimisticClientSources[o]),m9,i);if(Tz.isErr(s))return console.error("Could not apply patch:",s.error),this.addGlobalTransientError(`Could apply patch: ${s.error.message}`,r),{status:"patch-error",message:s.error.message,moduleFilePath:o};{const l=s.value,c=ti(this.optimisticClientSources[o]);return this.optimisticClientSources[o]=l,{status:"optimistic-client-sources-updated",moduleFilePath:o,prevSource:c,patch:n}}}async addPatchAwaitable(t,n,r,o,i){const s=this.addPatchOnClientOnly(t,r,i);if(s.status!=="optimistic-client-sources-updated")return s;const{moduleFilePath:a,patch:l}=s,c={type:"add-patches",data:{[a]:[{patch:l,patchId:o,type:n}]},createdAt:i};let u=0;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);let d=await this.executeAddPatches(c,{},i);for(;d.status==="retry"&&u<3&&(u++,await new Promise(h=>setTimeout(h,500*(u+1))),d=await this.executeAddPatches(c,{},i),d.status==="retry"););return this.syncStatus[t]="done",this.invalidateSyncStatus(t),d.status==="done"?{status:"patch-synced",patchId:o,parentRef:d.parentRef,moduleFilePath:a}:(this.optimisticClientSources[a]=s.prevSource,{status:"patch-sync-error",message:"Could not sync patch. Tried 3 times.",moduleFilePath:a})}addPatch(t,n,r,o){var l,c,u,d,h,p,m,v,x,b,w;const i=this.addPatchOnClientOnly(t,r,o);if(i.status!=="optimistic-client-sources-updated")return i;const s=i.moduleFilePath;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);const a=this.pendingOps[this.pendingOps.length-1];if((a==null?void 0:a.type)==="add-patches"){const S=(((c=(l=a.data)==null?void 0:l[s])==null?void 0:c.length)||0)-1,C=(h=(d=(u=a.data)==null?void 0:u[s])==null?void 0:d[S])==null?void 0:h.patch,_=(v=(m=(p=a.data)==null?void 0:p[s])==null?void 0:m[S])==null?void 0:v.patchId;if(h9(C,r)&&((w=(b=(x=a.data)==null?void 0:x[s])==null?void 0:b[S])==null?void 0:w.type)===n&&_&&this.patchDataByPatchId[_])return a.data[s][S].patch=r,a.updatedAt=o,this.invalidatePendingOps(),this.patchDataByPatchId[_].patch=r,this.patchSetInsert(s,_,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-merged",patchId:_,moduleFilePath:s};{a.data[s]||(a.data[s]=[]);const P=this.createPatchId();return a.data[s].push({patch:r,type:n,patchId:P}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(P),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[P]={moduleFilePath:s,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(s,P,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-added",patchId:P,moduleFilePath:s}}}else{const S=this.createPatchId();return this.pendingOps.push({type:"add-patches",data:{[s]:[{patch:r,type:n,patchId:S}]},createdAt:o}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(S),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[S]={moduleFilePath:s,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(s,S,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-added",patchId:S,moduleFilePath:s}}}createPatchId(){return crypto.randomUUID()}patchSetInsert(t,n,r,o){var s;const i=new Date(o).toISOString();for(const a of r)this.patchSets.insert(t,((s=this.schemas)==null?void 0:s[t])??void 0,a,n,i,this.authorId);this.invalidatePatchSets()}deletePatches(t,n){const r=this.pendingOps[this.pendingOps.length-1];if((r==null?void 0:r.type)==="delete-patches"){r.patchIds.push(...t),r.updatedAt=n;return}this.pendingOps.push({type:"delete-patches",patchIds:t,createdAt:n}),this.invalidatePendingOps()}markAllSyncStatusIn(t,n){for(const r in this.syncStatus)r.startsWith(t)&&(this.syncStatus[r]=n)}getParentRef(){if(this.baseSha===null||this.globalServerSidePatchIds===null)return null;const t=this.savedButNotYetGlobalServerSidePatchIds[this.savedButNotYetGlobalServerSidePatchIds.length-1]||this.globalServerSidePatchIds[this.globalServerSidePatchIds.length-1];return t?{type:"patch",patchId:t}:{type:"head",headBaseSha:this.baseSha}}async syncWithUpdatedStat(t,n,r,o,i,s,a,l){const c=this.sourcesSha!==o;if(this.sourcesSha=o,this.baseSha=n,this.mode=t,this.serverSideSchemaSha!==r||this.commitSha!==a)return this.reset(),this.serverSideSchemaSha=r,this.commitSha=a,this.init(t,n,r,o,i,s,a,l);const u=this.globalServerSidePatchIds===null||!du(this.globalServerSidePatchIds,i);if(u){this.globalServerSidePatchIds=i;const d=new Set(i);this.deletePendingPatchId(d),this.deleteSavedButNotYetGlobalServerSidePatchIds(d),await this.syncPatches(!1,l),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),this.invalidatePendingClientSidePatchIds()}return!this.forceSyncAllModules&&(c||u)&&(this.forceSyncAllModules=!0),this.sync(l)}async executeAddPatches(t,n,r){const o=[],i=[];for(const[l,c]of Object.entries(t.data)){const u=l;for(const d of c)o.push({path:u,patchId:d.patchId,patch:d.patch}),i.push(d.patchId),n[u]||(n[u]=new Set),n[u].add(d.type)}const s=this.getParentRef();if(s===null)return this.addGlobalTransientError("Tried to update content with changes, but could not since Val is not yet initialized",r),{status:"retry",reason:"not-initialized"};const a=await this.client("/patches","PUT",{body:{patches:o,parentRef:s}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return console.warn("Network error: trying again..."),this.addNetworkError(r),{status:"retry",reason:"network-error"};if(a.status===409)return this.savedButNotYetGlobalServerSidePatchIds=[],{status:"retry",reason:"conflict"};if(a.status!==200){console.error("Failed to add patches",{error:a.json.message}),this.addGlobalTransientError("Failed to save changes",r,a.json.message);for(const c of i)this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0};const l=new Set(i);this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!l.has(c))}else{const l=new Set(a.json.newPatchIds);this.deletePendingPatchId(l);for(const c of i){const u=c;this.savedButNotYetGlobalServerSidePatchIds.push(u),this.patchDataByPatchId[u]&&(this.patchDataByPatchId[u].isPending=!1)}}return{status:"done",parentRef:s}}deletePendingPatchId(t){let n=0;for(let r=0;r<this.pendingClientPatchIds.length;r++){const o=this.pendingClientPatchIds[r];if(t.has(o)&&(this.pendingClientPatchIds.splice(r,1),r--,n++,t.size===n))break}}deleteSavedButNotYetGlobalServerSidePatchIds(t){let n=0;for(let r=0;r<this.savedButNotYetGlobalServerSidePatchIds.length;r++){const o=this.savedButNotYetGlobalServerSidePatchIds[r];if(t.has(o)&&(this.savedButNotYetGlobalServerSidePatchIds.splice(r,1),r--,n++,t.size===n))break}}async executeDeletePatches(t,n,r){var l;let o=!1;const i=t.patchIds,s=new Set(i),a=await this.client("/patches","DELETE",{query:{id:t.patchIds.reverse()}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return this.addNetworkError(r),{status:"retry",reason:"network-error"};if(a.status!==200)this.addGlobalTransientError("Failed to delete patches",r);else{for(const c of t.patchIds)if(this.patchDataByPatchId[c]){const u=this.patchDataByPatchId[c].moduleFilePath;n[u]||(n[u]=new Set),n[u].add("unknown"),this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0}}else o=!0;this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!s.has(c)),this.globalServerSidePatchIds=((l=this.globalServerSidePatchIds)==null?void 0:l.filter(c=>!s.has(c)))??null}return{status:"done",syncAllRequired:o}}async syncSchema(){const t=await this.client("/schema","GET",{});if(t.status===200){this.schemas={};for(const[n,r]of Object.entries(t.json.schemas)){const o=n;r&&(this.schemas[o]=r)}return this.clientSideSchemaSha!==t.json.schemaSha&&(this.clientSideSchemaSha=t.json.schemaSha),console.debug("Invalidating schema"),this.invalidateSchema(),{status:"done"}}else if(t.status===null)return{status:"retry",reason:"error"};return{status:"retry",reason:"error"}}async syncPatches(t,n){var l;const r=this.globalServerSidePatchIds||[];let o=!1,i=!1;if(this.initializedAt===null||t){this.patchSets=new yd,o=!0;const c=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:void 0}});if(c.status!==200)return this.addGlobalTransientError("Failed to get changes (full sync)",n,`Did not get ok status (got: ${c.status}): ${c.json.message}`),{status:"retry"};for(const u of c.json.patches)u.patch&&(i=!0,this.patchDataByPatchId[u.patchId]={moduleFilePath:u.path,patch:u.patch,isPending:!1,createdAt:u.createdAt,authorId:u.authorId,isCommitted:u.appliedAt?{commitSha:u.appliedAt.commitSha}:void 0});c.json.error&&this.addGlobalTransientError("Some changes has errors",n,c.json.error.message);for(const u of Object.values(c.json.errors||{}))u&&this.addGlobalTransientError("A change has an error",n,u.message)}else{const c=[];for(const u of this.globalServerSidePatchIds||[])this.patchDataByPatchId[u]||c.push(u);if(c.length>0){const d=[];for(let h=0;h<c.length;h+=100)d.push(c.slice(h,h+100));for(const h of d){const p=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:h}});if(p.status!==200)return this.addGlobalTransientError("Failed to get changes (batch)",n,`Did not get ok status (got: ${p.status}): ${p.json.message}`),{status:"retry"};for(const m of p.json.patches)m.patch&&(i=!0,this.patchDataByPatchId[m.patchId]={moduleFilePath:m.path,patch:m.patch,isPending:!1,createdAt:m.createdAt,authorId:m.authorId,isCommitted:m.appliedAt?{commitSha:m.appliedAt.commitSha}:void 0})}}}const s=new Set(r);for(const c of Array.from(this.patchSets.getInsertedPatches())||[])if(!s.has(c)){this.patchSets=new yd,o=!0;break}const a=[];for(const c of r)if(!this.patchSets.isInserted(c)){const u=this.patchDataByPatchId[c],d=(u==null?void 0:u.moduleFilePath)&&((l=this.schemas)==null?void 0:l[u==null?void 0:u.moduleFilePath]);if(u&&d)for(const h of u.patch)o=!0,this.patchSets.insert(u.moduleFilePath,d,h,c,u.createdAt,u.authorId);else a.push(c)}return i&&this.invalidateAllPatches(),o&&this.invalidatePatchSets(),a.length>0?(this.initializedAt!==null&&(console.debug("Missing data for patch ids",a,{currentPatchIds:r,reset:t}),this.mode!=="fs"&&this.addGlobalTransientError("Failed to get changes",n,`Missing data for patch ids: ${a.join(", ")}`)),{status:"retry"}):{status:"done"}}getChangedModules(t){const n=Object.entries(t);if(n.length===0)return[];if(n.length===1){const[r,o]=n[0];if(Array.from(o).every(i=>g9.includes(i)))return[r]}return"all"}async sync(t){var s,a,l,c,u,d,h,p;if(this.isSyncing)return{status:"retry",reason:"already-syncing"};if(this.isPublishing)return{status:"retry",reason:"publishing"};let n=[];this.forceSyncAllModules&&(this.forceSyncAllModules=!1,n="all"),this.initializedAt===null&&(n="all"),this.clientSideSchemaSha!==this.serverSideSchemaSha&&(n="all"),this.isSyncing=!0;let r=[],o=!1;const i=new Set([...this.syncedServerSidePatchIds,...this.savedButNotYetGlobalServerSidePatchIds]);if(this.globalServerSidePatchIds&&this.mode==="http"){for(const m of i)if(!this.globalServerSidePatchIds.includes(m)){this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingClientPatchIds=[],await this.syncPatches(!0,t),o=!0;break}}try{const m={},v=(w,S)=>t-S<=w*1e3,x=(w,S)=>t-S>=w*1e3;if(((s=this.pendingOps[this.pendingOps.length-1])==null?void 0:s.updatedAt)!==void 0&&v(this.MIN_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].updatedAt)&&!x(this.MAX_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].createdAt))return{status:"retry",reason:"too-fast"};r=this.pendingOps.slice(),this.pendingOps=[];let b=!1;for(;r[0];){const w=r[0];if(w.type==="add-patches")try{const S=await this.executeAddPatches(w,m,t);if(S.status!=="done")return S}catch{return{status:"retry",reason:"error"}}else if(w.type==="delete-patches")try{const S=await this.executeDeletePatches(w,m,t);if(S.status!=="done")return S;S.syncAllRequired&&n!=="all"&&(n="all")}catch{return{status:"retry",reason:"error"}}b=!0,r.shift()}if(this.invalidatePendingOps(),n!=="all"){const w=this.getChangedModules(m);if(w==="all")n="all";else for(const S of w)n.push(S)}if(this.clientSideSchemaSha===null||this.schemas===null||this.initializedAt===null){const w=await this.syncSchema();if(w.status!=="done")return w}if(console.debug("Syncing?",{changedModules:n}),n==="all"||n.length>0){const w=n!=="all"&&n.length===1?n[0]:void 0,S=await this.client("/sources/~","PUT",{path:w,query:{validate_sources:!0,validate_binary_files:!1}});if(S.status!==null&&this.resetNetworkError(),S.status===null&&S.json.type==="network_error")return this.addNetworkError(t),{status:"retry",reason:"network-error"};if(S.status!==200)this.addGlobalTransientError("Could not sync content with server. Please wait or reload the application.",t,S.json.message);else{const C=new Set;for(const _ in this.errors.validationErrors){const P=_;(w===void 0||P.startsWith(w))&&(C.add(P),this.errors.validationErrors[P]&&(this.errors.validationErrors={...this.errors.validationErrors,[P]:void 0}))}for(const[_,P]of Object.entries(S.json.modules)){const O=_;if(P){this.serverSources===null&&(this.serverSources={}),this.serverSources[O]=P.source,this.previews===null&&(this.previews={}),this.previews[O]=P.preview||null,this.invalidatePreview(O),(du(this.serverSources[O],this.optimisticClientSources[O])||this.pendingOps.length===0)&&(this.optimisticClientSources={...this.optimisticClientSources,[O]:void 0}),console.debug("Invalidating source",O),this.invalidateSource(O),(a=this.overlayEmitter)==null||a.call(this,O,P.source);for(const M in P.validationErrors){const I=M;this.errors.validationErrors||(this.errors.validationErrors={}),this.errors.validationErrors[I]=P.validationErrors[I],C.add(I)}for(const M of((l=P.patches)==null?void 0:l.applied)||[])this.syncedServerSidePatchIds.push(M);for(const M of((c=P.patches)==null?void 0:c.skipped)||[])this.syncedServerSidePatchIds.push(M)}else this.addGlobalTransientError(`Could not find '${O}' in server reply`,t,"This is most likely a bug");this.markAllSyncStatusIn(O,"done")}this.invalidateAllValidationErrors();for(const _ of Array.from(C))this.invalidateValidationError(_);S.json.schemaSha!==this.clientSideSchemaSha&&await this.syncSchema()}}if(this.autoPublish&&this.mode==="fs"&&this.globalServerSidePatchIds&&this.globalServerSidePatchIds.length>0){let w=!1;for(const S in this.errors.validationErrors||{}){const C=S;if((d=(u=this.errors)==null?void 0:u.validationErrors)!=null&&d[C]&&((p=(h=this.errors)==null?void 0:h.validationErrors)==null?void 0:p[C].length)>0){w=!0;break}}w?console.debug("Skip auto-publish since there's validation errors",this.errors.validationErrors):(await this.publish(this.globalServerSidePatchIds.concat(...Array.from(this.syncedServerSidePatchIds)),void 0,t),b=!0)}return(o||b)&&(this.invalidatePendingClientSidePatchIds(),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds()),{status:"done"}}finally{this.isSyncing=!1,this.pendingOps=[...r,...this.pendingOps]}}async publish(t,n,r){try{if(this.isPublishing)return console.debug("Already publishing changes",r),{status:"retry",reason:"already-publishing"};if(this.isPublishing=!0,this.publishDisabled)return console.debug("Could not publish changes, since the publish is disabled",r),{status:"retry",reason:"publish-disabled"};if(this.publishDisabled=!0,this.invalidatePublishDisabled(),Object.values(this.errors.validationErrors||{}).flatMap(s=>s||[]).length>0)return console.debug("Skipping publish since there's validation errors",this.errors.validationErrors),this.addGlobalTransientError("Could not publish changes, since there are validation errors",r),{status:"retry",reason:"validation-error"};if(t.length===0)return this.addGlobalTransientError("Could not publish changes, since there are no changes to publish",Date.now()),{status:"done"};const i=await this.client("/save","POST",{body:{message:n,patchIds:t}});return i.status===null?(this.addGlobalTransientError("Network error: could not publish",Date.now()),{status:"retry"}):i.status!==200?(this.addGlobalTransientError("Failed to publish changes",Date.now(),i.json.message),{status:"retry"}):(this.mode==="fs"&&(this.globalServerSidePatchIds=[],console.debug("Deleting all patch ids")),this.pendingClientPatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.patchDataByPatchId={},this.patchSets=new yd,await this.syncPatches(!0,r),this.invalidatePatchSets(),this.invalidateAllPatches(),this.invalidatePendingClientSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),{status:"done"})}catch(o){return console.error("Error while publishing",o),this.addGlobalTransientError("Failed to publish changes",Date.now(),o.message),{status:"retry",reason:"error"}}finally{this.isPublishing=!1,this.publishDisabled=!1,this.invalidatePublishDisabled()}}resetNetworkError(){this.errors.hasNetworkErrorTimestamp=null,this.invalidateNetworkError()}addNetworkError(t){this.errors.hasNetworkErrorTimestamp=t,this.invalidateNetworkError()}addGlobalTransientError(t,n,r){this.errors.globalTransientErrorQueue||(this.errors.globalTransientErrorQueue=[]),console.error("Global transient error",t,r||""),this.errors.globalTransientErrorQueue.push({message:t,details:r,timestamp:n,id:crypto.randomUUID()}),this.invalidateGlobalTransientErrors()}removeGlobalTransientErrors(t){if(this.errors.globalTransientErrorQueue){const n=new Set(t);this.errors.globalTransientErrorQueue=this.errors.globalTransientErrorQueue.filter(r=>!n.has(r.id)),this.invalidateGlobalTransientErrors()}}}const m9=new u9,Dn="global",g9=["string","boolean","number","date","richtext","file","image"],v9=(e,t)=>{window.dispatchEvent(new CustomEvent("val-event",{detail:{type:"source-update",moduleFilePath:e,source:t}}))};function y9(e,t,n){var o,i,s;const r={};for(const a of e)r[a.commitSha]=a;for(const a of t)r[a.commitSha]||(r[a.commitSha]={commitMessage:(a==null?void 0:a.commitMessage)||null,deploymentState:"created",creator:a.creator,createdAt:a.createdAt,updatedAt:a.createdAt,commitSha:a.commitSha});for(const a of n)a.commitSha&&(r[a.commitSha]={commitMessage:((o=r[a.commitSha])==null?void 0:o.commitMessage)||null,deploymentState:a.deploymentState,creator:((i=r[a.commitSha])==null?void 0:i.creator)||null,createdAt:((s=r[a.commitSha])==null?void 0:s.createdAt)||a.createdAt,updatedAt:a.updatedAt,commitSha:a.commitSha});return Object.values(r).sort((a,l)=>new Date(l.updatedAt).getTime()-new Date(a.updatedAt).getTime())}function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function x9(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Fv(...e){return t=>e.forEach(n=>x9(n,t))}function $e(...e){return g.useCallback(Fv(...e),e)}function b9(e,t){const n=g.createContext(t),r=i=>{const{children:s,...a}=i,l=g.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=g.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function ho(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];const c=d=>{var b;const{scope:h,children:p,...m}=d,v=((b=h==null?void 0:h[e])==null?void 0:b[l])||a,x=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:x,children:p})};c.displayName=i+"Provider";function u(d,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,w9(o,...t)]}function w9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ns=g.forwardRef((e,t)=>{const{children:n,...r}=e,o=g.Children.toArray(n),i=o.find(S9);if(i){const s=i.props.children,a=o.map(l=>l===i?g.Children.count(s)>1?g.Children.only(null):g.isValidElement(s)?s.props.children:null:l);return f.jsx(kb,{...r,ref:t,children:g.isValidElement(s)?g.cloneElement(s,void 0,a):null})}return f.jsx(kb,{...r,ref:t,children:n})});ns.displayName="Slot";var kb=g.forwardRef((e,t)=>{const{children:n,...r}=e;if(g.isValidElement(n)){const o=E9(n);return g.cloneElement(n,{...k9(r,n.props),ref:t?Fv(t,o):o})}return g.Children.count(n)>1?g.Children.only(null):null});kb.displayName="SlotClone";var Oj=({children:e})=>f.jsx(f.Fragment,{children:e});function S9(e){return g.isValidElement(e)&&e.type===Oj}function k9(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function E9(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var C9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Te=C9.reduce((e,t)=>{const n=g.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?ns:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Mj(e,t){e&&jr.flushSync(()=>e.dispatchEvent(t))}function tn(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function _9(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var P9="DismissableLayer",Eb="dismissableLayer.update",N9="dismissableLayer.pointerDownOutside",T9="dismissableLayer.focusOutside",HC,jj=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hl=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=g.useContext(jj),[u,d]=g.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),m=$e(t,O=>d(O)),v=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(x),w=u?v.indexOf(u):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,C=w>=b,_=j9(O=>{const M=O.target,I=[...c.branches].some(L=>L.contains(M));!C||I||(o==null||o(O),s==null||s(O),O.defaultPrevented||a==null||a())},h),P=R9(O=>{const M=O.target;[...c.branches].some(L=>L.contains(M))||(i==null||i(O),s==null||s(O),O.defaultPrevented||a==null||a())},h);return _9(O=>{w===c.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},h),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(HC=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),WC(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=HC)}},[u,h,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),WC())},[u,c]),g.useEffect(()=>{const O=()=>p({});return document.addEventListener(Eb,O),()=>document.removeEventListener(Eb,O)},[]),f.jsx(Te.div,{...l,ref:m,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,P.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,_.onPointerDownCapture)})});Hl.displayName=P9;var O9="DismissableLayerBranch",M9=g.forwardRef((e,t)=>{const n=g.useContext(jj),r=g.useRef(null),o=$e(t,r);return g.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),f.jsx(Te.div,{...e,ref:o})});M9.displayName=O9;function j9(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){Rj(N9,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function R9(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e),r=g.useRef(!1);return g.useEffect(()=>{const o=i=>{i.target&&!r.current&&Rj(T9,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function WC(){const e=new CustomEvent(Eb);document.dispatchEvent(e)}function Rj(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Mj(o,i):o.dispatchEvent(i)}var _n=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},I9=hF.useId||(()=>{}),A9=0;function Ar(e){const[t,n]=g.useState(I9());return _n(()=>{n(r=>r??String(A9++))},[e]),t?`radix-${t}`:""}const D9=["top","right","bottom","left"],Sa=Math.min,Nr=Math.max,bg=Math.round,Vp=Math.floor,ci=e=>({x:e,y:e}),L9={left:"right",right:"left",bottom:"top",top:"bottom"},F9={start:"end",end:"start"};function Cb(e,t,n){return Nr(e,Sa(t,n))}function rs(e,t){return typeof e=="function"?e(t):e}function is(e){return e.split("-")[0]}function Ru(e){return e.split("-")[1]}function tS(e){return e==="x"?"y":"x"}function nS(e){return e==="y"?"height":"width"}function ka(e){return["top","bottom"].includes(is(e))?"y":"x"}function rS(e){return tS(ka(e))}function z9(e,t,n){n===void 0&&(n=!1);const r=Ru(e),o=rS(e),i=nS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=wg(s)),[s,wg(s)]}function $9(e){const t=wg(e);return[_b(e),t,_b(t)]}function _b(e){return e.replace(/start|end/g,t=>F9[t])}function B9(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function V9(e,t,n,r){const o=Ru(e);let i=B9(is(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(_b)))),i}function wg(e){return e.replace(/left|right|bottom|top/g,t=>L9[t])}function U9(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ij(e){return typeof e!="number"?U9(e):{top:e,right:e,bottom:e,left:e}}function Sg(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function KC(e,t,n){let{reference:r,floating:o}=e;const i=ka(t),s=rS(t),a=nS(s),l=is(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ru(t)){case"start":p[s]-=h*(n&&c?-1:1);break;case"end":p[s]+=h*(n&&c?-1:1);break}return p}const H9=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=KC(c,r,l),h=r,p={},m=0;for(let v=0;v<a.length;v++){const{name:x,fn:b}=a[v],{x:w,y:S,data:C,reset:_}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});u=w??u,d=S??d,p={...p,[x]:{...p[x],...C}},_&&m<=50&&(m++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(c=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:u,y:d}=KC(c,h,l)),v=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:p}};async function rh(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=rs(t,e),m=Ij(p),x=a[h?d==="floating"?"reference":"floating":d],b=Sg(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),C=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},_=Sg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:S,strategy:l}):w);return{top:(b.top-_.top+m.top)/C.y,bottom:(_.bottom-b.bottom+m.bottom)/C.y,left:(b.left-_.left+m.left)/C.x,right:(_.right-b.right+m.right)/C.x}}const W9=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=rs(e,t)||{};if(c==null)return{};const d=Ij(u),h={x:n,y:r},p=rS(o),m=nS(p),v=await s.getDimensions(c),x=p==="y",b=x?"top":"left",w=x?"bottom":"right",S=x?"clientHeight":"clientWidth",C=i.reference[m]+i.reference[p]-h[p]-i.floating[m],_=h[p]-i.reference[p],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let O=P?P[S]:0;(!O||!await(s.isElement==null?void 0:s.isElement(P)))&&(O=a.floating[S]||i.floating[m]);const M=C/2-_/2,I=O/2-v[m]/2-1,L=Sa(d[b],I),U=Sa(d[w],I),$=L,K=O-v[m]-U,W=O/2-v[m]/2+M,B=Cb($,W,K),A=!l.arrow&&Ru(o)!=null&&W!==B&&i.reference[m]/2-(W<$?L:U)-v[m]/2<0,R=A?W<$?W-$:W-K:0;return{[p]:h[p]+R,data:{[p]:B,centerOffset:W-B-R,...A&&{alignmentOffset:R}},reset:A}}}),K9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...x}=rs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=is(o),w=ka(a),S=is(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),_=h||(S||!v?[wg(a)]:$9(a)),P=m!=="none";!h&&P&&_.push(...V9(a,v,m,C));const O=[a,..._],M=await rh(t,x),I=[];let L=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&I.push(M[b]),d){const W=z9(o,s,C);I.push(M[W[0]],M[W[1]])}if(L=[...L,{placement:o,overflows:I}],!I.every(W=>W<=0)){var U,$;const W=(((U=i.flip)==null?void 0:U.index)||0)+1,B=O[W];if(B)return{data:{index:W,overflows:L},reset:{placement:B}};let A=($=L.filter(R=>R.overflows[0]<=0).sort((R,N)=>R.overflows[1]-N.overflows[1])[0])==null?void 0:$.placement;if(!A)switch(p){case"bestFit":{var K;const R=(K=L.filter(N=>{if(P){const D=ka(N.placement);return D===w||D==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(D=>D>0).reduce((D,z)=>D+z,0)]).sort((N,D)=>N[1]-D[1])[0])==null?void 0:K[0];R&&(A=R);break}case"initialPlacement":A=a;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function GC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qC(e){return D9.some(t=>e[t]>=0)}const G9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=rs(e,t);switch(r){case"referenceHidden":{const i=await rh(t,{...o,elementContext:"reference"}),s=GC(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:qC(s)}}}case"escaped":{const i=await rh(t,{...o,altBoundary:!0}),s=GC(i,n.floating);return{data:{escapedOffsets:s,escaped:qC(s)}}}default:return{}}}}};async function q9(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=is(n),a=Ru(n),l=ka(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=rs(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const Y9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await q9(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},J9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...l}=rs(e,t),c={x:n,y:r},u=await rh(t,l),d=ka(is(o)),h=tS(d);let p=c[h],m=c[d];if(i){const x=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+u[x],S=p-u[b];p=Cb(w,p,S)}if(s){const x=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=m+u[x],S=m-u[b];m=Cb(w,m,S)}const v=a.fn({...t,[h]:p,[d]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[d]:s}}}}}},X9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=rs(e,t),u={x:n,y:r},d=ka(o),h=tS(d);let p=u[h],m=u[d];const v=rs(a,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const S=h==="y"?"height":"width",C=i.reference[h]-i.floating[S]+x.mainAxis,_=i.reference[h]+i.reference[S]-x.mainAxis;p<C?p=C:p>_&&(p=_)}if(c){var b,w;const S=h==="y"?"width":"height",C=["top","left"].includes(is(o)),_=i.reference[d]-i.floating[S]+(C&&((b=s.offset)==null?void 0:b[d])||0)+(C?0:x.crossAxis),P=i.reference[d]+i.reference[S]+(C?0:((w=s.offset)==null?void 0:w[d])||0)-(C?x.crossAxis:0);m<_?m=_:m>P&&(m=P)}return{[h]:p,[d]:m}}}},Z9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=rs(e,t),u=await rh(t,c),d=is(o),h=Ru(o),p=ka(o)==="y",{width:m,height:v}=i.floating;let x,b;d==="top"||d==="bottom"?(x=d,b=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,x=h==="end"?"top":"bottom");const w=v-u.top-u.bottom,S=m-u.left-u.right,C=Sa(v-u[x],w),_=Sa(m-u[b],S),P=!t.middlewareData.shift;let O=C,M=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=w),P&&!h){const L=Nr(u.left,0),U=Nr(u.right,0),$=Nr(u.top,0),K=Nr(u.bottom,0);p?M=m-2*(L!==0||U!==0?L+U:Nr(u.left,u.right)):O=v-2*($!==0||K!==0?$+K:Nr(u.top,u.bottom))}await l({...t,availableWidth:M,availableHeight:O});const I=await s.getDimensions(a.floating);return m!==I.width||v!==I.height?{reset:{rects:!0}}:{}}}};function zv(){return typeof window<"u"}function Iu(e){return Aj(e)?(e.nodeName||"").toLowerCase():"#document"}function Dr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bi(e){var t;return(t=(Aj(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Aj(e){return zv()?e instanceof Node||e instanceof Dr(e).Node:!1}function Ho(e){return zv()?e instanceof Element||e instanceof Dr(e).Element:!1}function hi(e){return zv()?e instanceof HTMLElement||e instanceof Dr(e).HTMLElement:!1}function YC(e){return!zv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Dr(e).ShadowRoot}function Hh(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Wo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Q9(e){return["table","td","th"].includes(Iu(e))}function $v(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function oS(e){const t=iS(),n=Ho(e)?Wo(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function eH(e){let t=Ea(e);for(;hi(t)&&!fu(t);){if(oS(t))return t;if($v(t))return null;t=Ea(t)}return null}function iS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function fu(e){return["html","body","#document"].includes(Iu(e))}function Wo(e){return Dr(e).getComputedStyle(e)}function Bv(e){return Ho(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ea(e){if(Iu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||YC(e)&&e.host||bi(e);return YC(t)?t.host:t}function Dj(e){const t=Ea(e);return fu(t)?e.ownerDocument?e.ownerDocument.body:e.body:hi(t)&&Hh(t)?t:Dj(t)}function oh(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Dj(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Dr(o);if(i){const a=Pb(s);return t.concat(s,s.visualViewport||[],Hh(o)?o:[],a&&n?oh(a):[])}return t.concat(o,oh(o,[],n))}function Pb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Lj(e){const t=Wo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=hi(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=bg(n)!==i||bg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function sS(e){return Ho(e)?e:e.contextElement}function Bc(e){const t=sS(e);if(!hi(t))return ci(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Lj(t);let s=(i?bg(n.width):n.width)/r,a=(i?bg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const tH=ci(0);function Fj(e){const t=Dr(e);return!iS()||!t.visualViewport?tH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nH(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Dr(e)?!1:t}function Tl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=sS(e);let s=ci(1);t&&(r?Ho(r)&&(s=Bc(r)):s=Bc(e));const a=nH(i,n,r)?Fj(i):ci(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const h=Dr(i),p=r&&Ho(r)?Dr(r):r;let m=h,v=Pb(m);for(;v&&r&&p!==m;){const x=Bc(v),b=v.getBoundingClientRect(),w=Wo(v),S=b.left+(v.clientLeft+parseFloat(w.paddingLeft))*x.x,C=b.top+(v.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,d*=x.y,l+=S,c+=C,m=Dr(v),v=Pb(m)}}return Sg({width:u,height:d,x:l,y:c})}function aS(e,t){const n=Bv(e).scrollLeft;return t?t.left+n:Tl(bi(e)).left+n}function zj(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:aS(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function rH(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=bi(r),a=t?$v(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=ci(1);const u=ci(0),d=hi(r);if((d||!d&&!i)&&((Iu(r)!=="body"||Hh(s))&&(l=Bv(r)),hi(r))){const p=Tl(r);c=Bc(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=s&&!d&&!i?zj(s,l,!0):ci(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function oH(e){return Array.from(e.getClientRects())}function iH(e){const t=bi(e),n=Bv(e),r=e.ownerDocument.body,o=Nr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Nr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+aS(e);const a=-n.scrollTop;return Wo(r).direction==="rtl"&&(s+=Nr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function sH(e,t){const n=Dr(e),r=bi(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=iS();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function aH(e,t){const n=Tl(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=hi(e)?Bc(e):ci(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function JC(e,t,n){let r;if(t==="viewport")r=sH(e,n);else if(t==="document")r=iH(bi(e));else if(Ho(t))r=aH(t,n);else{const o=Fj(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Sg(r)}function $j(e,t){const n=Ea(e);return n===t||!Ho(n)||fu(n)?!1:Wo(n).position==="fixed"||$j(n,t)}function lH(e,t){const n=t.get(e);if(n)return n;let r=oh(e,[],!1).filter(a=>Ho(a)&&Iu(a)!=="body"),o=null;const i=Wo(e).position==="fixed";let s=i?Ea(e):e;for(;Ho(s)&&!fu(s);){const a=Wo(s),l=oS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Hh(s)&&!l&&$j(e,s))?r=r.filter(u=>u!==s):o=a,s=Ea(s)}return t.set(e,r),r}function cH(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?$v(t)?[]:lH(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=JC(t,u,o);return c.top=Nr(d.top,c.top),c.right=Sa(d.right,c.right),c.bottom=Sa(d.bottom,c.bottom),c.left=Nr(d.left,c.left),c},JC(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uH(e){const{width:t,height:n}=Lj(e);return{width:t,height:n}}function dH(e,t,n){const r=hi(t),o=bi(t),i=n==="fixed",s=Tl(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ci(0);if(r||!r&&!i)if((Iu(t)!=="body"||Hh(o))&&(a=Bv(t)),r){const h=Tl(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=aS(o));const c=o&&!r&&!i?zj(o,a):ci(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function Ox(e){return Wo(e).position==="static"}function XC(e,t){if(!hi(e)||Wo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return bi(e)===n&&(n=n.ownerDocument.body),n}function Bj(e,t){const n=Dr(e);if($v(e))return n;if(!hi(e)){let o=Ea(e);for(;o&&!fu(o);){if(Ho(o)&&!Ox(o))return o;o=Ea(o)}return n}let r=XC(e,t);for(;r&&Q9(r)&&Ox(r);)r=XC(r,t);return r&&fu(r)&&Ox(r)&&!oS(r)?n:r||eH(e)||n}const fH=async function(e){const t=this.getOffsetParent||Bj,n=this.getDimensions,r=await n(e.floating);return{reference:dH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hH(e){return Wo(e).direction==="rtl"}const pH={convertOffsetParentRelativeRectToViewportRelativeRect:rH,getDocumentElement:bi,getClippingRect:cH,getOffsetParent:Bj,getElementRects:fH,getClientRects:oH,getDimensions:uH,getScale:Bc,isElement:Ho,isRTL:hH};function mH(e,t){let n=null,r;const o=bi(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const p=Vp(u),m=Vp(o.clientWidth-(c+d)),v=Vp(o.clientHeight-(u+h)),x=Vp(c),w={rootMargin:-p+"px "+-m+"px "+-v+"px "+-x+"px",threshold:Nr(0,Sa(1,l))||1};let S=!0;function C(_){const P=_[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return s(!0),i}function gH(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=sS(e),u=o||i?[...c?oh(c):[],...oh(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?mH(c,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let m,v=l?Tl(e):null;l&&x();function x(){const b=Tl(e);v&&(b.x!==v.x||b.y!==v.y||b.width!==v.width||b.height!==v.height)&&n(),v=b,m=requestAnimationFrame(x)}return n(),()=>{var b;u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const vH=Y9,yH=J9,xH=K9,bH=Z9,wH=G9,ZC=W9,SH=X9,kH=(e,t,n)=>{const r=new Map,o={platform:pH,...n},i={...o.platform,_c:r};return H9(e,t,{...o,platform:i})};var gm=typeof document<"u"?g.useLayoutEffect:g.useEffect;function kg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!kg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!kg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Vj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function QC(e,t){const n=Vj(e);return Math.round(t*n)/n}function Mx(e){const t=g.useRef(e);return gm(()=>{t.current=e}),t}function EH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=g.useState(r);kg(h,r)||p(r);const[m,v]=g.useState(null),[x,b]=g.useState(null),w=g.useCallback(N=>{N!==P.current&&(P.current=N,v(N))},[]),S=g.useCallback(N=>{N!==O.current&&(O.current=N,b(N))},[]),C=i||m,_=s||x,P=g.useRef(null),O=g.useRef(null),M=g.useRef(u),I=l!=null,L=Mx(l),U=Mx(o),$=Mx(c),K=g.useCallback(()=>{if(!P.current||!O.current)return;const N={placement:t,strategy:n,middleware:h};U.current&&(N.platform=U.current),kH(P.current,O.current,N).then(D=>{const z={...D,isPositioned:$.current!==!1};W.current&&!kg(M.current,z)&&(M.current=z,jr.flushSync(()=>{d(z)}))})},[h,t,n,U,$]);gm(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(N=>({...N,isPositioned:!1})))},[c]);const W=g.useRef(!1);gm(()=>(W.current=!0,()=>{W.current=!1}),[]),gm(()=>{if(C&&(P.current=C),_&&(O.current=_),C&&_){if(L.current)return L.current(C,_,K);K()}},[C,_,K,L,I]);const B=g.useMemo(()=>({reference:P,floating:O,setReference:w,setFloating:S}),[w,S]),A=g.useMemo(()=>({reference:C,floating:_}),[C,_]),R=g.useMemo(()=>{const N={position:n,left:0,top:0};if(!A.floating)return N;const D=QC(A.floating,u.x),z=QC(A.floating,u.y);return a?{...N,transform:"translate("+D+"px, "+z+"px)",...Vj(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:z}},[n,a,A.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:K,refs:B,elements:A,floatingStyles:R}),[u,K,B,A,R])}const CH=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ZC({element:r.current,padding:o}).fn(n):{}:r?ZC({element:r,padding:o}).fn(n):{}}}},_H=(e,t)=>({...vH(e),options:[e,t]}),PH=(e,t)=>({...yH(e),options:[e,t]}),NH=(e,t)=>({...SH(e),options:[e,t]}),TH=(e,t)=>({...xH(e),options:[e,t]}),OH=(e,t)=>({...bH(e),options:[e,t]}),MH=(e,t)=>({...wH(e),options:[e,t]}),jH=(e,t)=>({...CH(e),options:[e,t]});var RH="Arrow",Uj=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return f.jsx(Te.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});Uj.displayName=RH;var IH=Uj;function AH(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:h,children:p,...m}=d,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:x,children:p})}function u(d,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,DH(o,...t)]}function DH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function lS(e){const[t,n]=g.useState(void 0);return _n(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var cS="Popper",[Hj,wi]=AH(cS),[LH,Wj]=Hj(cS),Kj=e=>{const{__scopePopper:t,children:n}=e,[r,o]=g.useState(null);return f.jsx(LH,{scope:t,anchor:r,onAnchorChange:o,children:n})};Kj.displayName=cS;var Gj="PopperAnchor",qj=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=Wj(Gj,n),s=g.useRef(null),a=$e(t,s);return g.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:f.jsx(Te.div,{...o,ref:a})});qj.displayName=Gj;var uS="PopperContent",[FH,zH]=Hj(uS),Yj=g.forwardRef((e,t)=>{var Y,ce,Ee,fe,Ie,Ce;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...v}=e,x=Wj(uS,n),[b,w]=g.useState(null),S=$e(t,Ye=>w(Ye)),[C,_]=g.useState(null),P=lS(C),O=(P==null?void 0:P.width)??0,M=(P==null?void 0:P.height)??0,I=r+(i!=="center"?"-"+i:""),L=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(c)?c:[c],$=U.length>0,K={padding:L,boundary:U.filter(BH),altBoundary:$},{refs:W,floatingStyles:B,placement:A,isPositioned:R,middlewareData:N}=EH({strategy:"fixed",placement:I,whileElementsMounted:(...Ye)=>gH(...Ye,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[_H({mainAxis:o+M,alignmentAxis:s}),l&&PH({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?NH():void 0,...K}),l&&TH({...K}),OH({...K,apply:({elements:Ye,rects:pt,availableWidth:Wt,availableHeight:T})=>{const{width:k,height:E}=pt.reference,j=Ye.floating.style;j.setProperty("--radix-popper-available-width",`${Wt}px`),j.setProperty("--radix-popper-available-height",`${T}px`),j.setProperty("--radix-popper-anchor-width",`${k}px`),j.setProperty("--radix-popper-anchor-height",`${E}px`)}}),C&&jH({element:C,padding:a}),VH({arrowWidth:O,arrowHeight:M}),h&&MH({strategy:"referenceHidden",...K})]}),[D,z]=Zj(A),V=tn(m);_n(()=>{R&&(V==null||V())},[R,V]);const G=(Y=N.arrow)==null?void 0:Y.x,_e=(ce=N.arrow)==null?void 0:ce.y,Se=((Ee=N.arrow)==null?void 0:Ee.centerOffset)!==0,[Be,Z]=g.useState();return _n(()=>{b&&Z(window.getComputedStyle(b).zIndex)},[b]),f.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:R?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Be,"--radix-popper-transform-origin":[(fe=N.transformOrigin)==null?void 0:fe.x,(Ie=N.transformOrigin)==null?void 0:Ie.y].join(" "),...((Ce=N.hide)==null?void 0:Ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(FH,{scope:n,placedSide:D,onArrowChange:_,arrowX:G,arrowY:_e,shouldHideArrow:Se,children:f.jsx(Te.div,{"data-side":D,"data-align":z,...v,ref:S,style:{...v.style,animation:R?void 0:"none"}})})})});Yj.displayName=uS;var Jj="PopperArrow",$H={top:"bottom",right:"left",bottom:"top",left:"right"},Xj=g.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=zH(Jj,r),s=$H[i.placedSide];return f.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:f.jsx(IH,{...o,ref:n,style:{...o.style,display:"block"}})})});Xj.displayName=Jj;function BH(e){return e!==null}var VH=e=>({name:"transformOrigin",options:e,fn(t){var x,b,w;const{placement:n,rects:r,middlewareData:o}=t,s=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Zj(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((b=o.arrow)==null?void 0:b.x)??0)+a/2,p=(((w=o.arrow)==null?void 0:w.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=s?d:`${h}px`,v=`${-l}px`):c==="top"?(m=s?d:`${h}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=s?d:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=s?d:`${p}px`),{data:{x:m,y:v}}}});function Zj(e){const[t,n="center"]=e.split("-");return[t,n]}var Wh=Kj,Au=qj,Kh=Yj,Gh=Xj,UH="Portal",Du=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=g.useState(!1);_n(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?yz.createPortal(f.jsx(Te.div,{...r,ref:t}),s):null});Du.displayName=UH;function HH(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var an=e=>{const{present:t,children:n}=e,r=WH(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),i=$e(r.ref,KH(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:i}):null};an.displayName="Presence";function WH(e){const[t,n]=g.useState(),r=g.useRef({}),o=g.useRef(e),i=g.useRef("none"),s=e?"mounted":"unmounted",[a,l]=HH(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Up(r.current);i.current=a==="mounted"?c:"none"},[a]),_n(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=Up(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),_n(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const v=Up(r.current).includes(p.animationName);if(p.target===t&&v&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(i.current=Up(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Up(e){return(e==null?void 0:e.animationName)||"none"}function KH(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=GH({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=tn(n),l=g.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function GH({defaultProp:e,onChange:t}){const n=g.useState(e),[r]=n,o=g.useRef(r),i=tn(t);return g.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var qH="VisuallyHidden",dS=g.forwardRef((e,t)=>f.jsx(Te.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));dS.displayName=qH;var YH=dS,[Vv,jme]=ho("Tooltip",[wi]),Uv=wi(),Qj="TooltipProvider",JH=700,Nb="tooltip.open",[XH,fS]=Vv(Qj),eR=e=>{const{__scopeTooltip:t,delayDuration:n=JH,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=g.useState(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),f.jsx(XH,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};eR.displayName=Qj;var Hv="Tooltip",[ZH,qh]=Vv(Hv),tR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=fS(Hv,e.__scopeTooltip),c=Uv(t),[u,d]=g.useState(null),h=Ar(),p=g.useRef(0),m=s??l.disableHoverableContent,v=a??l.delayDuration,x=g.useRef(!1),[b=!1,w]=zr({prop:r,defaultProp:o,onChange:O=>{O?(l.onOpen(),document.dispatchEvent(new CustomEvent(Nb))):l.onClose(),i==null||i(O)}}),S=g.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,w(!0)},[w]),_=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),P=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,w(!0),p.current=0},v)},[v,w]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),f.jsx(Wh,{...c,children:f.jsx(ZH,{scope:t,contentId:h,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayed?P():C()},[l.isOpenDelayed,P,C]),onTriggerLeave:g.useCallback(()=>{m?_():(window.clearTimeout(p.current),p.current=0)},[_,m]),onOpen:C,onClose:_,disableHoverableContent:m,children:n})})};tR.displayName=Hv;var Tb="TooltipTrigger",hS=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=qh(Tb,n),i=fS(Tb,n),s=Uv(n),a=g.useRef(null),l=$e(t,a,o.onTriggerChange),c=g.useRef(!1),u=g.useRef(!1),d=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),f.jsx(Au,{asChild:!0,...s,children:f.jsx(Te.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ne(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ne(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:ne(e.onBlur,o.onClose),onClick:ne(e.onClick,o.onClose)})})});hS.displayName=Tb;var pS="TooltipPortal",[QH,eW]=Vv(pS,{forceMount:void 0}),nR=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=qh(pS,t);return f.jsx(QH,{scope:t,forceMount:n,children:f.jsx(an,{present:n||i.open,children:f.jsx(Du,{asChild:!0,container:o,children:r})})})};nR.displayName=pS;var hu="TooltipContent",rR=g.forwardRef((e,t)=>{const n=eW(hu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=qh(hu,e.__scopeTooltip);return f.jsx(an,{present:r||s.open,children:s.disableHoverableContent?f.jsx(oR,{side:o,...i,ref:t}):f.jsx(tW,{side:o,...i,ref:t})})}),tW=g.forwardRef((e,t)=>{const n=qh(hu,e.__scopeTooltip),r=fS(hu,e.__scopeTooltip),o=g.useRef(null),i=$e(t,o),[s,a]=g.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,h=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,v)=>{const x=m.currentTarget,b={x:m.clientX,y:m.clientY},w=iW(b,x.getBoundingClientRect()),S=sW(b,w),C=aW(v.getBoundingClientRect()),_=cW([...S,...C]);a(_),d(!0)},[d]);return g.useEffect(()=>()=>h(),[h]),g.useEffect(()=>{if(l&&u){const m=x=>p(x,u),v=x=>p(x,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,h]),g.useEffect(()=>{if(s){const m=v=>{const x=v.target,b={x:v.clientX,y:v.clientY},w=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!lW(b,s);w?h():S&&(h(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,s,c,h]),f.jsx(oR,{...e,ref:i})}),[nW,rW]=Vv(Hv,{isInside:!1}),oR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=qh(hu,n),c=Uv(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(Nb,u),()=>document.removeEventListener(Nb,u)),[u]),g.useEffect(()=>{if(l.trigger){const d=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),f.jsx(Hl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:f.jsxs(Kh,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(Oj,{children:r}),f.jsx(nW,{scope:n,isInside:!0,children:f.jsx(YH,{id:l.contentId,role:"tooltip",children:o||r})})]})})});rR.displayName=hu;var iR="TooltipArrow",oW=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Uv(n);return rW(iR,n).isInside?null:f.jsx(Gh,{...o,...r,ref:t})});oW.displayName=iR;function iW(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function sW(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function aW(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function lW(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function cW(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),uW(t)}function uW(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var dW=eR,fW=tR,hW=hS,sR=rR;function aR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=aR(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function lR(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=aR(e))&&(r&&(r+=" "),r+=t);return r}const mS="-",pW=e=>{const t=gW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(mS);return a[0]===""&&a.length!==1&&a.shift(),cR(a,t)||mW(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},cR=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?cR(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(mS);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},e_=/^\[(.+)\]$/,mW=e=>{if(e_.test(e)){const t=e_.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},gW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return yW(Object.entries(e.classGroups),n).forEach(([i,s])=>{Ob(s,r,i,t)}),r},Ob=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:t_(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(vW(o)){Ob(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Ob(s,t_(t,i),n,r)})})},t_=(e,t)=>{let n=e;return t.split(mS).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},vW=e=>e.isThemeGetter,yW=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,xW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},uR="!",bW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,d;for(let x=0;x<a.length;x++){let b=a[x];if(c===0){if(b===o&&(r||a.slice(x,x+i)===t)){l.push(a.slice(u,x)),u=x+i;continue}if(b==="/"){d=x;continue}}b==="["?c++:b==="]"&&c--}const h=l.length===0?a:a.substring(u),p=h.startsWith(uR),m=p?h.substring(1):h,v=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},wW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},SW=e=>({cache:xW(e.cacheSize),parseClassName:bW(e),...pW(e)}),kW=/\s+/,EW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(kW);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(c);let m=!!p,v=r(m?h.substring(0,p):h);if(!v){if(!m){a=c+(a.length>0?" "+a:a);continue}if(v=r(h),!v){a=c+(a.length>0?" "+a:a);continue}m=!1}const x=wW(u).join(":"),b=d?x+uR:x,w=b+v;if(i.includes(w))continue;i.push(w);const S=o(v,m);for(let C=0;C<S.length;++C){const _=S[C];i.push(b+_)}a=c+(a.length>0?" "+a:a)}return a};function CW(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=dR(t))&&(r&&(r+=" "),r+=n);return r}const dR=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=dR(e[r]))&&(n&&(n+=" "),n+=t);return n};function _W(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=SW(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=EW(l,n);return o(l,u),u}return function(){return i(CW.apply(null,arguments))}}const wt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},fR=/^\[(?:([a-z-]+):)?(.+)\]$/i,PW=/^\d+\/\d+$/,NW=new Set(["px","full","screen"]),TW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OW=/\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$/,MW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,jW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_i=e=>Vc(e)||NW.has(e)||PW.test(e),ks=e=>Lu(e,"length",BW),Vc=e=>!!e&&!Number.isNaN(Number(e)),jx=e=>Lu(e,"number",Vc),xd=e=>!!e&&Number.isInteger(Number(e)),IW=e=>e.endsWith("%")&&Vc(e.slice(0,-1)),Ve=e=>fR.test(e),Es=e=>TW.test(e),AW=new Set(["length","size","percentage"]),DW=e=>Lu(e,AW,hR),LW=e=>Lu(e,"position",hR),FW=new Set(["image","url"]),zW=e=>Lu(e,FW,UW),$W=e=>Lu(e,"",VW),bd=()=>!0,Lu=(e,t,n)=>{const r=fR.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},BW=e=>OW.test(e)&&!MW.test(e),hR=()=>!1,VW=e=>jW.test(e),UW=e=>RW.test(e),HW=()=>{const e=wt("colors"),t=wt("spacing"),n=wt("blur"),r=wt("brightness"),o=wt("borderColor"),i=wt("borderRadius"),s=wt("borderSpacing"),a=wt("borderWidth"),l=wt("contrast"),c=wt("grayscale"),u=wt("hueRotate"),d=wt("invert"),h=wt("gap"),p=wt("gradientColorStops"),m=wt("gradientColorStopPositions"),v=wt("inset"),x=wt("margin"),b=wt("opacity"),w=wt("padding"),S=wt("saturate"),C=wt("scale"),_=wt("sepia"),P=wt("skew"),O=wt("space"),M=wt("translate"),I=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",Ve,t],$=()=>[Ve,t],K=()=>["",_i,ks],W=()=>["auto",Vc,Ve],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],A=()=>["solid","dashed","dotted","double","none"],R=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",Ve],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[Vc,Ve];return{cacheSize:500,separator:":",theme:{colors:[bd],spacing:[_i,ks],blur:["none","",Es,Ve],brightness:V(),borderColor:[e],borderRadius:["none","","full",Es,Ve],borderSpacing:$(),borderWidth:K(),contrast:V(),grayscale:D(),hueRotate:V(),invert:D(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[IW,ks],inset:U(),margin:U(),opacity:V(),padding:$(),saturate:V(),scale:V(),sepia:D(),skew:V(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",Ve]}],container:["container"],columns:[{columns:[Es]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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"],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:[...B(),Ve]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xd,Ve]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ve]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",xd,Ve]}],"grid-cols":[{"grid-cols":[bd]}],"col-start-end":[{col:["auto",{span:["full",xd,Ve]},Ve]}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":[bd]}],"row-start-end":[{row:["auto",{span:[xd,Ve]},Ve]}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ve]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ve,t]}],"min-w":[{"min-w":[Ve,t,"min","max","fit"]}],"max-w":[{"max-w":[Ve,t,"none","full","min","max","fit","prose",{screen:[Es]},Es]}],h:[{h:[Ve,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ve,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ve,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ve,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Es,ks]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",jx]}],"font-family":[{font:[bd]}],"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:["tighter","tight","normal","wide","wider","widest",Ve]}],"line-clamp":[{"line-clamp":["none",Vc,jx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_i,Ve]}],"list-image":[{"list-image":["none",Ve]}],"list-style-type":[{list:["none","disc","decimal",Ve]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...A(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_i,ks]}],"underline-offset":[{"underline-offset":["auto",_i,Ve]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),LW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",DW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},zW]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...A(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:A()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...A()]}],"outline-offset":[{"outline-offset":[_i,Ve]}],"outline-w":[{outline:[_i,ks]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[_i,ks]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Es,$W]}],"shadow-color":[{shadow:[bd]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...R(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":R()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Es,Ve]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ve]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",Ve]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[xd,Ve]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ve]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",Ve]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",Ve]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_i,ks,jx]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},WW=_W(HW);function ze(...e){return WW(lR(e))}const KW=dW,pR=fW,GW=hW,gS=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(sR,{ref:r,sideOffset:t,className:ze("z-50 overflow-hidden rounded-md border bg-bg-primary-solid px-3 py-2 text-sm text-text-primary shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));gS.displayName=sR.displayName;const rt=ke.createContext(new Proxy({},{get:()=>{throw new Error("Cannot use ValContext outside of ValProvider")}}));function mR({children:e,client:t,dispatchValEvents:n}){var V,G,_e,Se,Be;const[r,o,i,s,a,l]=r9(t),c=g.useMemo(()=>new p9(t,(Z,Y)=>{n&&v9(Z,Y)}),[n]),u="data"in r&&r.data?r.data.config:void 0,d="error"in r?r.error:void 0,[h,p]=g.useState();g.useEffect(()=>{if(h===void 0||h===!0)if(l){const Z=setTimeout(()=>{p(l)},2e3);return()=>{clearTimeout(Z)}}else l||p(!1)},[l,h]);const[m,v]=g.useState(null);g.useEffect(()=>{try{const Z=localStorage.getItem("val-theme-"+((u==null?void 0:u.project)||"unknown"));if(Z)if(Z==="light"||Z==="dark")v(Z);else throw new Error(`Invalid Val theme: ${Z}`);else d&&v("dark")}catch(Z){console.error("Error getting theme from local storage",Z)}},[u,d]),g.useEffect(()=>{u!=null&&u.defaultTheme&&m===null?(u==null?void 0:u.defaultTheme)==="dark"||(u==null?void 0:u.defaultTheme)==="light"?v(u.defaultTheme):console.warn(`Invalid config default theme: ${u.defaultTheme}`):u!==void 0&&m===null&&v("dark")},[m,u]);const x=g.useRef(null),b="data"in r&&r.data?r.data.baseSha:void 0,[w,S]=g.useState([]),C=g.useRef(new Set);g.useEffect(()=>{"data"in r&&r.data&&S(Z=>{var Y,ce,Ee,fe,Ie,Ce;return(Y=r.data)!=null&&Y.deployments&&((ce=r.data.deployments)==null?void 0:ce.length)>0||(Ee=r.data)!=null&&Ee.commits&&((fe=r.data.commits)==null?void 0:fe.length)>0?y9(Z,((Ie=r.data)==null?void 0:Ie.commits)||[],((Ce=r.data)==null?void 0:Ce.deployments)||[]).filter(Ye=>!C.current.has(Ye.commitSha)):Z})},["data"in r&&((V=r.data)==null?void 0:V.deployments)&&((G=r.data)==null?void 0:G.deployments.length),"data"in r&&((_e=r.data)==null?void 0:_e.commits)&&((Se=r.data)==null?void 0:Se.commits.length)]);const _=g.useCallback(Z=>{S(Y=>Y.filter(ce=>ce.commitSha!==Z)),C.current.add(Z)},[]),[P,O]=g.useState(new Set);g.useEffect(()=>{var Z;"data"in r&&((Z=r.data)!=null&&Z.commitSha)&&O(Y=>{var Ee;if(((Ee=r.data)==null?void 0:Ee.commitSha)===void 0||Y.has(r.data.commitSha))return Y;const ce=new Set(Y);return ce.add(r.data.commitSha),ce})},["data"in r&&((Be=r.data)==null?void 0:Be.commitSha)]);const[M,I]=g.useState({status:"not-asked"}),[L,U]=g.useState(!1),$=g.useSyncExternalStore(c.subscribe("schema"),()=>c.getAllSchemasSnapshot(),()=>c.getAllSchemasSnapshot());g.useEffect(()=>{if($){const Z=$;let Y=!1;for(const ce of Object.values(Z))if(Od(ce)){Y=!0;break}U(Y)}},[$]),g.useEffect(()=>{let Z=0;function Y(){Z++,M.status!=="ready"&&Z<10&&t("/remote/settings","GET",{}).then(ce=>{ce.status===200?I({status:"ready",coreVersion:ce.json.coreVersion,buckets:ce.json.remoteFileBuckets.map(Ee=>Ee.bucket),publicProjectId:ce.json.publicProjectId}):("errorCode"in ce.json&&ce.json.errorCode?I({status:"inactive",reason:ce.json.errorCode,message:ce.json.message}):I({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(Y,5e3))}).catch(ce=>{console.error("Error getting remote settings",ce),I({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(Y,5e3)})}L&&(I({status:"loading"}),Y())},[L]);const K=g.useRef("not-initialized"),[W,B]=g.useState(!1),A=$u(c);g.useEffect(()=>{if(A===null&&K.current==="done"&&(K.current="not-initialized"),"data"in r&&r.data&&K.current==="not-initialized"){K.current="in-progress";let Z=null;const Y=async()=>{if("data"in r&&r.data){console.debug("ValSyncEngine init started...",r.data.profileId);const ce=await c.init(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now());console.debug("ValSyncEngine init result",ce),ce.status==="retry"?(K.current="retry",Z=setTimeout(Y,4e3)):(console.debug("Val is initialized!",ce),K.current="done",Z&&clearTimeout(Z),B(!0))}else throw K.current="not-initialized",Error("Unexpected state: init was started with stat.data but now it is not there")};return Y(),()=>{Z&&clearTimeout(Z)}}else"data"in r&&r.data&&K.current==="done"&&c.syncWithUpdatedStat(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now())},[r,c,A]),g.useEffect(()=>{if(!W)return;let Z=null;const Y=async()=>{if(A===null){B(!1),K.current="not-initialized";return}await c.sync(Date.now()),Z&&clearTimeout(Z),Z=setTimeout(Y,1e3)};return Y(),()=>{Z&&clearTimeout(Z)}},[c,A,W]);const[R,N]=g.useState({type:"not-asked"}),D=g.useSyncExternalStore(c.subscribe("pending-ops-count"),()=>c.getPendingOpsSnapshot(),()=>c.getPendingOpsSnapshot());g.useEffect(()=>{const Z=Y=>{D>0&&(Y.preventDefault(),Y.returnValue="")};return window.addEventListener("beforeunload",Z),()=>{window.removeEventListener("beforeunload",Z)}},[D]);const z=qW(t,i,l);return f.jsx(rt.Provider,{value:{client:t,publishSummaryState:R,setPublishSummaryState:N,syncEngine:c,profileId:"data"in r&&r.data?r.data.profileId:null,mode:"data"in r&&r.data?r.data.mode:"unknown",serviceUnavailable:h,baseSha:b,observedCommitShas:P,deployments:w,dismissDeployment:_,portalRef:x.current,authenticationState:i,theme:m,setTheme:Z=>{if(Z==="dark"||Z==="light"){try{localStorage.setItem("val-theme-"+((u==null?void 0:u.project)||"unknown"),Z),localStorage.setItem("val-theme-unknown",Z)}catch(Y){console.error("Error setting theme in local storage",Y)}v(Z)}else console.warn(`Cannot set invalid theme theme: ${Z}`)},config:u,profiles:"data"in z&&z.data?z.data:{},remoteFiles:M},children:f.jsx(KW,{children:f.jsxs(NM,{initialProps:{mode:"default"},children:[f.jsx("div",{"data-val-portal":"true",ref:x,...m?{"data-mode":m}:{}}),e]})})})}function qW(e,t,n){const r=g.useRef(!0),[o,i]=g.useState({status:"not-asked"}),s=g.useCallback(async()=>{i(l=>({status:"loading",data:"data"in l?l.data:void 0}));const a=await e("/profiles","GET",{});if(a.status===200){const l={};for(const c of a.json.profiles)l[c.profileId]={fullName:c.fullName,email:c.email,avatar:c.avatar};i({status:"done",data:l})}else console.error("Could not get profiles",a.json),r.current=!0,i(l=>({status:"error",data:"data"in l?l.data:void 0}))},[e,o]);return g.useEffect(()=>{r.current&&(r.current=!1,o.status==="error"?setTimeout(()=>s(),2e3):o.status==="not-asked"&&s())},[t,e,o,n]),o}function Gr(){return g.useContext(rt).portalRef}function Wv(){const{theme:e,setTheme:t}=g.useContext(rt);return{theme:e,setTheme:t}}function Fu(){const{config:e}=g.useContext(rt),t=g.useRef(e&&{...e,remoteHost:kC,appHost:hb,studioPrefix:"/val/~"});return g.useEffect(()=>{e&&(t.current={...e,remoteHost:kC,appHost:hb,studioPrefix:"/val/~"})},[e]),t.current}function vS(){const{remoteFiles:e}=g.useContext(rt);return e}function yS(){const{remoteFiles:e}=g.useContext(rt),[t,n]=g.useState(null);function r(o){return Math.floor(Math.random()*o)}return g.useEffect(()=>{e.status==="ready"&&e.buckets.length>0&&t===null&&n(e.buckets[r(e.buckets.length)])},[e]),t}function gR(){const{authenticationState:e}=g.useContext(rt);return e}function YW(){const{serviceUnavailable:e}=g.useContext(rt);return e===!0?"service-unavailable":"connected"}const n_=new TextEncoder,JW=y.object({patchId:y.string().refine(e=>e.length>0),filePath:y.string().refine(e=>e.length>0)});function On(e){const{syncEngine:t,client:n}=g.useContext(rt),[r,o]=X.splitModuleFilePathAndModulePath(e),i=g.useMemo(()=>X.createPatchPath(o),[o]),s=g.useCallback((p,m)=>{t.addPatch(r,m,p,Date.now())},[t,r]),a=g.useCallback((p,m,v)=>t.addPatchAwaitable(r,m,p,v,Date.now()),[t,r]),l=g.useCallback((p,m,v)=>{t.addPatch(p,v,m,Date.now())},[t]),c=g.useCallback(async()=>{let p=await n("/direct-file-upload-settings","POST",{}),m=0;for(;p.status===null&&m<5;)console.warn("Failed to get direct file upload settings, retrying...",p),await new Promise(v=>setTimeout(v,500*(m+1))),p=await n("/direct-file-upload-settings","POST",{}),m++;return p.status===200?{status:"success",data:p.json}:{status:"error",error:"Could not get direct file upload settings"}},[n]),u=g.useCallback(async(p,m,v,x,b,w,S)=>{const C=m?{"x-val-auth-nonce":m}:{},{filePath:_,value:P,metadata:O,remote:M}=w;let I;if(M){const $=X.remote.splitRemoteRef(_);if($.status==="error")return Promise.reject({status:"error",error:{message:`Could not create correct file path of remote file (${$.error}). This is most likely a Val bug.`}});I="/"+$.filePath}else I=_;const L=JSON.stringify({filePath:I,parentRef:v,data:P,type:b,metadata:O,remote:M}),U=n_.encode(L).length;return S(0,U),new Promise($=>{const K=new XMLHttpRequest;K.upload.addEventListener("progress",W=>{W.lengthComputable&&S(W.loaded,W.total)}),K.addEventListener("load",()=>{if(K.status>=200&&K.status<300)try{const W=K.responseText,B=JSON.parse(W),A=JW.safeParse(B);A.success?$({status:"done",patchId:A.data.patchId,filePath:A.data.filePath}):$({status:"error",error:{message:`While saving a file we got an unexpected response (${W==null?void 0:W.slice(0,100)}...)`}})}catch(W){$({status:"error",error:{message:`Got an exception while saving a file. Error: ${W instanceof Error?W.message:String(W)}`}})}else $({status:"error",error:{message:"Could not save patch file. HTTP error: "+K.status+" "+K.statusText}})}),K.addEventListener("error",()=>{$({status:"error",error:{message:"Could save source file (network error?)"}})}),K.addEventListener("abort",()=>{$({status:"error",error:{message:"Upload was aborted"}})}),K.responseType="text",K.open("POST",`${p}/patches/${x}/files`),K.setRequestHeader("Content-Type","application/json");for(const[W,B]of Object.entries(C))K.setRequestHeader(W,B);K.send(L)})},[]),d=g.useSyncExternalStore(t.subscribe("parent-ref"),()=>t.getParentRefSnapshot(),()=>t.getParentRefSnapshot()),h=g.useCallback(async(p,m,v,x)=>{if(d===null){v("Cannot upload files yet. Not initialized.");return}const b=await c();if(b.status!=="success"){v(b.error);return}const{baseUrl:w,nonce:S}=b.data,C=[],_=[];for(const I of p)I.op==="file"?(C.push(I),_.push({...I,value:typeof I.value=="string"?X.getSHA256Hash(n_.encode(I.value)):I.value})):_.push(I);const P=t.createPatchId();let O=0;for(const I of C){const L=await u(w,S,d,P,m,I,(U,$)=>{x(U,$,O,C.length)});if(L.status==="error"){v(L.error.message);return}O++}const M=await a(_,m,P);if(M.status!=="patch-synced"){v(M.message);return}},[c,a,u,d,t]);return{patchPath:i,addPatch:s,addAndUploadPatchWithFileOps:h,addModuleFilePatch:l}}function XW(){const{syncEngine:e}=g.useContext(rt);return{deletePatches:g.useCallback(n=>{const r=[];for(let o=0;o<n.length;o+=100)r.push(n.slice(o,o+100));for(const o of r)e.deletePatches(o,Date.now())},[e])}}function ZW(){const{deployments:e,dismissDeployment:t,observedCommitShas:n}=g.useContext(rt);return{deployments:e,dismissDeployment:t,observedCommitShas:n}}function QW(){const{syncEngine:e}=g.useContext(rt);return{status:"success",data:g.useSyncExternalStore(e.subscribe("patch-sets"),()=>e.getSerializedPatchSetsSnapshot(),()=>e.getSerializedPatchSetsSnapshot())}}function e7(){const{syncEngine:e}=g.useContext(rt),t=g.useSyncExternalStore(e.subscribe("all-patches"),()=>e.getAllPatchesSnapshot(),()=>e.getAllPatchesSnapshot()),n=Yh();return g.useMemo(()=>{const o=new Set;for(const i of n){const s=t[i];s!=null&&s.isCommitted&&o.add(i)}return o},[t,n])}function vR(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("global-server-side-patch-ids"),()=>e.getGlobalServerSidePatchIdsSnapshot(),()=>e.getGlobalServerSidePatchIdsSnapshot())}function yR(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("pending-client-side-patch-ids"),()=>e.getPendingClientSidePatchIdsSnapshot(),()=>e.getPendingClientSidePatchIdsSnapshot())}function Yh(){const{syncEngine:e}=g.useContext(rt),t=vR(),n=yR(),r=g.useSyncExternalStore(e.subscribe("saved-server-side-patch-ids"),()=>e.getSavedServerSidePatchIdsSnapshot(),()=>e.getSavedServerSidePatchIdsSnapshot());return g.useMemo(()=>{const i=new Set,s=[];for(const a of t)i.has(a)||s.push(a),i.add(a);for(const a of r)i.has(a)||s.push(a),i.add(a);for(const a of n)i.has(a)||s.push(a),i.add(a);return s},[t,n,r])}function zu(){const{mode:e}=g.useContext(rt);return e}function Kv(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("pending-ops-count"),()=>e.getPendingOpsSnapshot(),()=>e.getPendingOpsSnapshot())>0?"loading":"success"}const t7=y.union([y.object({type:y.literal("not-asked"),isGenerating:y.boolean().optional()}),y.object({type:y.literal("manual").or(y.literal("ai")),text:y.string(),patchIds:y.array(y.string()).nullable(),isGenerating:y.boolean()})]);function Jh(){const{syncEngine:e,client:t,publishSummaryState:n,setPublishSummaryState:r,config:o}=g.useContext(rt),i=Yh(),s=g.useSyncExternalStore(e.subscribe("publish-disabled"),()=>e.getPublishDisabledSnapshot(),()=>e.getPublishDisabledSnapshot()),[a,l]=g.useState(!1);g.useEffect(()=>{var m,v;((v=(m=o==null?void 0:o.ai)==null?void 0:m.commitMessages)==null?void 0:v.disabled)===void 0||o.ai.commitMessages.disabled===!1?l(!0):l(!1)},[o]),g.useEffect(()=>{if(n.type==="not-asked"){const m=r7(o==null?void 0:o.project);m&&m.type!=="not-asked"&&i.length>0&&r(m)}},[n,o==null?void 0:o.project,r]);const c=g.useCallback(async()=>{if(i===null)return{type:"error",message:"Empty patch set"};if("isGenerating"in n&&n.isGenerating)return{type:"error",message:"Already generating summary"};r(m=>({...m,isGenerating:!0}));try{const m=await t("/commit-summary","GET",{query:{patch_id:i}});return m.status===200?m.json.commitSummary?{type:"ai",text:m.json.commitSummary}:{type:"error",message:"Commit summary could not be generated"}:{type:"error",message:m.json.message}}finally{r(m=>({...m,isGenerating:!1}))}},[t,i,n]),[u,d]=g.useState(!1),h=g.useCallback(async m=>i===null?{status:"error",message:"No changes to publish"}:u?{status:"error",message:"Already publishing"}:(d(!0),e.publish(i,m,Date.now()).then(v=>(v.status==="done"&&(o7(o==null?void 0:o.project),r(x=>({type:"not-asked",isGenerating:x.isGenerating}))),v)).finally(()=>{d(!1)})),[i,u,o==null?void 0:o.project,e]),p=g.useCallback(m=>{r(v=>{let x;return m.type==="not-asked"?x={type:"not-asked",isGenerating:v.isGenerating}:x={type:m.type,text:m.text,patchIds:i,isGenerating:!!v.isGenerating},n7(x,o==null?void 0:o.project),x})},[i,r,o==null?void 0:o.project]);return{publish:h,publishDisabled:s,isPublishing:u,generateSummary:c,canGenerate:a,summary:n,setSummary:p}}function n7(e,t){try{localStorage.setItem("val-publish-summary-"+(t||"unknown"),JSON.stringify(e))}catch(n){console.error("Error setting publish summary in local storage",n)}return e}function r7(e){try{const t=localStorage.getItem("val-publish-summary-"+(e||"unknown"));if(t){const n=t7.safeParse(JSON.parse(t));if(n.success)return n.data;console.warn("Error parsing publish summary from local storage",n.error)}}catch(t){console.error("Error getting publish summary from local storage",t)}return null}function o7(e){try{localStorage.removeItem("val-publish-summary-"+(e||"unknown"))}catch(t){console.error("Error deleting publish summary from local storage",t)}}function i7(){const{profileId:e,profiles:t}=g.useContext(rt);return e?t[e]??null:null}const $u=e=>g.useSyncExternalStore(e.subscribe("initialized-at"),()=>e.getInitializedAtSnapshot(),()=>e.getInitializedAtSnapshot()).data;function xS(){const{syncEngine:e}=g.useContext(rt);return{autoPublish:g.useSyncExternalStore(e.subscribe("auto-publish"),()=>e.getAutoPublishSnapshot(),()=>e.getAutoPublishSnapshot()),setAutoPublish:n=>{e.setAutoPublish(Date.now(),n)}}}function xR(e){const{syncEngine:t}=g.useContext(rt),[n]=g.useMemo(()=>X.splitModuleFilePathAndModulePath(e),[e]),r=g.useSyncExternalStore(t.subscribe("preview",n),()=>t.getPreviewSnapshot(n),()=>t.getPreviewSnapshot(n)),o=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=$u(t);return g.useMemo(()=>{const s=o.status==="success"&&o.optimistic,a=r==null?void 0:r[e];return i===null||s?{status:"loading",data:a&&"data"in a?a==null?void 0:a.data:void 0}:a},[r,i,o,e])}function Dt(e){const{syncEngine:t}=g.useContext(rt),[n,r]=g.useMemo(()=>X.splitModuleFilePathAndModulePath(e),[e]),o=g.useSyncExternalStore(t.subscribe("schema"),()=>t.getSchemaSnapshot(n),()=>t.getSchemaSnapshot(n)),i=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),s=g.useMemo(()=>{var c;if(o.status!=="success")return o;if(i.status!=="success")return i;const l=(c=X.resolvePath(r,i.data,o.data))==null?void 0:c.schema;return l?{status:"success",data:l}:{status:"resolved-schema-not-found"}},[o,i,n,r]);return $u(t)===null?{status:"loading"}:s.status!=="success"?s.status==="resolved-schema-not-found"?{status:"not-found"}:s.status==="no-schemas"?{status:"error",error:"No schemas"}:s.status==="module-schema-not-found"?{status:"not-found"}:{status:"loading"}:s}function Xh(){const{syncEngine:e}=g.useContext(rt),t=g.useSyncExternalStore(e.subscribe("schema"),()=>e.getAllSchemasSnapshot(),()=>e.getAllSchemasSnapshot());if($u(e)===null)return{status:"loading"};if(t===null)return console.warn("Schemas: not found"),{status:"error",error:"Schemas not found"};const r={};for(const[o,i]of Object.entries(t)){const s=o;i&&(r[s]=i)}return{status:"success",data:r}}function s7(e){const{syncEngine:t}=g.useContext(rt);return g.useSyncExternalStore(t.subscribe("validation-error",e),()=>t.getValidationErrorSnapshot(e),()=>t.getValidationErrorSnapshot(e))||[]}function Da(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("all-validation-errors"),()=>e.getAllValidationErrorsSnapshot(),()=>e.getAllValidationErrorsSnapshot())}function a7(){const{syncEngine:e}=g.useContext(rt);return{globalTransientErrors:g.useSyncExternalStore(e.subscribe("global-transient-errors"),()=>e.getGlobalTransientErrorsSnapshot(),()=>e.getGlobalTransientErrorsSnapshot()),removeGlobalTransientErrors:n=>{e.removeGlobalTransientErrors(n)}}}function l7(){const{syncEngine:e,remoteFiles:t}=g.useContext(rt),n=g.useSyncExternalStore(e.subscribe("network-error"),()=>e.getNetworkErrorSnapshot(),()=>e.getNetworkErrorSnapshot());return n!==null?{type:"network-error",networkError:n}:t.status==="inactive"?{type:"remote-files-error",error:t.message}:null}function bS(){return{globalErrors:[],patchErrors:{},skippedPatches:{}}}function wS(){const{profiles:e}=g.useContext(rt);return e}function at(e,t){const{syncEngine:n}=g.useContext(rt),[r,o]=e?X.splitModuleFilePathAndModulePath(e):["",""],i=g.useSyncExternalStore(n.subscribe("source",r),()=>n.getSourceSnapshot(r),()=>n.getSourceSnapshot(r)),s=$u(n);return g.useMemo(()=>{if(s===null)return{status:"loading"};if(i.status==="success"){const l=i.data;return l!==void 0&&t!==void 0?c7(r,o,t,l,i.optimistic):{status:"not-found"}}return{status:"error",error:i.message||"Unknown error"}},[i,o,r,s,t])}function SS(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("all-sources"),()=>e.getAllSourcesSnapshot(),()=>e.getAllSourcesSnapshot())}function kS(e){const{syncEngine:t}=g.useContext(rt),[n,r]=X.splitModuleFilePathAndModulePath(e),o=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=$u(t);return g.useMemo(()=>i===null?{status:"loading"}:o.status==="success"?bR(r,o.data):{status:"error",error:o.message||"Unknown error"},[o,i,r,n])}function bR(e,t){let n=t;if(t===void 0)return{status:"not-found"};for(const r of X.splitModulePath(e)){if(n===null)return{status:"error",error:`Expected object at ${e}, got null`};if(n===void 0)return{status:"error",error:`Expected object at ${e}, got undefined`};if(typeof n!="object")return{status:"error",error:`Expected object at ${e}, got ${JSON.stringify(n)}`};if(Ys(n)){const o=Number(r);if(Number.isNaN(o))return{status:"error",error:`Expected number at ${e}, got ${r}`};n=n[o]}else n=n[r]}return n===void 0?{status:"error",error:`Expected object at ${e}, got undefined`}:{status:"success",data:n}}function c7(e,t,n,r,o){const i=bR(t,r);if("data"in i&&i.data!==void 0){const s=u7(e,t,n,i.data);return s.status==="success"?{status:"success",data:s.data,clientSideOnly:o}:s}return i}function u7(e,t,n,r){if(r===null)return{status:"success",data:null};const o=n;if(o==="object"||o==="record"){if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Ys(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Rx(e,t,s);return{status:"success",data:i}}else if(o==="array"){if(typeof r!="object"||!Ys(r))return{status:"error",error:`Expected array, got ${typeof r}`};const i=[];for(let s=0;s<r.length;s++)i.push(Rx(e,t,s));return{status:"success",data:i}}else{if(o==="boolean")return typeof r!="boolean"&&r!==null?{status:"error",error:`Expected boolean, got ${typeof r}`}:{status:"success",data:r};if(o==="number")return typeof r!="number"&&r!==null?{status:"error",error:`Expected number, got ${typeof r}`}:{status:"success",data:r};if(o==="richtext")return typeof r!="object"||!Ys(r)?{status:"error",error:`Expected richtext (i.e. array), got ${typeof r}`}:{status:"success",data:r};if(o==="date"||o==="string"||o==="literal")return typeof r!="string"&&r!==null?{status:"error",error:`Expected string, got ${typeof r}: ${JSON.stringify(r)}`}:{status:"success",data:r};if(o==="file"||o==="image")return typeof r!="object"||!(vt in r)||r[vt]===void 0?{status:"error",error:`Expected object with ${vt} property, got ${typeof r}`}:"metadata"in r&&r.metatadata&&typeof r.metatadata!="object"?{status:"error",error:`Expected metadata of ${o} to be an object, got ${typeof r.metadata}`}:{status:"success",data:r};if(o==="keyOf")return typeof r!="string"?{status:"error",error:`Expected string, got ${typeof r}`}:{status:"success",data:r};if(o==="union"){if(typeof r=="string")return{status:"success",data:r};if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Ys(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Rx(e,t,s);return{status:"success",data:i}}else return{status:"error",error:`Unknown schema type: ${o}`}}}function Rx(e,t,n){return t?e+va+t+"."+JSON.stringify(n):e+va+n}var wR={exports:{}};/*!
|
|
48
|
+
*/(function(e){var t=Av,n=G1,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50;var o=2147483647;e.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var T=new Uint8Array(1),k={foo:function(){return 42}};return Object.setPrototypeOf(k,Uint8Array.prototype),Object.setPrototypeOf(T,k),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(T){if(T>o)throw new RangeError('The value "'+T+'" is invalid for option "size"');var k=new Uint8Array(T);return Object.setPrototypeOf(k,a.prototype),k}function a(T,k,E){if(typeof T=="number"){if(typeof k=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(T)}return l(T,k,E)}a.poolSize=8192;function l(T,k,E){if(typeof T=="string")return h(T,k);if(ArrayBuffer.isView(T))return m(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(Ye(T,ArrayBuffer)||T&&Ye(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ye(T,SharedArrayBuffer)||T&&Ye(T.buffer,SharedArrayBuffer)))return v(T,k,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var j=T.valueOf&&T.valueOf();if(j!=null&&j!==T)return a.from(j,k,E);var F=x(T);if(F)return F;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),k,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,k,E){return l(T,k,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function u(T,k,E){return c(T),T<=0?s(T):k!==void 0?typeof E=="string"?s(T).fill(k,E):s(T).fill(k):s(T)}a.alloc=function(T,k,E){return u(T,k,E)};function d(T){return c(T),s(T<0?0:b(T)|0)}a.allocUnsafe=function(T){return d(T)},a.allocUnsafeSlow=function(T){return d(T)};function h(T,k){if((typeof k!="string"||k==="")&&(k="utf8"),!a.isEncoding(k))throw new TypeError("Unknown encoding: "+k);var E=S(T,k)|0,j=s(E),F=j.write(T,k);return F!==E&&(j=j.slice(0,F)),j}function p(T){for(var k=T.length<0?0:b(T.length)|0,E=s(k),j=0;j<k;j+=1)E[j]=T[j]&255;return E}function m(T){if(Ye(T,Uint8Array)){var k=new Uint8Array(T);return v(k.buffer,k.byteOffset,k.byteLength)}return p(T)}function v(T,k,E){if(k<0||T.byteLength<k)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<k+(E||0))throw new RangeError('"length" is outside of buffer bounds');var j;return k===void 0&&E===void 0?j=new Uint8Array(T):E===void 0?j=new Uint8Array(T,k):j=new Uint8Array(T,k,E),Object.setPrototypeOf(j,a.prototype),j}function x(T){if(a.isBuffer(T)){var k=b(T.length)|0,E=s(k);return E.length===0||T.copy(E,0,0,k),E}if(T.length!==void 0)return typeof T.length!="number"||pt(T.length)?s(0):p(T);if(T.type==="Buffer"&&Array.isArray(T.data))return p(T.data)}function b(T){if(T>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return T|0}function w(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==a.prototype},a.compare=function(k,E){if(Ye(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),Ye(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(k)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===E)return 0;for(var j=k.length,F=E.length,J=0,ee=Math.min(j,F);J<ee;++J)if(k[J]!==E[J]){j=k[J],F=E[J];break}return j<F?-1:F<j?1:0},a.isEncoding=function(k){switch(String(k).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(k,E){if(!Array.isArray(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return a.alloc(0);var j;if(E===void 0)for(E=0,j=0;j<k.length;++j)E+=k[j].length;var F=a.allocUnsafe(E),J=0;for(j=0;j<k.length;++j){var ee=k[j];if(Ye(ee,Uint8Array))J+ee.length>F.length?a.from(ee).copy(F,J):Uint8Array.prototype.set.call(F,ee,J);else if(a.isBuffer(ee))ee.copy(F,J);else throw new TypeError('"list" argument must be an Array of Buffers');J+=ee.length}return F};function S(T,k){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||Ye(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&E===0)return 0;for(var F=!1;;)switch(k){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return ce(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return Ae(T).length;default:if(F)return j?-1:ce(T).length;k=(""+k).toLowerCase(),F=!0}}a.byteLength=S;function C(T,k,E){var j=!1;if((k===void 0||k<0)&&(k=0),k>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,k>>>=0,E<=k))return"";for(T||(T="utf8");;)switch(T){case"hex":return D(this,k,E);case"utf8":case"utf-8":return W(this,k,E);case"ascii":return R(this,k,E);case"latin1":case"binary":return N(this,k,E);case"base64":return K(this,k,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,k,E);default:if(j)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),j=!0}}a.prototype._isBuffer=!0;function _(T,k,E){var j=T[k];T[k]=T[E],T[E]=j}a.prototype.swap16=function(){var k=this.length;if(k%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<k;E+=2)_(this,E,E+1);return this},a.prototype.swap32=function(){var k=this.length;if(k%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<k;E+=4)_(this,E,E+3),_(this,E+1,E+2);return this},a.prototype.swap64=function(){var k=this.length;if(k%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<k;E+=8)_(this,E,E+7),_(this,E+1,E+6),_(this,E+2,E+5),_(this,E+3,E+4);return this},a.prototype.toString=function(){var k=this.length;return k===0?"":arguments.length===0?W(this,0,k):C.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(k){if(!a.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k?!0:a.compare(this,k)===0},a.prototype.inspect=function(){var k="",E=e.INSPECT_MAX_BYTES;return k=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(k+=" ... "),"<Buffer "+k+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(k,E,j,F,J){if(Ye(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),!a.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(E===void 0&&(E=0),j===void 0&&(j=k?k.length:0),F===void 0&&(F=0),J===void 0&&(J=this.length),E<0||j>k.length||F<0||J>this.length)throw new RangeError("out of range index");if(F>=J&&E>=j)return 0;if(F>=J)return-1;if(E>=j)return 1;if(E>>>=0,j>>>=0,F>>>=0,J>>>=0,this===k)return 0;for(var ee=J-F,Je=j-E,st=Math.min(ee,Je),yt=this.slice(F,J),ln=k.slice(E,j),ct=0;ct<st;++ct)if(yt[ct]!==ln[ct]){ee=yt[ct],Je=ln[ct];break}return ee<Je?-1:Je<ee?1:0};function P(T,k,E,j,F){if(T.length===0)return-1;if(typeof E=="string"?(j=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,pt(E)&&(E=F?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(F)return-1;E=T.length-1}else if(E<0)if(F)E=0;else return-1;if(typeof k=="string"&&(k=a.from(k,j)),a.isBuffer(k))return k.length===0?-1:O(T,k,E,j,F);if(typeof k=="number")return k=k&255,typeof Uint8Array.prototype.indexOf=="function"?F?Uint8Array.prototype.indexOf.call(T,k,E):Uint8Array.prototype.lastIndexOf.call(T,k,E):O(T,[k],E,j,F);throw new TypeError("val must be string, number or Buffer")}function O(T,k,E,j,F){var J=1,ee=T.length,Je=k.length;if(j!==void 0&&(j=String(j).toLowerCase(),j==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(T.length<2||k.length<2)return-1;J=2,ee/=2,Je/=2,E/=2}function st(ps,ed){return J===1?ps[ed]:ps.readUInt16BE(ed*J)}var yt;if(F){var ln=-1;for(yt=E;yt<ee;yt++)if(st(T,yt)===st(k,ln===-1?0:yt-ln)){if(ln===-1&&(ln=yt),yt-ln+1===Je)return ln*J}else ln!==-1&&(yt-=yt-ln),ln=-1}else for(E+Je>ee&&(E=ee-Je),yt=E;yt>=0;yt--){for(var ct=!0,yo=0;yo<Je;yo++)if(st(T,yt+yo)!==st(k,yo)){ct=!1;break}if(ct)return yt}return-1}a.prototype.includes=function(k,E,j){return this.indexOf(k,E,j)!==-1},a.prototype.indexOf=function(k,E,j){return P(this,k,E,j,!0)},a.prototype.lastIndexOf=function(k,E,j){return P(this,k,E,j,!1)};function M(T,k,E,j){E=Number(E)||0;var F=T.length-E;j?(j=Number(j),j>F&&(j=F)):j=F;var J=k.length;j>J/2&&(j=J/2);for(var ee=0;ee<j;++ee){var Je=parseInt(k.substr(ee*2,2),16);if(pt(Je))return ee;T[E+ee]=Je}return ee}function I(T,k,E,j){return Ce(ce(k,T.length-E),T,E,j)}function L(T,k,E,j){return Ce(Ee(k),T,E,j)}function U(T,k,E,j){return Ce(Ae(k),T,E,j)}function $(T,k,E,j){return Ce(fe(k,T.length-E),T,E,j)}a.prototype.write=function(k,E,j,F){if(E===void 0)F="utf8",j=this.length,E=0;else if(j===void 0&&typeof E=="string")F=E,j=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(j)?(j=j>>>0,F===void 0&&(F="utf8")):(F=j,j=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var J=this.length-E;if((j===void 0||j>J)&&(j=J),k.length>0&&(j<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");for(var ee=!1;;)switch(F){case"hex":return M(this,k,E,j);case"utf8":case"utf-8":return I(this,k,E,j);case"ascii":case"latin1":case"binary":return L(this,k,E,j);case"base64":return U(this,k,E,j);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,k,E,j);default:if(ee)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),ee=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function K(T,k,E){return k===0&&E===T.length?t.fromByteArray(T):t.fromByteArray(T.slice(k,E))}function W(T,k,E){E=Math.min(T.length,E);for(var j=[],F=k;F<E;){var J=T[F],ee=null,Je=J>239?4:J>223?3:J>191?2:1;if(F+Je<=E){var st,yt,ln,ct;switch(Je){case 1:J<128&&(ee=J);break;case 2:st=T[F+1],(st&192)===128&&(ct=(J&31)<<6|st&63,ct>127&&(ee=ct));break;case 3:st=T[F+1],yt=T[F+2],(st&192)===128&&(yt&192)===128&&(ct=(J&15)<<12|(st&63)<<6|yt&63,ct>2047&&(ct<55296||ct>57343)&&(ee=ct));break;case 4:st=T[F+1],yt=T[F+2],ln=T[F+3],(st&192)===128&&(yt&192)===128&&(ln&192)===128&&(ct=(J&15)<<18|(st&63)<<12|(yt&63)<<6|ln&63,ct>65535&&ct<1114112&&(ee=ct))}}ee===null?(ee=65533,Je=1):ee>65535&&(ee-=65536,j.push(ee>>>10&1023|55296),ee=56320|ee&1023),j.push(ee),F+=Je}return A(j)}var B=4096;function A(T){var k=T.length;if(k<=B)return String.fromCharCode.apply(String,T);for(var E="",j=0;j<k;)E+=String.fromCharCode.apply(String,T.slice(j,j+=B));return E}function R(T,k,E){var j="";E=Math.min(T.length,E);for(var F=k;F<E;++F)j+=String.fromCharCode(T[F]&127);return j}function N(T,k,E){var j="";E=Math.min(T.length,E);for(var F=k;F<E;++F)j+=String.fromCharCode(T[F]);return j}function D(T,k,E){var j=T.length;(!k||k<0)&&(k=0),(!E||E<0||E>j)&&(E=j);for(var F="",J=k;J<E;++J)F+=Wt[T[J]];return F}function z(T,k,E){for(var j=T.slice(k,E),F="",J=0;J<j.length-1;J+=2)F+=String.fromCharCode(j[J]+j[J+1]*256);return F}a.prototype.slice=function(k,E){var j=this.length;k=~~k,E=E===void 0?j:~~E,k<0?(k+=j,k<0&&(k=0)):k>j&&(k=j),E<0?(E+=j,E<0&&(E=0)):E>j&&(E=j),E<k&&(E=k);var F=this.subarray(k,E);return Object.setPrototypeOf(F,a.prototype),F};function V(T,k,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+k>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=this[k],J=1,ee=0;++ee<E&&(J*=256);)F+=this[k+ee]*J;return F},a.prototype.readUintBE=a.prototype.readUIntBE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=this[k+--E],J=1;E>0&&(J*=256);)F+=this[k+--E]*J;return F},a.prototype.readUint8=a.prototype.readUInt8=function(k,E){return k=k>>>0,E||V(k,1,this.length),this[k]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(k,E){return k=k>>>0,E||V(k,2,this.length),this[k]|this[k+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(k,E){return k=k>>>0,E||V(k,2,this.length),this[k]<<8|this[k+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(k,E){return k=k>>>0,E||V(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+this[k+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]*16777216+(this[k+1]<<16|this[k+2]<<8|this[k+3])},a.prototype.readIntLE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=this[k],J=1,ee=0;++ee<E&&(J*=256);)F+=this[k+ee]*J;return J*=128,F>=J&&(F-=Math.pow(2,8*E)),F},a.prototype.readIntBE=function(k,E,j){k=k>>>0,E=E>>>0,j||V(k,E,this.length);for(var F=E,J=1,ee=this[k+--F];F>0&&(J*=256);)ee+=this[k+--F]*J;return J*=128,ee>=J&&(ee-=Math.pow(2,8*E)),ee},a.prototype.readInt8=function(k,E){return k=k>>>0,E||V(k,1,this.length),this[k]&128?(255-this[k]+1)*-1:this[k]},a.prototype.readInt16LE=function(k,E){k=k>>>0,E||V(k,2,this.length);var j=this[k]|this[k+1]<<8;return j&32768?j|4294901760:j},a.prototype.readInt16BE=function(k,E){k=k>>>0,E||V(k,2,this.length);var j=this[k+1]|this[k]<<8;return j&32768?j|4294901760:j},a.prototype.readInt32LE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},a.prototype.readInt32BE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},a.prototype.readFloatLE=function(k,E){return k=k>>>0,E||V(k,4,this.length),n.read(this,k,!0,23,4)},a.prototype.readFloatBE=function(k,E){return k=k>>>0,E||V(k,4,this.length),n.read(this,k,!1,23,4)},a.prototype.readDoubleLE=function(k,E){return k=k>>>0,E||V(k,8,this.length),n.read(this,k,!0,52,8)},a.prototype.readDoubleBE=function(k,E){return k=k>>>0,E||V(k,8,this.length),n.read(this,k,!1,52,8)};function G(T,k,E,j,F,J){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(k>F||k<J)throw new RangeError('"value" argument is out of bounds');if(E+j>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(k,E,j,F){if(k=+k,E=E>>>0,j=j>>>0,!F){var J=Math.pow(2,8*j)-1;G(this,k,E,j,J,0)}var ee=1,Je=0;for(this[E]=k&255;++Je<j&&(ee*=256);)this[E+Je]=k/ee&255;return E+j},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(k,E,j,F){if(k=+k,E=E>>>0,j=j>>>0,!F){var J=Math.pow(2,8*j)-1;G(this,k,E,j,J,0)}var ee=j-1,Je=1;for(this[E+ee]=k&255;--ee>=0&&(Je*=256);)this[E+ee]=k/Je&255;return E+j},a.prototype.writeUint8=a.prototype.writeUInt8=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,1,255,0),this[E]=k&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,65535,0),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,65535,0),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,4294967295,0),this[E+3]=k>>>24,this[E+2]=k>>>16,this[E+1]=k>>>8,this[E]=k&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,4294967295,0),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4},a.prototype.writeIntLE=function(k,E,j,F){if(k=+k,E=E>>>0,!F){var J=Math.pow(2,8*j-1);G(this,k,E,j,J-1,-J)}var ee=0,Je=1,st=0;for(this[E]=k&255;++ee<j&&(Je*=256);)k<0&&st===0&&this[E+ee-1]!==0&&(st=1),this[E+ee]=(k/Je>>0)-st&255;return E+j},a.prototype.writeIntBE=function(k,E,j,F){if(k=+k,E=E>>>0,!F){var J=Math.pow(2,8*j-1);G(this,k,E,j,J-1,-J)}var ee=j-1,Je=1,st=0;for(this[E+ee]=k&255;--ee>=0&&(Je*=256);)k<0&&st===0&&this[E+ee+1]!==0&&(st=1),this[E+ee]=(k/Je>>0)-st&255;return E+j},a.prototype.writeInt8=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,1,127,-128),k<0&&(k=255+k+1),this[E]=k&255,E+1},a.prototype.writeInt16LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,32767,-32768),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeInt16BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,2,32767,-32768),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeInt32LE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,2147483647,-2147483648),this[E]=k&255,this[E+1]=k>>>8,this[E+2]=k>>>16,this[E+3]=k>>>24,E+4},a.prototype.writeInt32BE=function(k,E,j){return k=+k,E=E>>>0,j||G(this,k,E,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4};function _e(T,k,E,j,F,J){if(E+j>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function Se(T,k,E,j,F){return k=+k,E=E>>>0,F||_e(T,k,E,4),n.write(T,k,E,j,23,4),E+4}a.prototype.writeFloatLE=function(k,E,j){return Se(this,k,E,!0,j)},a.prototype.writeFloatBE=function(k,E,j){return Se(this,k,E,!1,j)};function Be(T,k,E,j,F){return k=+k,E=E>>>0,F||_e(T,k,E,8),n.write(T,k,E,j,52,8),E+8}a.prototype.writeDoubleLE=function(k,E,j){return Be(this,k,E,!0,j)},a.prototype.writeDoubleBE=function(k,E,j){return Be(this,k,E,!1,j)},a.prototype.copy=function(k,E,j,F){if(!a.isBuffer(k))throw new TypeError("argument should be a Buffer");if(j||(j=0),!F&&F!==0&&(F=this.length),E>=k.length&&(E=k.length),E||(E=0),F>0&&F<j&&(F=j),F===j||k.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(j<0||j>=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),k.length-E<F-j&&(F=k.length-E+j);var J=F-j;return this===k&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,j,F):Uint8Array.prototype.set.call(k,this.subarray(j,F),E),J},a.prototype.fill=function(k,E,j,F){if(typeof k=="string"){if(typeof E=="string"?(F=E,E=0,j=this.length):typeof j=="string"&&(F=j,j=this.length),F!==void 0&&typeof F!="string")throw new TypeError("encoding must be a string");if(typeof F=="string"&&!a.isEncoding(F))throw new TypeError("Unknown encoding: "+F);if(k.length===1){var J=k.charCodeAt(0);(F==="utf8"&&J<128||F==="latin1")&&(k=J)}}else typeof k=="number"?k=k&255:typeof k=="boolean"&&(k=Number(k));if(E<0||this.length<E||this.length<j)throw new RangeError("Out of range index");if(j<=E)return this;E=E>>>0,j=j===void 0?this.length:j>>>0,k||(k=0);var ee;if(typeof k=="number")for(ee=E;ee<j;++ee)this[ee]=k;else{var Je=a.isBuffer(k)?k:a.from(k,F),st=Je.length;if(st===0)throw new TypeError('The value "'+k+'" is invalid for argument "value"');for(ee=0;ee<j-E;++ee)this[ee+E]=Je[ee%st]}return this};var Z=/[^+/0-9A-Za-z-_]/g;function Y(T){if(T=T.split("=")[0],T=T.trim().replace(Z,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function ce(T,k){k=k||1/0;for(var E,j=T.length,F=null,J=[],ee=0;ee<j;++ee){if(E=T.charCodeAt(ee),E>55295&&E<57344){if(!F){if(E>56319){(k-=3)>-1&&J.push(239,191,189);continue}else if(ee+1===j){(k-=3)>-1&&J.push(239,191,189);continue}F=E;continue}if(E<56320){(k-=3)>-1&&J.push(239,191,189),F=E;continue}E=(F-55296<<10|E-56320)+65536}else F&&(k-=3)>-1&&J.push(239,191,189);if(F=null,E<128){if((k-=1)<0)break;J.push(E)}else if(E<2048){if((k-=2)<0)break;J.push(E>>6|192,E&63|128)}else if(E<65536){if((k-=3)<0)break;J.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((k-=4)<0)break;J.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return J}function Ee(T){for(var k=[],E=0;E<T.length;++E)k.push(T.charCodeAt(E)&255);return k}function fe(T,k){for(var E,j,F,J=[],ee=0;ee<T.length&&!((k-=2)<0);++ee)E=T.charCodeAt(ee),j=E>>8,F=E%256,J.push(F),J.push(j);return J}function Ae(T){return t.toByteArray(Y(T))}function Ce(T,k,E,j){for(var F=0;F<j&&!(F+E>=k.length||F>=T.length);++F)k[F+E]=T[F];return F}function Ye(T,k){return T instanceof k||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===k.name}function pt(T){return T!==T}var Wt=function(){for(var T="0123456789abcdef",k=new Array(256),E=0;E<16;++E)for(var j=E*16,F=0;F<16;++F)k[j+F]=T[E]+T[F];return k}()})(Iv);var Qe;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Qe||(Qe={}));var gb;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(gb||(gb={}));const he=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bs=e=>{switch(typeof e){case"undefined":return he.undefined;case"string":return he.string;case"number":return isNaN(e)?he.nan:he.number;case"boolean":return he.boolean;case"function":return he.function;case"bigint":return he.bigint;case"symbol":return he.symbol;case"object":return Array.isArray(e)?he.array:e===null?he.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?he.promise:typeof Map<"u"&&e instanceof Map?he.map:typeof Set<"u"&&e instanceof Set?he.set:typeof Date<"u"&&e instanceof Date?he.date:he.object;default:return he.unknown}},Q=Qe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Q8=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ir extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof Ir))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ir.create=e=>new Ir(e);const lu=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===he.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Qe.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qe.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qe.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${Qe.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Qe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,Qe.assertNever(e)}return{message:n}};let FM=lu;function eV(e){FM=e}function hg(){return FM}const pg=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},tV=[];function de(e,t){const n=hg(),r=pg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===lu?void 0:lu].filter(o=>!!o)});e.common.issues.push(r)}class Hn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Re;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return Hn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Re;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const Re=Object.freeze({status:"aborted"}),jc=e=>({status:"dirty",value:e}),Zn=e=>({status:"valid",value:e}),vb=e=>e.status==="aborted",yb=e=>e.status==="dirty",Vf=e=>e.status==="valid",Uf=e=>typeof Promise<"u"&&e instanceof Promise;function mg(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function zM(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var be;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(be||(be={}));var Pd,Nd;class di{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const RC=(e,t)=>{if(Vf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ir(e.common.issues);return this._error=n,this._error}}};function Fe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{var l,c;const{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class Ue{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Bs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Hn,ctx:{common:t.parent.common,data:t.data,parsedType:Bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Uf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bs(t)},i=this._parseSync({data:t,path:o.path,parent:o});return RC(o,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Bs(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Uf(o)?o:Promise.resolve(o));return RC(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),a=()=>i.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Uo({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return li.create(this,this._def)}nullable(){return wa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fo.create(this,this._def)}promise(){return uu.create(this,this._def)}or(t){return Gf.create([this,t],this._def)}and(t){return qf.create(this,t,this._def)}transform(t){return new Uo({...Fe(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Qf({...Fe(this._def),innerType:this,defaultValue:n,typeName:Me.ZodDefault})}brand(){return new q1({typeName:Me.ZodBranded,type:this,...Fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new eh({...Fe(this._def),innerType:this,catchValue:n,typeName:Me.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Vh.create(this,t)}readonly(){return th.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nV=/^c[^\s-]{8,}$/i,rV=/^[0-9a-z]+$/,oV=/^[0-9A-HJKMNP-TV-Z]{26}$/,iV=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,sV=/^[a-z0-9_-]{21}$/i,aV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,lV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kx;const uV=/^(?:(?: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])$/,dV=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,fV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$M="((\\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])))",hV=new RegExp(`^${$M}$`);function BM(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function pV(e){return new RegExp(`^${BM(e)}$`)}function VM(e){let t=`${$M}T${BM(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function mV(e,t){return!!((t==="v4"||!t)&&uV.test(e)||(t==="v6"||!t)&&dV.test(e))}class Ro extends Ue{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==he.string){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.string,received:i.parsedType}),Re}const r=new Hn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?de(o,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&de(o,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")lV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"email",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")kx||(kx=new RegExp(cV,"u")),kx.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"emoji",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")iV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"uuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")sV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"nanoid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")nV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")rV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid2",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")oV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ulid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),de(o,{validation:"url",code:Q.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"regex",code:Q.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?VM(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?hV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?pV(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?aV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"duration",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?mV(t.data,i.version)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ip",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"base64",code:Q.invalid_string,message:i.message}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:Q.invalid_string,...be.errToObj(r)})}_addCheck(t){return new Ro({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...be.errToObj(t)})}url(t){return this._addCheck({kind:"url",...be.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...be.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...be.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...be.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...be.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...be.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...be.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...be.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...be.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...be.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...be.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...be.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...be.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...be.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...be.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...be.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...be.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...be.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...be.errToObj(n)})}nonempty(t){return this.min(1,be.errToObj(t))}trim(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ro.create=e=>{var t;return new Ro({checks:[],typeName:Me.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Fe(e)})};function gV(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),s=parseInt(t.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class ya extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==he.number){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.number,received:i.parsedType}),Re}let r;const o=new Hn;for(const i of this._def.checks)i.kind==="int"?Qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:Q.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?gV(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_finite,message:i.message}),o.dirty()):Qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,o){return new ya({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(o)}]})}_addCheck(t){return new ya({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:be.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:be.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:be.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:be.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Qe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}ya.create=e=>new ya({checks:[],typeName:Me.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class xa extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==he.bigint){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.bigint,received:i.parsedType}),Re}let r;const o=new Hn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,o){return new xa({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(o)}]})}_addCheck(t){return new xa({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}xa.create=e=>{var t;return new xa({checks:[],typeName:Me.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Fe(e)})};class Hf extends Ue{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==he.boolean){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.boolean,received:r.parsedType}),Re}return Zn(t.data)}}Hf.create=e=>new Hf({typeName:Me.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class Pl extends Ue{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==he.date){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:he.date,received:i.parsedType}),Re}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_date}),Re}const r=new Hn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Pl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:be.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:be.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Pl.create=e=>new Pl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Me.ZodDate,...Fe(e)});class gg extends Ue{_parse(t){if(this._getType(t)!==he.symbol){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.symbol,received:r.parsedType}),Re}return Zn(t.data)}}gg.create=e=>new gg({typeName:Me.ZodSymbol,...Fe(e)});class Wf extends Ue{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.undefined,received:r.parsedType}),Re}return Zn(t.data)}}Wf.create=e=>new Wf({typeName:Me.ZodUndefined,...Fe(e)});class Kf extends Ue{_parse(t){if(this._getType(t)!==he.null){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.null,received:r.parsedType}),Re}return Zn(t.data)}}Kf.create=e=>new Kf({typeName:Me.ZodNull,...Fe(e)});class cu extends Ue{constructor(){super(...arguments),this._any=!0}_parse(t){return Zn(t.data)}}cu.create=e=>new cu({typeName:Me.ZodAny,...Fe(e)});class dl extends Ue{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Zn(t.data)}}dl.create=e=>new dl({typeName:Me.ZodUnknown,...Fe(e)});class ts extends Ue{_parse(t){const n=this._getOrReturnCtx(t);return de(n,{code:Q.invalid_type,expected:he.never,received:n.parsedType}),Re}}ts.create=e=>new ts({typeName:Me.ZodNever,...Fe(e)});class vg extends Ue{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.void,received:r.parsedType}),Re}return Zn(t.data)}}vg.create=e=>new vg({typeName:Me.ZodVoid,...Fe(e)});class Fo extends Ue{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==he.array)return de(n,{code:Q.invalid_type,expected:he.array,received:n.parsedType}),Re;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(de(n,{code:s?Q.too_big:Q.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(de(n,{code:Q.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(de(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new di(n,s,n.path,a)))).then(s=>Hn.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new di(n,s,n.path,a)));return Hn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Fo({...this._def,minLength:{value:t,message:be.toString(n)}})}max(t,n){return new Fo({...this._def,maxLength:{value:t,message:be.toString(n)}})}length(t,n){return new Fo({...this._def,exactLength:{value:t,message:be.toString(n)}})}nonempty(t){return this.min(1,t)}}Fo.create=(e,t)=>new Fo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...Fe(t)});function dc(e){if(e instanceof Mt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=li.create(dc(r))}return new Mt({...e._def,shape:()=>t})}else return e instanceof Fo?new Fo({...e._def,type:dc(e.element)}):e instanceof li?li.create(dc(e.unwrap())):e instanceof wa?wa.create(dc(e.unwrap())):e instanceof fi?fi.create(e.items.map(t=>dc(t))):e}class Mt extends Ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Qe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==he.object){const c=this._getOrReturnCtx(t);return de(c,{code:Q.invalid_type,expected:he.object,received:c.parsedType}),Re}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ts&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new di(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof ts){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(de(o,{code:Q.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new di(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Hn.mergeObjectSync(r,c)):Hn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return be.errToObj,new Mt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,s,a;const l=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=be.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Mt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Mt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Me.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Mt({...this._def,catchall:t})}pick(t){const n={};return Qe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}omit(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}deepPartial(){return dc(this)}partial(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Mt({...this._def,shape:()=>n})}required(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof li;)i=i._def.innerType;n[r]=i}}),new Mt({...this._def,shape:()=>n})}keyof(){return UM(Qe.objectKeys(this.shape))}}Mt.create=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strip",catchall:ts.create(),typeName:Me.ZodObject,...Fe(t)});Mt.strictCreate=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strict",catchall:ts.create(),typeName:Me.ZodObject,...Fe(t)});Mt.lazycreate=(e,t)=>new Mt({shape:e,unknownKeys:"strip",catchall:ts.create(),typeName:Me.ZodObject,...Fe(t)});class Gf extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new Ir(a.ctx.common.issues));return de(n,{code:Q.invalid_union,unionErrors:s}),Re}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new Ir(l));return de(n,{code:Q.invalid_union,unionErrors:a}),Re}}get options(){return this._def.options}}Gf.create=(e,t)=>new Gf({options:e,typeName:Me.ZodUnion,...Fe(t)});const Ti=e=>e instanceof Jf?Ti(e.schema):e instanceof Uo?Ti(e.innerType()):e instanceof Xf?[e.value]:e instanceof ba?e.options:e instanceof Zf?Qe.objectValues(e.enum):e instanceof Qf?Ti(e._def.innerType):e instanceof Wf?[void 0]:e instanceof Kf?[null]:e instanceof li?[void 0,...Ti(e.unwrap())]:e instanceof wa?[null,...Ti(e.unwrap())]:e instanceof q1||e instanceof th?Ti(e.unwrap()):e instanceof eh?Ti(e._def.innerType):[];class Dv extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.object)return de(n,{code:Q.invalid_type,expected:he.object,received:n.parsedType}),Re;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(de(n,{code:Q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const s=Ti(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new Dv({typeName:Me.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Fe(r)})}}function xb(e,t){const n=Bs(e),r=Bs(t);if(e===t)return{valid:!0,data:e};if(n===he.object&&r===he.object){const o=Qe.objectKeys(t),i=Qe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(const a of i){const l=xb(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===he.array&&r===he.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const s=e[i],a=t[i],l=xb(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===he.date&&r===he.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class qf extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(vb(i)||vb(s))return Re;const a=xb(i.value,s.value);return a.valid?((yb(i)||yb(s))&&n.dirty(),{status:n.value,value:a.data}):(de(r,{code:Q.invalid_intersection_types}),Re)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}qf.create=(e,t,n)=>new qf({left:e,right:t,typeName:Me.ZodIntersection,...Fe(n)});class fi extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.array)return de(r,{code:Q.invalid_type,expected:he.array,received:r.parsedType}),Re;if(r.data.length<this._def.items.length)return de(r,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Re;!this._def.rest&&r.data.length>this._def.items.length&&(de(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new di(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Hn.mergeArray(n,s)):Hn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new fi({...this._def,rest:t})}}fi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fi({items:e,typeName:Me.ZodTuple,rest:null,...Fe(t)})};class Yf extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.object)return de(r,{code:Q.invalid_type,expected:he.object,received:r.parsedType}),Re;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new di(r,a,r.path,a)),value:s._parse(new di(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Hn.mergeObjectAsync(n,o):Hn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ue?new Yf({keyType:t,valueType:n,typeName:Me.ZodRecord,...Fe(r)}):new Yf({keyType:Ro.create(),valueType:t,typeName:Me.ZodRecord,...Fe(n)})}}class yg extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.map)return de(r,{code:Q.invalid_type,expected:he.map,received:r.parsedType}),Re;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new di(r,a,r.path,[c,"key"])),value:i._parse(new di(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}yg.create=(e,t,n)=>new yg({valueType:t,keyType:e,typeName:Me.ZodMap,...Fe(n)});class Nl extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.set)return de(r,{code:Q.invalid_type,expected:he.set,received:r.parsedType}),Re;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(de(r,{code:Q.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(de(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Re;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new di(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new Nl({...this._def,minSize:{value:t,message:be.toString(n)}})}max(t,n){return new Nl({...this._def,maxSize:{value:t,message:be.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Nl.create=(e,t)=>new Nl({valueType:e,minSize:null,maxSize:null,typeName:Me.ZodSet,...Fe(t)});class $c extends Ue{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.function)return de(n,{code:Q.invalid_type,expected:he.function,received:n.parsedType}),Re;function r(a,l){return pg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,hg(),lu].filter(c=>!!c),issueData:{code:Q.invalid_arguments,argumentsError:l}})}function o(a,l){return pg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,hg(),lu].filter(c=>!!c),issueData:{code:Q.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof uu){const a=this;return Zn(async function(...l){const c=new Ir([]),u=await a._def.args.parseAsync(l,i).catch(p=>{throw c.addIssue(r(l,p)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw c.addIssue(o(d,p)),c})})}else{const a=this;return Zn(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new Ir([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,i);if(!d.success)throw new Ir([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new $c({...this._def,args:fi.create(t).rest(dl.create())})}returns(t){return new $c({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new $c({args:t||fi.create([]).rest(dl.create()),returns:n||dl.create(),typeName:Me.ZodFunction,...Fe(r)})}}class Jf extends Ue{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Jf.create=(e,t)=>new Jf({getter:e,typeName:Me.ZodLazy,...Fe(t)});class Xf extends Ue{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return de(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),Re}return{status:"valid",value:t.data}}get value(){return this._def.value}}Xf.create=(e,t)=>new Xf({value:e,typeName:Me.ZodLiteral,...Fe(t)});function UM(e,t){return new ba({values:e,typeName:Me.ZodEnum,...Fe(t)})}class ba extends Ue{constructor(){super(...arguments),Pd.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{expected:Qe.joinValues(r),received:n.parsedType,code:Q.invalid_type}),Re}if(mg(this,Pd)||zM(this,Pd,new Set(this._def.values)),!mg(this,Pd).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{received:n.data,code:Q.invalid_enum_value,options:r}),Re}return Zn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return ba.create(t,{...this._def,...n})}exclude(t,n=this._def){return ba.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Pd=new WeakMap;ba.create=UM;class Zf extends Ue{constructor(){super(...arguments),Nd.set(this,void 0)}_parse(t){const n=Qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==he.string&&r.parsedType!==he.number){const o=Qe.objectValues(n);return de(r,{expected:Qe.joinValues(o),received:r.parsedType,code:Q.invalid_type}),Re}if(mg(this,Nd)||zM(this,Nd,new Set(Qe.getValidEnumValues(this._def.values))),!mg(this,Nd).has(t.data)){const o=Qe.objectValues(n);return de(r,{received:r.data,code:Q.invalid_enum_value,options:o}),Re}return Zn(t.data)}get enum(){return this._def.values}}Nd=new WeakMap;Zf.create=(e,t)=>new Zf({values:e,typeName:Me.ZodNativeEnum,...Fe(t)});class uu extends Ue{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.promise&&n.common.async===!1)return de(n,{code:Q.invalid_type,expected:he.promise,received:n.parsedType}),Re;const r=n.parsedType===he.promise?n.data:Promise.resolve(n.data);return Zn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}uu.create=(e,t)=>new uu({type:e,typeName:Me.ZodPromise,...Fe(t)});class Uo extends Ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{de(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Re;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Re:l.status==="dirty"||n.value==="dirty"?jc(l.value):l});{if(n.value==="aborted")return Re;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Re:a.status==="dirty"||n.value==="dirty"?jc(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Re:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Re:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Vf(s))return s;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Vf(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);Qe.assertNever(o)}}Uo.create=(e,t,n)=>new Uo({schema:e,typeName:Me.ZodEffects,effect:t,...Fe(n)});Uo.createWithPreprocess=(e,t,n)=>new Uo({schema:t,effect:{type:"preprocess",transform:e},typeName:Me.ZodEffects,...Fe(n)});class li extends Ue{_parse(t){return this._getType(t)===he.undefined?Zn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}li.create=(e,t)=>new li({innerType:e,typeName:Me.ZodOptional,...Fe(t)});class wa extends Ue{_parse(t){return this._getType(t)===he.null?Zn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wa.create=(e,t)=>new wa({innerType:e,typeName:Me.ZodNullable,...Fe(t)});class Qf extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===he.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Qf.create=(e,t)=>new Qf({innerType:e,typeName:Me.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Fe(t)});class eh extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Uf(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ir(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ir(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eh.create=(e,t)=>new eh({innerType:e,typeName:Me.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Fe(t)});class xg extends Ue{_parse(t){if(this._getType(t)!==he.nan){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:he.nan,received:r.parsedType}),Re}return{status:"valid",value:t.data}}}xg.create=e=>new xg({typeName:Me.ZodNaN,...Fe(e)});const vV=Symbol("zod_brand");class q1 extends Ue{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Vh extends Ue{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Re:i.status==="dirty"?(n.dirty(),jc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Re:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Vh({in:t,out:n,typeName:Me.ZodPipeline})}}class th extends Ue{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Vf(o)&&(o.value=Object.freeze(o.value)),o);return Uf(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}th.create=(e,t)=>new th({innerType:e,typeName:Me.ZodReadonly,...Fe(t)});function HM(e,t={},n){return e?cu.create().superRefine((r,o)=>{var i,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(i=a.fatal)!==null&&i!==void 0?i:n)!==null&&s!==void 0?s:!0,c=typeof a=="string"?{message:a}:a;o.addIssue({code:"custom",...c,fatal:l})}}):cu.create()}const yV={object:Mt.lazycreate};var Me;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Me||(Me={}));const xV=(e,t={message:`Input not instance of ${e.name}`})=>HM(n=>n instanceof e,t),WM=Ro.create,KM=ya.create,bV=xg.create,wV=xa.create,GM=Hf.create,SV=Pl.create,kV=gg.create,EV=Wf.create,CV=Kf.create,_V=cu.create,PV=dl.create,NV=ts.create,TV=vg.create,OV=Fo.create,MV=Mt.create,jV=Mt.strictCreate,RV=Gf.create,IV=Dv.create,AV=qf.create,DV=fi.create,LV=Yf.create,FV=yg.create,zV=Nl.create,$V=$c.create,BV=Jf.create,VV=Xf.create,UV=ba.create,HV=Zf.create,WV=uu.create,IC=Uo.create,KV=li.create,GV=wa.create,qV=Uo.createWithPreprocess,YV=Vh.create,JV=()=>WM().optional(),XV=()=>KM().optional(),ZV=()=>GM().optional(),QV={string:e=>Ro.create({...e,coerce:!0}),number:e=>ya.create({...e,coerce:!0}),boolean:e=>Hf.create({...e,coerce:!0}),bigint:e=>xa.create({...e,coerce:!0}),date:e=>Pl.create({...e,coerce:!0})},eU=Re;var y=Object.freeze({__proto__:null,defaultErrorMap:lu,setErrorMap:eV,getErrorMap:hg,makeIssue:pg,EMPTY_PATH:tV,addIssueToContext:de,ParseStatus:Hn,INVALID:Re,DIRTY:jc,OK:Zn,isAborted:vb,isDirty:yb,isValid:Vf,isAsync:Uf,get util(){return Qe},get objectUtil(){return gb},ZodParsedType:he,getParsedType:Bs,ZodType:Ue,datetimeRegex:VM,ZodString:Ro,ZodNumber:ya,ZodBigInt:xa,ZodBoolean:Hf,ZodDate:Pl,ZodSymbol:gg,ZodUndefined:Wf,ZodNull:Kf,ZodAny:cu,ZodUnknown:dl,ZodNever:ts,ZodVoid:vg,ZodArray:Fo,ZodObject:Mt,ZodUnion:Gf,ZodDiscriminatedUnion:Dv,ZodIntersection:qf,ZodTuple:fi,ZodRecord:Yf,ZodMap:yg,ZodSet:Nl,ZodFunction:$c,ZodLazy:Jf,ZodLiteral:Xf,ZodEnum:ba,ZodNativeEnum:Zf,ZodPromise:uu,ZodEffects:Uo,ZodTransformer:Uo,ZodOptional:li,ZodNullable:wa,ZodDefault:Qf,ZodCatch:eh,ZodNaN:xg,BRAND:vV,ZodBranded:q1,ZodPipeline:Vh,ZodReadonly:th,custom:HM,Schema:Ue,ZodSchema:Ue,late:yV,get ZodFirstPartyTypeKind(){return Me},coerce:QV,any:_V,array:OV,bigint:wV,boolean:GM,date:SV,discriminatedUnion:IV,effect:IC,enum:UV,function:$V,instanceof:xV,intersection:AV,lazy:BV,literal:VV,map:FV,nan:bV,nativeEnum:HV,never:NV,null:CV,nullable:GV,number:KM,object:MV,oboolean:ZV,onumber:XV,optional:KV,ostring:JV,pipeline:YV,preprocess:qV,promise:WV,record:LV,set:zV,strictObject:jV,string:WM,symbol:kV,transformer:IC,tuple:DV,undefined:EV,union:RV,unknown:PV,void:TV,NEVER:eU,ZodIssueCode:Q,quotelessJson:Q8,ZodError:Ir});function Y1(e){return e instanceof Error&&e.name==="ZodError"&&"issues"in e&&Array.isArray(e.issues)}var bb=class extends Error{constructor(n,r){super(n,r);$t(this,"name");$t(this,"details");this.name="ZodValidationError",this.details=tU(r)}toString(){return this.message}};function tU(e){if(e){const t=e.cause;if(Y1(t))return t.issues}return[]}function qM(e){return e.length!==0}var nU=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function rU(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+oU(n)+'"]';if(!nU.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function oU(e){return e.replace(/"/g,'\\"')}var iU="; ",sU=99,YM="Validation error",aU=": ",lU=", or ";function cU(e={}){const{issueSeparator:t=iU,unionSeparator:n=lU,prefixSeparator:r=aU,prefix:o=YM,includePath:i=!0,maxIssuesInMessage:s=sU}=e;return a=>{const l=a.slice(0,s).map(c=>mm({issue:c,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return uU(l,o,r)}}function mm(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:o}=e;if(t.code===Q.invalid_union)return t.unionErrors.reduce((i,s)=>{const a=s.issues.map(l=>mm({issue:l,issueSeparator:n,unionSeparator:r,includePath:o})).join(n);return i.includes(a)||i.push(a),i},[]).join(r);if(t.code===Q.invalid_arguments)return[t.message,...t.argumentsError.issues.map(i=>mm({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(t.code===Q.invalid_return_type)return[t.message,...t.returnTypeError.issues.map(i=>mm({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(o&&qM(t.path)){if(t.path.length===1){const i=t.path[0];if(typeof i=="number")return`${t.message} at index ${i}`}return`${t.message} at "${rU(t.path)}"`}return t.message}function uU(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:YM}function AC(e,t={}){if(!Y1(e))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${hU.name}" method instead?`);return JM(e,t)}function JM(e,t={}){const n=e.errors;let r;return qM(n)?r=dU(t)(n):r=e.message,new bb(r,{cause:e})}function dU(e){return"messageBuilder"in e?e.messageBuilder:cU(e)}var fU=(e={})=>t=>Y1(t)?JM(t,e):t instanceof Error?new bb(t.message,{cause:t}):new bb("Unknown error");function hU(e,t={}){return fU(t)(e)}function pU(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mU(e){var t=pU(e,"string");return typeof t=="symbol"?t:t+""}function ut(e,t,n){return(t=mU(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ai(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DC(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function J1(e,t){if(e){if(typeof e=="string")return wb(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wb(e,t):void 0}}function X1(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=J1(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
49
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function gU(e,t,n){var r={},o=[],i=0,s=X1((e==null?void 0:e.content)||[]),a;try{for(s.s();!(a=s.n()).done;){var l=a.value,c=vU([(i++).toString()],l,r,t,n);o.push(c)}}catch(u){s.e(u)}finally{s.f()}return{blocks:o,files:r}}function vU(e,t,n,r,o){if(t.type==="heading"){var i,s,a=((i=t.attrs)===null||i===void 0?void 0:i.level)||1;if(Number.isNaN(a))throw new Error("Invalid header depth");return{tag:"h".concat(a),children:((s=t.content)===null||s===void 0?void 0:s.map(function(c,u){return yU(e.concat("children",u.toString()),c,n,r,o)}))||[]}}else{if(t.type==="paragraph")return XM(e,t,n,r,o);if(t.type==="bulletList")return ej(e,t,n,r,o);if(t.type==="orderedList")return tj(e,t,n,r,o);var l=t;throw new Error("Unhandled node type: ".concat("type"in l?"exhaustiveCheck.type":"unknown"))}}function yU(e,t,n,r,o){if(t.type==="text")return ZM(t);if(t.type==="hardBreak")return{tag:"br"};if(t.type==="image")return nj(e,t,n,r,o);var i=t;throw new Error("Unexpected heading child type: ".concat(JSON.stringify(i,null,2)))}function XM(e,t,n,r,o){var i;return{tag:"p",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="text")return ZM(s);if(s.type==="hardBreak")return{tag:"br"};if(s.type==="image")return nj(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected paragraph child type: ".concat(JSON.stringify(l,null,2)))}))||[]}}function ZM(e){if(e.type==="text"){var t,n,r=((t=e.marks)===null||t===void 0?void 0:t.flatMap(function(a){return a.type!=="link"?a.type==="strike"?["line-through"]:[a.type]:[]}))||[];if((n=e.marks)!==null&&n!==void 0&&n.some(function(a){return a.type==="link"})){var o;if(r.length>0){var i;return{tag:"a",href:((i=e.marks.find(function(a){return a.type==="link"}))===null||i===void 0?void 0:i.attrs.href)||"",children:[{tag:"span",styles:r,children:[e.text]}]}}return{tag:"a",href:((o=e.marks.find(function(a){return a.type==="link"}))===null||o===void 0?void 0:o.attrs.href)||"",children:[e.text]}}return r.length>0?{tag:"span",styles:r,children:[e.text]}:e.text}else{var s=e.type;throw new Error("Unexpected node type: ".concat(s))}}function QM(e,t,n,r,o){var i;return{tag:"li",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="paragraph")return XM(e.concat("children",a.toString()),s,n,r,o);if(s.type==="bulletList")return ej(e.concat("children",a.toString()),s,n,r,o);if(s.type==="orderedList")return tj(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected list child type: ".concat(l))}))||[]}}function ej(e,t,n,r,o){var i;return{tag:"ul",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return QM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected bullet list child type: ".concat(l))}))||[]}}function tj(e,t,n,r,o){var i;return{tag:"ol",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return QM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected ordered list child type: ".concat(l))}))||[]}}var LC=function(t){if(t==null)return 0;if(typeof t=="number")return t;var n=parseInt(t,10);return isNaN(n)?0:n},xU=new TextEncoder;function nj(e,t,n,r,o){if(t.attrs&&t.attrs.src.startsWith("data:")){var i=Iv.Buffer.from(t.attrs.src.split(",")[1],"base64"),s=X.getSHA256Hash(new Uint8Array(i)),a=X.getMimeType(t.attrs.src);if(a===void 0)throw new Error("Could not detect Mime Type for image: ".concat(t.attrs.src));var l=X.createFilename(t.attrs.src,t.attrs.fileName||"",{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:a},s),c=r!=null&&r.endsWith("/")?r:"".concat(r,"/"),u="".concat(c).concat(l),d=n[u],h=e.concat("src"),p=X.remote.hashToRemoteFileHash(s),m=o?X.remote.createRemoteRef(o.remoteHost,Ai(Ai({},o),{},{fileHash:p,validationHash:X.remote.getValidationHash(o.coreVersion,o.schema,a,{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0},p,xU),filePath:u.slice(1)})):u;return d?d.patchPaths.push(h):n[u]={value:t.attrs.src,filePathOrRef:m,metadata:{height:LC(t.attrs.height),width:LC(t.attrs.width),mimeType:a},patchPaths:[h]},{tag:"img",src:Ai(Ai(ut({},vt,m),o?ut({},Ie,"remote"):ut(ut({},Ie,"file"),fb,"image")),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:a}})}}else if(t.attrs){var v=t.attrs.src,x=Ex("patch_id",v),b=v.split("?")[0],w=!1;if(x)if(w=Ex("remote",v)==="true",w){var S=Ex("ref",v);S?b=decodeURIComponent(S):console.error("Remote image URL does not contain ref: "+v)}else b.startsWith("/api/val/files/public")?b=b.slice(14):console.error("Patched image URL does not start with /api/val/files: "+v);else o&&b.startsWith(o.remoteHost)?w=!0:b.startsWith("/public")?console.error("Unpatched image URL starts with /public: "+v):b="/public".concat(b);var C={tag:"img",src:Ai(Ai({},ut(w?ut({},Ie,"remote"):ut(ut({},Ie,"file"),fb,"image"),vt,b)),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:b&&X.filenameToMimeType(b)||""}},x?{patch_id:x}:{})};return C}else throw new Error("Invalid image node (no attrs): "+JSON.stringify(t))}function Ex(e,t){var n=t.split("?");if(!(n.length<2)){var r=n[1],o=new URLSearchParams(r);if(o.has(e))return o.get(e)}}var rj=y.object({type:y.union([y.literal("bold"),y.literal("strike"),y.literal("italic")])}),bU=y.object({type:y.literal("link"),attrs:y.object({href:y.string(),target:y.union([y.literal("_blank"),y.null()]),auto:y.boolean()})}),oj=y.intersection(y.object({type:y.literal("text"),text:y.string()}),y.object({marks:y.array(y.union([rj,bU]))}).partial()),ij=y.intersection(y.object({type:y.literal("hardBreak")}),y.object({marks:y.array(rj)}).partial()),sj=y.intersection(y.object({type:y.literal("image")}),y.object({attrs:y.intersection(y.object({src:y.string()}),y.object({align:y.union([y.literal("center"),y.literal("end"),y.literal("justify"),y.literal("left"),y.literal("match-parent"),y.literal("right"),y.literal("start"),y.null()]),alt:y.union([y.string(),y.null()]),height:y.union([y.string(),y.number(),y.null()]),width:y.union([y.string(),y.number(),y.null()]),rotate:y.union([y.string(),y.null()]),title:y.union([y.string(),y.null()]),fileName:y.union([y.string(),y.null()])}).partial())}).partial()),wU=y.intersection(y.object({type:y.literal("heading")}),y.object({attrs:y.object({level:y.number()}),content:y.array(y.union([oj,sj,ij]))}).partial()),aj=y.lazy(function(){return y.intersection(y.object({type:y.literal("bulletList")}),y.object({content:y.array(cj)}).partial())}),lj=y.lazy(function(){return y.intersection(y.object({type:y.literal("orderedList")}),y.object({content:y.array(cj)}).partial())}),cj=y.lazy(function(){return y.intersection(y.object({type:y.literal("listItem")}),y.object({attrs:y.object({closed:y.boolean(),nested:y.boolean()}).partial().optional(),content:y.array(y.union([uj,aj,lj]))}).partial())}),uj=y.lazy(function(){return y.intersection(y.object({type:y.literal("paragraph")}),y.object({content:y.array(y.union([oj,sj,ij]))}).partial())});y.object({type:y.literal("doc"),content:y.array(y.union([uj,wU,aj,lj]))});function SU(e){if(Array.isArray(e))return wb(e)}function kU(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EU(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CU(e){return SU(e)||kU(e)||J1(e)||EU()}function zp(e){return{type:"doc",content:e.map(function(t){return _U(t)})}}function _U(e){switch(e.tag){case"h1":return ec(1,e.children);case"h2":return ec(2,e.children);case"h3":return ec(3,e.children);case"h4":return ec(4,e.children);case"h5":return ec(5,e.children);case"h6":return ec(6,e.children);case"p":return hj(e.children);case"ul":return vj(e);case"ol":return yj(e);default:{var t=e;throw Error("Unexpected child node: "+JSON.stringify(t))}}}function ec(e,t){return{type:"heading",attrs:{level:e},content:t.flatMap(dj)}}function Lv(e){return{type:"text",text:e}}function dj(e){return typeof e=="string"?[Lv(e)]:e.tag==="img"?[gj(e)]:e.tag==="br"?[pj()]:e.tag==="a"?mj(e):fj(e)}function fj(e){if(e.styles.length===0&&e.children.length===1){if(typeof e.children[0]=="string")return[Lv(e.children[0])];throw Error("Unexpected amount of children in span node: "+JSON.stringify(e,null,2))}var t=Array.from(new Set(e.styles));return e.children.map(function(n){return{type:"text",text:n,marks:t.map(function(r){switch(r){case"bold":return{type:"bold"};case"italic":return{type:"italic"};case"line-through":return{type:"strike"};default:{var o=r;throw Error("Unexpected span class: "+o)}}})}})}function hj(e){return{type:"paragraph",content:e.flatMap(function(t){if(typeof t=="string")return[Lv(t)];switch(t.tag){case"span":return fj(t);case"a":return mj(t);case"img":return[gj(t)];case"br":return[pj()];default:{var n=t;throw Error("Unexpected paragraph child: "+JSON.stringify(n))}}})}}function pj(){return{type:"hardBreak",marks:[]}}function mj(e){return e.children.flatMap(dj).map(function(t){return t.type!=="text"?t:Ai(Ai({},t),{},{marks:(t.marks||[]).concat({type:"link",attrs:{href:e.href,auto:!1,target:null}})})})}function gj(e){var t,n,r,o=e.src;if(!(Ie in o)||o[Ie]!=="file"&&o[Ie]!=="remote")throw Error("Expected file source in image node");var i;return o[Ie]==="remote"?i=X.convertRemoteSource(o):i=X.convertFileSource(o),{type:"image",attrs:{height:(t=o.metadata)===null||t===void 0?void 0:t.height,width:(n=o.metadata)===null||n===void 0?void 0:n.width,alt:(r=o.metadata)===null||r===void 0?void 0:r.alt,src:i.url}}}function vj(e){return{type:"bulletList",content:e.children.map(xj)}}function yj(e){return{type:"orderedList",content:e.children.map(xj)}}function xj(e){return{type:"listItem",content:PU(e.children)}}function PU(e){var t=[],n=X1(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,i=t[t.length-1];i||(i={type:"paragraph",content:[]},t.push(i));var s=i.content;if(typeof o=="string")s.push(Lv(o));else switch(o.tag){case"ol":{t.push(yj(o));break}case"ul":{t.push(vj(o));break}case"p":{var a=hj(o.children);i.type==="paragraph"&&a.type==="paragraph"?a.content&&s.push.apply(s,CU(a.content)):t.push(a);break}default:{var l=o;throw Error("Unexpected list item child: "+JSON.stringify(l))}}}}catch(c){n.e(c)}finally{n.f()}return t}var Ss=X.VAL_SESSION_COOKIE,tc=X.VAL_STATE_COOKIE,md=X.VAL_ENABLE_COOKIE_NAME;function Td(){Td=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(A,R,N){A[R]=N.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(A,R,N){return Object.defineProperty(A,R,{value:N,enumerable:!0,configurable:!0,writable:!0}),A[R]}try{c({},"")}catch{c=function(R,N,D){return R[N]=D}}function u(A,R,N,D){var z=R&&R.prototype instanceof b?R:b,V=Object.create(z.prototype),G=new W(D||[]);return o(V,"_invoke",{value:L(A,N,G)}),V}function d(A,R,N){try{return{type:"normal",arg:A.call(R,N)}}catch(D){return{type:"throw",arg:D}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",m="executing",v="completed",x={};function b(){}function w(){}function S(){}var C={};c(C,s,function(){return this});var _=Object.getPrototypeOf,P=_&&_(_(B([])));P&&P!==n&&r.call(P,s)&&(C=P);var O=S.prototype=b.prototype=Object.create(C);function M(A){["next","throw","return"].forEach(function(R){c(A,R,function(N){return this._invoke(R,N)})})}function I(A,R){function N(z,V,G,_e){var Se=d(A[z],A,V);if(Se.type!=="throw"){var Be=Se.arg,Z=Be.value;return Z&&typeof Z=="object"&&r.call(Z,"__await")?R.resolve(Z.__await).then(function(Y){N("next",Y,G,_e)},function(Y){N("throw",Y,G,_e)}):R.resolve(Z).then(function(Y){Be.value=Y,G(Be)},function(Y){return N("throw",Y,G,_e)})}_e(Se.arg)}var D;o(this,"_invoke",{value:function(z,V){function G(){return new R(function(_e,Se){N(z,V,_e,Se)})}return D=D?D.then(G,G):G()}})}function L(A,R,N){var D=h;return function(z,V){if(D===m)throw Error("Generator is already running");if(D===v){if(z==="throw")throw V;return{value:e,done:!0}}for(N.method=z,N.arg=V;;){var G=N.delegate;if(G){var _e=U(G,N);if(_e){if(_e===x)continue;return _e}}if(N.method==="next")N.sent=N._sent=N.arg;else if(N.method==="throw"){if(D===h)throw D=v,N.arg;N.dispatchException(N.arg)}else N.method==="return"&&N.abrupt("return",N.arg);D=m;var Se=d(A,R,N);if(Se.type==="normal"){if(D=N.done?v:p,Se.arg===x)continue;return{value:Se.arg,done:N.done}}Se.type==="throw"&&(D=v,N.method="throw",N.arg=Se.arg)}}}function U(A,R){var N=R.method,D=A.iterator[N];if(D===e)return R.delegate=null,N==="throw"&&A.iterator.return&&(R.method="return",R.arg=e,U(A,R),R.method==="throw")||N!=="return"&&(R.method="throw",R.arg=new TypeError("The iterator does not provide a '"+N+"' method")),x;var z=d(D,A.iterator,R.arg);if(z.type==="throw")return R.method="throw",R.arg=z.arg,R.delegate=null,x;var V=z.arg;return V?V.done?(R[A.resultName]=V.value,R.next=A.nextLoc,R.method!=="return"&&(R.method="next",R.arg=e),R.delegate=null,x):V:(R.method="throw",R.arg=new TypeError("iterator result is not an object"),R.delegate=null,x)}function $(A){var R={tryLoc:A[0]};1 in A&&(R.catchLoc=A[1]),2 in A&&(R.finallyLoc=A[2],R.afterLoc=A[3]),this.tryEntries.push(R)}function K(A){var R=A.completion||{};R.type="normal",delete R.arg,A.completion=R}function W(A){this.tryEntries=[{tryLoc:"root"}],A.forEach($,this),this.reset(!0)}function B(A){if(A||A===""){var R=A[s];if(R)return R.call(A);if(typeof A.next=="function")return A;if(!isNaN(A.length)){var N=-1,D=function z(){for(;++N<A.length;)if(r.call(A,N))return z.value=A[N],z.done=!1,z;return z.value=e,z.done=!0,z};return D.next=D}}throw new TypeError(typeof A+" is not iterable")}return w.prototype=S,o(O,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,l,"GeneratorFunction"),t.isGeneratorFunction=function(A){var R=typeof A=="function"&&A.constructor;return!!R&&(R===w||(R.displayName||R.name)==="GeneratorFunction")},t.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,S):(A.__proto__=S,c(A,l,"GeneratorFunction")),A.prototype=Object.create(O),A},t.awrap=function(A){return{__await:A}},M(I.prototype),c(I.prototype,a,function(){return this}),t.AsyncIterator=I,t.async=function(A,R,N,D,z){z===void 0&&(z=Promise);var V=new I(u(A,R,N,D),z);return t.isGeneratorFunction(R)?V:V.next().then(function(G){return G.done?G.value:V.next()})},M(O),c(O,l,"Generator"),c(O,s,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),t.keys=function(A){var R=Object(A),N=[];for(var D in R)N.push(D);return N.reverse(),function z(){for(;N.length;){var V=N.pop();if(V in R)return z.value=V,z.done=!1,z}return z.done=!0,z}},t.values=B,W.prototype={constructor:W,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(K),!A)for(var R in this)R.charAt(0)==="t"&&r.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=e)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if(A.type==="throw")throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var R=this;function N(Se,Be){return V.type="throw",V.arg=A,R.next=Se,Be&&(R.method="next",R.arg=e),!!Be}for(var D=this.tryEntries.length-1;D>=0;--D){var z=this.tryEntries[D],V=z.completion;if(z.tryLoc==="root")return N("end");if(z.tryLoc<=this.prev){var G=r.call(z,"catchLoc"),_e=r.call(z,"finallyLoc");if(G&&_e){if(this.prev<z.catchLoc)return N(z.catchLoc,!0);if(this.prev<z.finallyLoc)return N(z.finallyLoc)}else if(G){if(this.prev<z.catchLoc)return N(z.catchLoc,!0)}else{if(!_e)throw Error("try statement without catch or finally");if(this.prev<z.finallyLoc)return N(z.finallyLoc)}}}},abrupt:function(A,R){for(var N=this.tryEntries.length-1;N>=0;--N){var D=this.tryEntries[N];if(D.tryLoc<=this.prev&&r.call(D,"finallyLoc")&&this.prev<D.finallyLoc){var z=D;break}}z&&(A==="break"||A==="continue")&&z.tryLoc<=R&&R<=z.finallyLoc&&(z=null);var V=z?z.completion:{};return V.type=A,V.arg=R,z?(this.method="next",this.next=z.finallyLoc,x):this.complete(V)},complete:function(A,R){if(A.type==="throw")throw A.arg;return A.type==="break"||A.type==="continue"?this.next=A.arg:A.type==="return"?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):A.type==="normal"&&R&&(this.next=R),x},finish:function(A){for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R];if(N.finallyLoc===A)return this.complete(N.completion,N.afterLoc),K(N),x}},catch:function(A){for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R];if(N.tryLoc===A){var D=N.completion;if(D.type==="throw"){var z=D.arg;K(N)}return z}}throw Error("illegal catch attempt")},delegateYield:function(A,R,N){return this.delegate={iterator:B(A),resultName:R,nextLoc:N},this.method==="next"&&(this.arg=e),x}},t}function FC(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(r,o)}function zC(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){FC(i,r,o,s,a,"next",l)}function a(l){FC(i,r,o,s,a,"throw",l)}s(void 0)})}}var Ki=y.lazy(function(){return y.union([y.string(),y.number(),y.boolean(),y.null(),y.array(Ki),y.record(Ki)])}),bj=function(t){return y.object({op:y.literal("file"),path:t,filePath:y.string(),value:y.string(),remote:y.boolean(),nestedFilePath:y.array(y.string()).optional(),metadata:Ki.optional()})},NU=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.string(),value:Ki}).strict(),y.object({op:y.literal("remove"),path:y.string()}).strict(),y.object({op:y.literal("replace"),path:y.string(),value:Ki}).strict(),y.object({op:y.literal("move"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("copy"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("test"),path:y.string(),value:Ki}).strict(),bj(y.string()).strict()]);y.array(NU);var TU=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.array(y.string()),value:Ki}).strict(),y.object({op:y.literal("remove"),path:y.array(y.string()).nonempty()}).strict(),y.object({op:y.literal("replace"),path:y.array(y.string()),value:Ki}).strict(),y.object({op:y.literal("move"),from:y.array(y.string()).nonempty(),path:y.array(y.string())}).strict(),y.object({op:y.literal("copy"),from:y.array(y.string()),path:y.array(y.string())}).strict(),y.object({op:y.literal("test"),path:y.array(y.string()),value:Ki}).strict(),bj(y.array(y.string())).strict()]),wj=y.array(TU),Kt=y.string().refine(function(e){return!0}),OU=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Kt})]);y.object({patch:wj,parentRef:OU});var MU=y.string().transform(function(e){return e}),jU=y.object({type:y.literal("string"),options:y.object({maxLength:y.number().optional(),minLength:y.number().optional(),regexp:y.object({source:y.string(),flags:y.string()}).optional()}).optional(),opt:y.boolean(),raw:y.boolean()}),Sb=y.object({type:y.literal("literal"),value:y.string(),opt:y.boolean()}),RU=y.object({type:y.literal("boolean"),opt:y.boolean()}),IU=y.object({type:y.literal("number"),options:y.object({max:y.number().optional(),min:y.number().optional()}).optional(),opt:y.boolean()}),Sj=y.lazy(function(){return y.object({type:y.literal("object"),items:y.record(Uh),opt:y.boolean()})}),AU=y.lazy(function(){return y.object({type:y.literal("array"),item:Uh,opt:y.boolean()})}),DU=y.lazy(function(){return y.union([y.object({type:y.literal("union"),key:Sb,items:y.array(Sb),opt:y.boolean()}),y.object({type:y.literal("union"),key:y.string(),items:y.array(Sj),opt:y.boolean()})])}),LU=y.object({ext:y.union([y.tuple([y.literal("jpg")]),y.tuple([y.literal("webp")])]).optional(),directory:y.string().optional(),prefix:y.string().optional(),accept:y.string().optional()}),kj=y.object({type:y.literal("image"),options:LU.optional(),opt:y.boolean()}),FU=y.object({style:y.object({bold:y.boolean().optional(),italic:y.boolean().optional(),lineThrough:y.boolean().optional()}).optional(),block:y.object({h1:y.boolean().optional(),h2:y.boolean().optional(),h3:y.boolean().optional(),h4:y.boolean().optional(),h5:y.boolean().optional(),h6:y.boolean().optional(),ul:y.boolean().optional(),ol:y.boolean().optional()}).optional(),inline:y.object({a:y.boolean().optional(),img:y.union([y.boolean(),kj]).optional()}).optional()}),zU=y.object({type:y.literal("richtext"),options:FU.optional(),opt:y.boolean()}),$U=y.lazy(function(){return y.object({type:y.literal("record"),item:Uh,opt:y.boolean()})}),BU=y.lazy(function(){return y.object({type:y.literal("keyOf"),path:MU,schema:Uh,values:y.union([y.literal("string"),y.array(y.string())]),opt:y.boolean()})}),VU=y.object({accept:y.string().optional()}),UU=y.object({type:y.literal("file"),options:VU.optional(),opt:y.boolean()}),HU=y.object({type:y.literal("date"),opt:y.boolean()}),Uh=y.union([jU,Sb,RU,IU,Sj,AU,DU,zU,$U,BU,UU,HU,kj]),Z1=y.object({commitSha:y.string(),clientCommitSha:y.string(),parentCommitSha:y.string(),branch:y.string(),creator:y.string(),createdAt:y.string(),commitMessage:y.string().nullable()}),qa=y.string().refine(function(e){return!0}),Cx=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Kt})]),$C=y.object({project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.string()}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional()}),WU=y.union([y.literal("image:change-extension"),y.literal("image:add-metadata"),y.literal("image:check-metadata"),y.literal("image:check-remote"),y.literal("image:upload-remote"),y.literal("image:download-remote"),y.literal("file:change-extension"),y.literal("file:add-metadata"),y.literal("file:check-metadata"),y.literal("file:check-remote"),y.literal("file:upload-remote"),y.literal("file:download-remote"),y.literal("keyof:check-keys")]),KU=y.object({message:y.string(),value:y.unknown().optional(),fatal:y.boolean().optional(),fixes:y.array(WU).optional()}),Ci=y.object({status:y.literal(401),json:y.object({message:y.string()})}),GU=y.object({status:y.literal(404),json:y.object({message:y.string()})}),Tt=y.object({message:y.string()}),BC=y.union([y.object({patchId:Kt,message:y.string()}),y.object({parentPatchId:y.string(),message:y.string()})]),_x=y.object({message:y.string(),path:qa.optional()});y.union([y.literal("val_session"),y.literal("val_enable"),y.literal("val_state")]);var $p=y.object({value:y.literal("true"),options:y.object({httpOnly:y.literal(!1),sameSite:y.literal("lax")})}),qU={"/draft/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/stat":{GET:{req:{cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(200),json:y.object({draftMode:y.boolean()})})])}},"/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut({},md,$p),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut({},md,$p))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ut({},Ss,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut({},md,y.object({value:y.literal("false")})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/authorize":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut({},md,$p),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/callback":{GET:{req:{query:{code:y.string().optional(),state:y.string().optional()},cookies:ut({},tc,y.string())},res:y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut(ut({},tc,y.object({value:y.literal(null)})),md,$p.optional()),Ss,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})}},"/session":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({mode:y.union([y.literal("local"),y.literal("proxy")]),enabled:y.boolean()})}),y.object({status:y.union([y.literal(400),y.literal(401),y.literal(403),y.literal(404),y.literal(500),y.literal(501)]),json:y.object({message:y.string()})}),y.object({status:y.literal(401),json:y.object({message:y.string(),details:y.union([y.string(),y.object({reason:y.string()}),y.object({sub:y.string(),exp:y.number(),token:y.string(),org:y.string(),project:y.string()})])})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/logout":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(200),cookies:y.object(ut(ut({},Ss,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ut(ut({},Ss,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()),tc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})])}},"/remote/settings":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({publicProjectId:y.string(),coreVersion:y.string(),remoteFileBuckets:y.array(y.object({bucket:y.string()}))})}),y.object({status:y.literal(400),json:y.object({errorCode:y.union([y.literal("project-not-configured"),y.literal("error-could-not-get-settings"),y.literal("project-not-configured"),y.literal("pat-error"),y.literal("api-key-missing")]),message:y.string()})}),y.object({status:y.literal(401),json:y.object({errorCode:y.literal("unauthorized").optional(),message:y.string()})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/stat":{POST:{req:{body:y.object({sourcesSha:y.string(),schemaSha:y.string(),baseSha:y.string(),patches:y.array(y.string()).optional()}).nullable(),cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(500),json:Tt}),y.object({status:y.literal(503),json:Tt}),y.object({status:y.literal(200),json:y.union([y.object({type:y.union([y.literal("request-again"),y.literal("no-change"),y.literal("did-change")]),baseSha:y.string(),schemaSha:y.string(),sourcesSha:y.string(),patches:y.array(Kt),config:$C,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])}),y.object({type:y.literal("use-websocket"),url:y.string(),nonce:y.string(),baseSha:y.string(),schemaSha:y.string(),sourcesSha:y.string(),commitSha:y.string(),patches:y.array(Kt),commits:y.array(Z1),config:$C,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])})])})])}},"/upload/patches":{POST:{req:{path:y.string().optional(),body:y.object({parentRef:Cx,filePath:y.string(),data:y.any(),type:y.union([y.literal("file"),y.literal("image")]),metadata:y.any(),remote:y.boolean()})},res:y.union([y.object({status:y.literal(400),json:Tt}),y.object({status:y.literal(200),json:y.object({filePath:y.string(),patchId:Kt})})])}},"/direct-file-upload-settings":{POST:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(400),json:Tt}),y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(500),json:Tt}),y.object({status:y.literal(200),json:y.object({nonce:y.string().nullable(),baseUrl:y.string()})})])}},"/patches":{DELETE:{req:{query:{id:y.array(Kt)},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(500),json:y.object({message:y.string(),errors:y.array(BC)})}),y.object({status:y.literal(200),json:y.array(Kt)})])},PUT:{req:{body:y.object({parentRef:Cx,patches:y.array(y.object({path:qa,patchId:Kt,patch:y.any()}))}),cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(409),json:y.object({type:y.literal("patch-head-conflict"),message:y.string()})}),y.object({status:y.literal(400),json:y.object({type:y.literal("patch-error"),message:y.string(),errors:y.record(qa,y.array(y.object({error:Tt})))})}),y.object({status:y.literal(200),json:y.object({newPatchIds:y.array(Kt),parentRef:Cx})})])},GET:{req:{query:{patch_id:y.array(Kt).optional(),exclude_patch_ops:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(500),json:y.object({message:y.string(),patchErrors:y.array(BC)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),error:Tt})}),y.object({status:y.literal(200),json:y.object({patches:y.array(y.object({path:qa,patch:wj.optional(),patchId:Kt,createdAt:y.string(),authorId:y.string().nullable(),appliedAt:y.object({commitSha:y.string()}).nullable()})),baseSha:y.string(),error:Tt.optional(),errors:y.record(Kt,Tt).optional()})})])}},"/schema":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(_x)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Tt)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),schemas:y.record(qa,Uh)})})])}},"/sources/~":{PUT:{req:{path:y.string().optional(),query:{validate_sources:y.boolean().optional(),validate_binary_files:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(401),json:Tt}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.union([y.array(_x),Tt])})}),y.object({status:y.literal(409),json:y.object({message:y.string()})}),y.object({status:y.literal(400),json:y.object({message:y.string(),details:y.array(_x)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),sourcesSha:y.string(),modules:y.record(qa,y.object({preview:y.any(),source:y.any(),patches:y.object({applied:y.array(Kt),skipped:y.array(Kt).optional(),errors:y.record(Kt,Tt).optional()}).optional(),validationErrors:y.record(y.string(),y.array(KU)).optional()}))})})])}},"/profiles":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(200),json:y.object({profiles:y.array(y.object({profileId:y.string(),fullName:y.string(),email:y.string().optional(),avatar:y.object({url:y.string()}).nullable()}))})})])}},"/commit-summary":{GET:{req:{query:{patch_id:y.array(Kt)},cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(400),json:y.object({message:y.string()})}),y.object({status:y.literal(200),json:y.object({patchIds:y.array(Kt),baseSha:y.string(),commitSummary:y.string().nullable()})})])}},"/save":{POST:{req:{body:y.object({message:y.string().optional(),patchIds:y.array(Kt)}),cookies:{val_session:y.string().optional()}},res:y.union([Ci,y.object({status:y.literal(200),json:y.object({})}),y.object({status:y.literal(409),json:y.object({message:y.string(),isNotFastForward:y.literal(!0)})}),y.object({status:y.literal(400),json:y.union([y.object({message:y.string(),details:y.union([y.object({sourceFilePatchErrors:y.record(qa,y.array(Tt)),binaryFilePatchErrors:y.record(Tt)}),y.array(Tt)]).optional()}),y.object({message:y.string(),errorCode:y.union([y.literal("project-not-configured"),y.literal("pat-error")])})])})])}},"/files":{GET:{req:{path:y.string(),query:{patch_id:Kt.optional(),remote:y.string().optional()}},res:y.union([Ci,GU,y.object({status:y.literal(200),body:y.instanceof(ReadableStream)})])}}},Ej=function(t,n){var r=qU;return function(){var o=zC(Td().mark(function i(s,a,l){var c,u,d,h,p,m,v,x,b,w,S,C,_,P,O,M,I,L;return Td().wrap(function($){for(;;)switch($.prev=$.next){case 0:if(d=l,h=s,d!=null&&d.path&&d.path.length>0&&(h+=d.path),d.query){for(p=[],m=0,v=Object.keys(d.query);m<v.length;m++)if(b=v[m],Array.isArray((x=d.query)===null||x===void 0?void 0:x[b])){S=X1(((w=d.query)===null||w===void 0?void 0:w[b])||[]);try{for(S.s();!(C=S.n()).done;)_=C.value,_!==void 0&&p.push([b,_.toString()])}catch(K){S.e(K)}finally{S.f()}}else((P=d.query)===null||P===void 0?void 0:P[b])!==void 0&&p.push([b,d==null||(O=d.query)===null||O===void 0?void 0:O[b].toString()]);d!=null&&d.query&&p.length>0&&(h+="?".concat(new URLSearchParams(p).toString()))}if(M=r==null||(c=r[s])===null||c===void 0?void 0:c[a],M){$.next=7;break}return $.abrupt("return",{status:null,json:{message:"Invalid route ".concat(s," with method ").concat(a,". This is most likely a Val bug."),type:"client_side_validation_error",details:{validationError:"Route ".concat(s," with method ").concat(a," not found."),data:{routes:Object.keys(r||{}),methods:Object.keys((r==null?void 0:r[s])||{}),route:s,method:a}}}});case 7:if(I=(u=M.req.body)===null||u===void 0?void 0:u.safeParse(d.body),!(I&&!I.success)){$.next=11;break}return console.error("Got an invalid request body while validating client-side. This is most likely a Val bug.",{path:s,method:a,body:d.body,error:I.error}),$.abrupt("return",{status:null,json:{message:"There was an issue validating your data. This is most likely a Val bug.",type:"client_side_validation_error",details:{validationError:AC(I.error).toString(),data:d.body}}});case 11:return $.prev=11,$.next=14,fetch("".concat(t).concat(h),{method:a,headers:{"Content-Type":"application/json"},body:d.body!==void 0?JSON.stringify(d.body):void 0}).then(function(){var K=zC(Td().mark(function W(B){var A,R,N,D,z;return Td().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(R=B.headers.get("content-type"),B.status!==413){G.next=3;break}return G.abrupt("return",{status:413,json:{message:"Request too large.",method:a,path:s}});case 3:if(R!=null&&R.includes("application/json")){G.next=5;break}return G.abrupt("return",{status:null,json:{type:"client_side_validation_error",message:"Invalid response (expected JSON, but got something else). This could be a result of mismatched Val versions or a transient error. ".concat(B.status),details:{validationError:"Invalid content type",data:{status:B.status,contentType:R}}}});case 5:return G.next=7,B.json();case 7:if(N=G.sent,D={status:B.status,json:N},B.status!==500){G.next=12;break}return console.error("Server responded with an error",N),G.abrupt("return",{status:500,json:Ai({type:"unknown",message:N.message},N)});case 12:if(z=(A=M.res)===null||A===void 0?void 0:A.safeParse(D),!(z&&!z.success)){G.next=15;break}return G.abrupt("return",{status:null,json:{message:"Response could not be validated. This could also be a result of mismatched Val versions.",type:"client_side_validation_error",details:{validationError:AC(z.error).toString(),data:D}}});case 15:return G.abrupt("return",{status:B.status,json:N});case 16:case"end":return G.stop()}},W)}));return function(W){return K.apply(this,arguments)}}());case 14:return L=$.sent,$.abrupt("return",L);case 18:return $.prev=18,$.t0=$.catch(11),$.abrupt("return",{status:null,json:{message:"Failed to fetch data",type:"network_error",retryable:YU($.t0),details:$.t0 instanceof Error?$.t0.message:JSON.stringify($.t0)}});case 21:case"end":return $.stop()}},i,null,[[11,18]])}));return function(i,s,a){return o.apply(this,arguments)}}()};function YU(e){if(e instanceof TypeError)return!0;if(e instanceof Error&&"code"in e){var t=e.code,n=["ECONNRESET","ETIMEDOUT","ENOTFOUND","EAI_AGAIN"];return n.includes(t)}return!1}function JU(e){if(Array.isArray(e))return e}function XU(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function ZU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
51
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QU(e,t){return JU(e)||XU(e,t)||J1(e,t)||ZU()}var nh=function(){var t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1];if(n){var r=Object.entries(n).flatMap(function(i){var s=QU(i,2),a=s[0],l=s[1];return l?[[a,l.toString()]]:[]}),o=new URLSearchParams(r);return"".concat(t+"?"+o.toString())}return"".concat(t)},VC="val-config",e9="val-config-received",t9=y.object({contentHostUrl:y.string().optional(),appHostUrl:y.string().optional(),project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.literal("/public/val")}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional(),defaultTheme:y.enum(["dark","light"]).optional(),ai:y.object({commitMessages:y.object({disabled:y.boolean().optional()}).optional()}).optional()}),Cj=y.object({deploymentId:y.string(),deploymentState:y.string(),commitSha:y.string(),updatedAt:y.string(),createdAt:y.string()});const _j=y.string().uuid().refine(e=>!0),n9=y.union([y.object({type:y.literal("patches"),patches:y.array(_j)}),y.object({type:y.literal("deployment"),deployment:Cj}),y.object({type:y.literal("commit"),commit:Z1}),y.object({type:y.literal("subscribed")}),y.object({type:y.literal("error"),message:y.string(),reconnect:y.boolean().optional()})]);y.object({type:y.union([y.literal("did-change"),y.literal("no-change"),y.literal("request-again"),y.literal("use-websocket")]),profileId:y.string().nullable(),config:y.object({project:y.string().optional(),files:y.object({directory:y.string()}).optional()}),commitSha:y.string().optional(),sourcesSha:y.string(),schemaSha:y.string(),baseSha:y.string(),patches:y.array(_j),commits:y.array(Z1).optional(),deployments:y.array(Cj).optional(),mode:y.union([y.literal("fs"),y.literal("http")])});function r9(e){const[t,n]=g.useState({status:"not-asked"}),r=g.useRef(null),{authenticationState:o,setAuthenticationLoadingIfNotAuthenticated:i,setIsAuthenticated:s}=o9(),[a,l]=g.useState(),c=g.useRef(0);return g.useEffect(()=>{if(t.status==="updated-request-again"||t.status==="error"||t.status==="ws-message-received")if(t.wait===0)console.debug("Executing stat immediately",t.status,t.status==="error"?t.error:"no error","Now:",Date.now()),Px(e,r,c,t,n,i,s,l);else{console.debug("Executing stat in ",t.wait," status: ",t.status,"Now:",Date.now());const u=setTimeout(()=>{Px(e,r,c,t,n,i,s,l)},t.wait);return()=>clearTimeout(u)}},[e,t]),g.useEffect(()=>{t.status==="not-asked"&&(n({status:"initializing"}),console.debug("Initializing stat"),Px(e,r,c,t,n,i,s,l))},[e,t.status]),[t,n,o,i,s,a]}const gd=10*1e3;async function Px(e,t,n,r,o,i,s,a){const l=++n.current;let c=null;return"data"in r&&r.data&&(c={schemaSha:r.data.schemaSha,sourcesSha:r.data.sourcesSha,baseSha:r.data.baseSha,patches:r.data.patches}),i(),e("/stat","POST",{body:c}).then(u=>{if(u.status===401){s("login-required");return}else s("authorized");if(u.status===503){a(!0),o(d=>({status:"error",error:"Service unavailable",retries:("retries"in d?d.retries:0)+1,waitStart:Date.now(),wait:5e3}));return}if(a(!1),!(n.current!==0&&n.current!==l))if(u.status===200){if(u.json.type==="did-change"||u.json.type==="no-change"||u.json.type==="request-again")o({status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:t.current?gd:0});else if(u.json.type==="use-websocket"){o(m=>({...m,status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:gd})),t.current&&(console.debug("Closing existing WebSocket"),t.current.close());const d=u.json.url;console.debug("Connecting to WebSocket",d),t.current=new WebSocket(d);const h=u.json.nonce;t.current.onopen=()=>{var m;(m=t.current)==null||m.send(JSON.stringify({nonce:h,type:"subscribe"}))},t.current.onmessage=m=>{try{const v=n9.safeParse(JSON.parse(m.data));if(!v.success){console.error("Could not parse WebSocket message",v.error);return}const x=v.data;x.type==="error"?o(b=>vd(b,x.message)):x.type==="patches"?o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,patches:x.patches},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):gd}:b):x.type==="subscribed"?console.debug("Subscribed!"):x.type==="commit"?(console.debug("Commit",x.commit),o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,commits:(b.data.commits||[]).concat(x.commit)},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):gd}:b)):x.type==="deployment"?(console.debug("Deployment",x.deployment),o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,deployments:(b.data.deployments||[]).concat({commitSha:x.deployment.commitSha,deploymentId:x.deployment.deploymentId,deploymentState:x.deployment.deploymentState,createdAt:x.deployment.createdAt,updatedAt:x.deployment.updatedAt})},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):gd}:b)):console.warn("Unknown WebSocket message",x)}catch(v){console.error("Could not parse WebSocket message",v)}};const p=t.current;t.current.onclose=()=>{p===t.current&&(console.debug("WebSocket closed"),o(m=>vd(m,"WebSocket closed")))},t.current.onerror=()=>{console.warn("WebSocket error"),o(m=>vd(m,"Got an error while syncing with Val (reason: WebSocket error)"))}}}else o(d=>vd(d,u.json.message))}).catch(u=>{n.current!==0&&n.current!==l||o(d=>vd(d,u.message))})}function vd(e,t){const n="retries"in e?e.retries+1:0,r=e.status==="error"&&e.retries>1?Math.min(500,e.retries*50+Math.floor(Math.random()*100))*10:0;return{status:"error",error:t,data:"data"in e?e.data:void 0,retries:n,waitStart:"waitStart"in e?e.waitStart:Date.now(),wait:r}}function o9(){const[e,t]=g.useState("not-asked"),n=g.useCallback(()=>{e==="not-asked"&&t("loading")},[e]);return{authenticationState:e,setIsAuthenticated:t,setAuthenticationLoadingIfNotAuthenticated:n}}function Od(e){var t,n,r,o,i;if(e.type==="file")return!!e.remote;if(e.type==="image")return!!e.remote;if(e.type==="richtext")return!!(typeof((n=(t=e.options)==null?void 0:t.inline)==null?void 0:n.img)!="boolean"&&((i=(o=(r=e.options)==null?void 0:r.inline)==null?void 0:o.img)!=null&&i.remote));if(e.type==="array")return Od(e.item);if(e.type==="record")return Od(e.item);if(e.type==="union"){for(const s of e.items)if(Od(s))return!0;return!1}else if(e.type==="object"){for(const s in e.items)if(Od(e.items[s]))return!0;return!1}else{if(e.type==="boolean"||e.type==="number"||e.type==="string"||e.type==="date"||e.type==="keyOf"||e.type==="literal")return!1;{const s=e;return console.error(`Val: requiresRemoteFiles: unexpected schema type ${typeof s=="object"&&"type"in s&&s.type}`,e),null}}}function fn(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,s=r;i<s.length;i++){var a=s[i];t=a(t)}return t}function Pj(e){return M1(e)}function du(e,t){if(e===t)return!0;if(ae(e)==="object"&&ae(t)==="object"&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!du(e[n],t[n]))return!1;return!0}else if(!Array.isArray(e)&&!Array.isArray(t)){var r=Object.entries(e);if(r.length!==Object.keys(t).length)return!1;for(var o=0,i=r;o<i.length;o++){var s=Un(i[o],2),a=s[0],l=s[1],c=t[a];if(c===void 0||!du(l,c))return!1}return!0}}return!1}function ti(e){return Array.isArray(e)?e.map(ti):ae(e)==="object"&&e!==null?Object.fromEntries(Object.entries(e).map(function(t){var n=Un(t,2),r=n[0],o=n[1];return[r,ti(o)]})):e}function Q1(e){return/^(0|[1-9][0-9]*)$/g.test(e)?En(Number(e)):Vn(new Fr('Invalid array index "'.concat(e,'"')))}function i9(e,t){return e==="-"?En(t.length):fn(Q1(e),jv(function(n){return n<=t.length},function(){return new Fr("Array index out of bounds")}))}function Nj(e,t){return fn(Q1(e),jv(function(n){return n<t.length},function(){return new Fr("Array index out of bounds")}))}function s9(e,t,n){if(Array.isArray(e))return fn(Nj(t,e),to(function(o){var i=e[o];return e[o]=n,i}));if(ae(e)==="object"&&e!==null)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];return e[t]=n,En(r)}else return Vn(new Fr("Cannot replace object element which does not exist"));return Vn(new Fr("Cannot replace in non-object/array"))}function a9(e,t,n){return Pj(t)?fn(eS(e,t),Cl(function(r){var o=Un(r,2),i=o[0],s=o[1];return s9(i,s,n)}),to(function(r){return[e,r]})):En([n,e])}function Tj(e,t){return Array.isArray(e)?fn(Q1(t),Cl(function(n){return n>=e.length?Vn(new Fr("Array index out of bounds")):En(e[n])})):ae(e)==="object"&&e!==null?Object.prototype.hasOwnProperty.call(e,t)?En(e[t]):En(void 0):Vn(new Fr("Cannot access non-object/array"))}function eS(e,t){for(var n=e,r=t[0],o=0;o<t.length-1;++o,r=t[o]){var i=Tj(n,r);if(Mv(i))return i;if(i.value===void 0)return Vn(new Fr("Path refers to non-existing object/array"));n=i.value}return En([n,r])}function Nx(e,t){return fn(t,j1(function(n,r){return fn(Tj(n,r),jv(function(o){return o!==void 0},function(){return new Fr("Path refers to non-existing object/array")}))},e))}function l9(e,t){if(Array.isArray(e))return fn(Nj(t,e),to(function(r){var o=e.splice(r,1),i=Un(o,1),s=i[0];return s}));if(ae(e)==="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];return delete e[t],En(n)}return Vn(new Fr("Cannot remove from non-object/array"))}function UC(e,t){return fn(eS(e,t),Cl(function(n){var r=Un(n,2),o=r[0],i=r[1];return l9(o,i)}))}function c9(e,t,n){if(Array.isArray(e))return fn(i9(t,e),to(function(o){e.splice(o,0,n)}));if(ae(e)==="object"&&e!==null){var r;return Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t]),e[t]=n,En(r)}return Vn(new Fr("Cannot add to non-object/array"))}function Tx(e,t,n){return Pj(t)?fn(eS(e,t),Cl(function(r){var o=Un(r,2),i=o[0],s=o[1];return c9(i,s,n)}),to(function(r){return[e,r]})):En([n,e])}function Bp(e){var t=Un(e,1),n=t[0];return n}var u9=function(){function e(){Nn(this,e)}return Tn(e,[{key:"get",value:function(n,r){return Nx(n,r)}},{key:"add",value:function(n,r,o){return fn(Tx(n,r,o),to(Bp))}},{key:"remove",value:function(n,r){return fn(UC(n,r),to(function(){return n}))}},{key:"replace",value:function(n,r,o){return fn(a9(n,r,o),to(Bp))}},{key:"move",value:function(n,r,o){return fn(UC(n,r),Cl(function(i){return Tx(n,o,i)}),to(Bp))}},{key:"copy",value:function(n,r,o){return fn(Nx(n,r),Cl(function(i){return Tx(n,o,ti(i))}),to(Bp))}},{key:"test",value:function(n,r,o){return fn(Nx(n,r),to(function(i){return du(o,i)}))}}])}();function d9(e,t,n){switch(n.op){case"add":return t.add(e,n.path,n.value);case"remove":return t.remove(e,n.path);case"replace":return t.replace(e,n.path,n.value);case"move":return t.move(e,n.from,n.path);case"copy":return t.copy(e,n.from,n.path);case"test":return t.test(e,n.path,n.value)?En(e):Vn(new Fr("Test failed"));case"file":return Vn(new Fr("Cannot apply a file patch here"))}}function f9(e,t,n){return fn(n,j1(function(r,o){return d9(r,t,o)},e))}function h9(e,t){return!e||!t?!1:e.length===1&&e[0].op==="replace"&&t.length===1&&t[0].op==="replace"?e[0].path.join("/")===t[0].path.join("/"):!1}function fc(e,t){if(!t||t.length===0)return new Set([e.type]);const n=new Set;let r=e,o=-1;for(const i of t){if(o++,!r)break;if(r.type==="array")r=r.item;else if(r.type==="record")r=r.item;else if(r.type==="object")r=r.items[i];else if(r.type==="union")if(typeof r.key=="string"){const s=r.items;for(const a of s){const l=fc(a,t.slice(o));for(const c of Array.from(l.values()))n.add(c)}return n}else{if(o!==t.length-1)throw new Error("Found string union (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else if(r.type==="boolean"||r.type==="number"||r.type==="string"||r.type==="date"||r.type==="file"||r.type==="image"||r.type==="keyOf"||r.type==="literal"||r.type==="richtext"){if((r.type==="image"||r.type==="file")&&t[o]==="metadata")break;if(o!==t.length-1)throw new Error("Found "+r.type+" (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else{const a=r.type;return console.error(`Unexecpted resolved schema type: ${a} in ${t.join("/")} at ${i}`),new Set([a])}}return r&&(n.add(r.type),r.type==="union"&&(typeof r.key=="string"?n.add("object"):n.add("string"))),n}class yd{constructor(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}reset(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}getInsertedPatches(){return this.insertedPatches}insertPath(t,n,r,o,i,s,a,l){let c=n.length>0?`${t}?${n.join("/")}`:t;const u=[];for(let d=this.orderedInsertKeys.length-1;d>=0;d--){const h=this.orderedInsertKeys[d];c!==h?c.startsWith(h)?(c=h,this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c)):h.startsWith(c)&&u.push(d):(this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c))}for(const d of u){const h=this.orderedInsertKeys[d];this.orderedInsertKeys.splice(d,1);const p=this.patchSetMetadata[h];if(this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:Array.from(a),lastUpdated:o,lastUpdatedBy:i}),p)for(const m of p.patches.slice())this.patchSetMetadata[c].patches.unshift(m),m.author!==null&&this.patchSetMetadata[c].authors.unshift(m.author),this.patchSetMetadata[c].opTypes.unshift(m.opType);else throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${h}`);h!==c&&delete this.patchSetMetadata[h]}this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:a,lastUpdated:o,lastUpdatedBy:i}),i!==null&&!this.patchSetMetadata[c].authors.includes(i)&&this.patchSetMetadata[c].authors.unshift(i),this.patchSetMetadata[c].lastUpdatedBy=i,this.patchSetMetadata[c].lastUpdated=o,this.patchSetMetadata[c].opTypes.includes(s)||this.patchSetMetadata[c].opTypes.unshift(s),this.patchSetMetadata[c].patches.unshift({patchPath:l,patchId:r,author:i,createdAt:o,opType:s,schemaTypes:a}),this.orderedInsertKeys.includes(c)||this.orderedInsertKeys.unshift(c)}insert(t,n,r,o,i,s){if(!this.insertedPatches.has(o)){if(!n){this.insertPath(t,[],o,i,s,r.op,[],r.path);return}if(this.insertedPatches.add(o),!(r.op==="file"||r.op==="test"))try{if(r.op==="replace"){const a=fc(n,r.path);this.insertPath(t,r.path,o,i,s,r.op,Array.from(a),r.path)}else if(r.op==="add"||r.op==="remove"||r.op==="move"||r.op==="copy"){const a=r.path.slice(0,-1),l=fc(n,a);if(l.size===1&&l.has("array")){if(this.insertPath(t,a,o,i,s,r.op,Array.from(l),r.path),r.op==="move"){const c=r.from.slice(0,-1),u=fc(n,c);this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path)}}else if(l.size===1&&l.has("record")){const c=r.path,u=fc(n,c);if(this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path),r.op==="move"){const d=r.from,h=fc(n,d);this.insertPath(t,d,o,i,s,r.op,Array.from(h),r.path)}}else{if(l.size===1&&!(l.has("image")||l.has("file")))throw new Error(`Cannot perform op: '${r.op}' on non-array or non-record schema. Type: ${l.values().next().value}`);this.insertPath(t,a,o,i,s,r.op,[n.type],r.path)}}else{const a=r;throw new Error("Unreachable op: "+a)}}catch(a){a instanceof Error?console.error("Could not resolve path while creating patch set",a.message):console.error("Could not resolve path while creating patch set",a),this.insertPath(t,[],o,i,s,r.op,[n.type],r.path)}}}isInserted(t){return this.insertedPatches.has(t)}serialize(){return this.orderedInsertKeys.map(t=>{if(t in this.patchSetMetadata)return this.patchSetMetadata[t];throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${t}`)})}}class p9{constructor(t,n=void 0){this.client=t,this.overlayEmitter=n,this.autoPublish=!1,this.isSyncing=!1,this.MIN_WAIT_SECONDS=1,this.MAX_WAIT_SECONDS=5,this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.baseSha=null,this.sourcesSha=null,this.mode=null,this.optimisticClientSources={},this.serverSources=null,this.previews=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new yd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedPreviewSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0}setAutoPublish(t,n){this.autoPublish=n;try{localStorage.setItem("val-auto-publish",n.toString())}catch{}return this.invalidateAutoPublish(),this.sync(t)}loadAutoPublish(){try{this.autoPublish=localStorage.getItem("val-auto-publish")==="true",this.invalidateAutoPublish()}catch{}}async init(t,n,r,o,i,s,a,l){this.mode=t,this.baseSha=n,this.commitSha=a,this.sourcesSha=o,this.authorId=s;const c=Date.now();t==="fs"?this.loadAutoPublish():this.autoPublish=!1;const u=await this.syncWithUpdatedStat(t,n,r,o,i,s,a,l);return u.status==="done"&&(await this.syncPatches(!0,l),this.publishDisabled=!1,this.invalidatePublishDisabled(),this.initializedAt=l+(Date.now()-c),this.invalidateInitializedAt()),u}reset(){console.debug("Resetting ValSyncEngine"),this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.sourcesSha=null,this.optimisticClientSources={},this.serverSources=null,this.previews=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new yd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedPreviewSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0,this.invalidateInitializedAt()}subscribe(t,n){const r=n||Dn;return o=>{const i=this.listeners;i[t]||(i[t]={}),i[t][r]||(i[t][r]=[]);const s=i[t][r].push(o)-1;return()=>{var a;(a=i[t])==null||a[r].splice(s,1)}}}emit(t){if(t)for(const n of t)n()}setCommitSha(t){this.commitSha=t}invalidateInitializedAt(){var t;this.cachedInitializedAtSnapshot=null,this.emit((t=this.listeners["initialized-at"])==null?void 0:t[Dn])}invalidateSource(t){var n;this.cachedSourceSnapshots!==null&&(this.cachedSourceSnapshots={...this.cachedSourceSnapshots,[t]:void 0}),this.cachedAllSourcesSnapshot=null,this.emit((n=this.listeners.source)==null?void 0:n[t])}invalidatePreview(t){var n;this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedPreviewSnapshots={...this.cachedPreviewSnapshots,[t]:null},this.emit((n=this.listeners.preview)==null?void 0:n[t])}invalidateSyncStatus(t){var n;this.cachedSyncStatus={...this.cachedSyncStatus,[t]:void 0},this.emit((n=this.listeners["sync-status"])==null?void 0:n[t])}invalidateValidationError(t){var n;this.emit((n=this.listeners["validation-error"])==null?void 0:n[t])}invalidateAllValidationErrors(){var t;this.cachedValidationErrors=null,this.emit((t=this.listeners["all-validation-errors"])==null?void 0:t[Dn])}invalidateGlobalTransientErrors(){var t;this.cachedGlobalTransientErrorSnapshot=null,this.emit((t=this.listeners["global-transient-errors"])==null?void 0:t[Dn])}invalidateNetworkError(){var t;this.cachedNetworkErrorSnapshot=void 0,this.emit((t=this.listeners["network-error"])==null?void 0:t[Dn])}invalidatePatchSets(){var t;this.cachedSerializedPatchSetsSnapshot=null,this.emit((t=this.listeners["patch-sets"])==null?void 0:t[Dn])}invalidatePendingOps(){var t;this.cachedPendingOpsCountSnapshot=null,this.emit((t=this.listeners["pending-ops-count"])==null?void 0:t[Dn])}invalidateAllPatches(){var t;this.cachedPatchData=null,this.emit((t=this.listeners["all-patches"])==null?void 0:t[Dn])}invalidateSchema(){var t,n;this.cachedAllSchemasSnapshot=null,this.cachedSchemaSnapshots=null,this.cachedAllSourcesSnapshot=null,this.emit((t=this.listeners.schema)==null?void 0:t[Dn]),this.invalidateAllValidationErrors();for(const r in((n=this.listeners)==null?void 0:n["validation-error"])||{}){const o=r;this.invalidateValidationError(o)}}invalidateParentRef(){var t;this.cachedParentRef=void 0,this.emit((t=this.listeners["parent-ref"])==null?void 0:t[Dn])}invalidateGlobalServerSidePatchIds(){var t;this.cachedGlobalServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["global-server-side-patch-ids"])==null?void 0:t[Dn])}invalidatePendingClientSidePatchIds(){var t;this.cachedPendingClientSidePatchIdsSnapshot=null,this.emit((t=this.listeners["pending-client-side-patch-ids"])==null?void 0:t[Dn])}invalidateSyncedServerSidePatchIds(){var t;this.cachedSyncedServerSidePatchIdsSnapshot=null,this.emit((t=this.listeners["synced-server-side-patch-ids"])==null?void 0:t[Dn])}invalidateSavedServerSidePatchIds(){var t;this.cachedSavedServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["saved-server-side-patch-ids"])==null?void 0:t[Dn])}invalidatePublishDisabled(){var t;this.cachedPublishDisabledSnapshot=null,this.emit((t=this.listeners["publish-disabled"])==null?void 0:t[Dn])}invalidateAutoPublish(){var t;this.cachedAutoPublishSnapshot=null,this.emit((t=this.listeners["auto-publish"])==null?void 0:t[Dn])}getSchemaSnapshot(t){if(this.cachedSchemaSnapshots===null&&(this.cachedSchemaSnapshots={}),this.cachedSchemaSnapshots[t]===void 0)if(!this.schemas)this.cachedSchemaSnapshots[t]={status:"no-schemas"};else{const n=this.schemas[t];n?this.cachedSchemaSnapshots[t]={status:"success",data:ti(n)}:this.cachedSchemaSnapshots[t]={status:"module-schema-not-found"}}return this.cachedSchemaSnapshots[t]}getPreviewSnapshot(t){var n;return this.cachedPreviewSnapshots===null&&(this.cachedPreviewSnapshots={}),this.cachedPreviewSnapshots[t]===null&&(this.cachedPreviewSnapshots[t]=((n=this.previews)==null?void 0:n[t])||null),this.cachedPreviewSnapshots[t]}getSourceSnapshot(t){var n;if(this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedSourceSnapshots[t]===void 0){const r=this.optimisticClientSources[t]!==void 0?this.optimisticClientSources[t]:(n=this.serverSources)==null?void 0:n[t];this.schemas===null?this.cachedSourceSnapshots[t]={status:"no-schemas"}:this.schemas[t]?r===void 0?this.cachedSourceSnapshots[t]={status:"source-not-found"}:this.cachedSourceSnapshots[t]={status:"success",data:ti(r),optimistic:this.optimisticClientSources[t]!==void 0}:this.cachedSourceSnapshots[t]={status:"schema-not-found"}}return this.cachedSourceSnapshots[t]}getAllSourcesSnapshot(){var t;if(this.cachedAllSourcesSnapshot===null){this.cachedAllSourcesSnapshot={};for(const n in this.schemas||{}){const r=n,o=this.optimisticClientSources[r]||((t=this.serverSources)==null?void 0:t[r]);o&&(this.cachedAllSourcesSnapshot[r]=ti(o))}}return this.cachedAllSourcesSnapshot}getAllSchemasSnapshot(){var t;this.cachedAllSchemasSnapshot===null&&(this.cachedAllSchemasSnapshot={});for(const n in this.schemas||{}){const r=n,o=(t=this.schemas)==null?void 0:t[r];o&&(this.cachedAllSchemasSnapshot[r]=ti(o))}return this.cachedAllSchemasSnapshot}getValidationErrorSnapshot(t){const n=this.getAllValidationErrorsSnapshot();return n==null?void 0:n[t]}getAllValidationErrorsSnapshot(){if(!this.cachedValidationErrors){this.cachedValidationErrors={};for(const t in this.errors.validationErrors){const n=t,r=[];for(const o of this.errors.validationErrors[n]||[])o&&r.push(o);r.length>0&&(this.cachedValidationErrors[n]=r)}}return this.cachedValidationErrors}getSyncStatusSnapshot(t){return this.cachedSyncStatus===null&&(this.cachedSyncStatus={}),this.cachedSyncStatus[t]===void 0&&(this.cachedSyncStatus[t]=this.syncStatus[t]||null),this.syncStatus[t]}getPendingOpsSnapshot(){return this.cachedPendingOpsCountSnapshot===null&&(this.cachedPendingOpsCountSnapshot=this.pendingOps.length),this.cachedPendingOpsCountSnapshot}getSerializedPatchSetsSnapshot(){return this.cachedSerializedPatchSetsSnapshot||(this.cachedSerializedPatchSetsSnapshot=this.patchSets.serialize()),this.cachedSerializedPatchSetsSnapshot}getInitializedAtSnapshot(){return this.cachedInitializedAtSnapshot===null&&(this.cachedInitializedAtSnapshot={data:this.initializedAt}),this.cachedInitializedAtSnapshot}getAllPatchesSnapshot(){if(!this.cachedPatchData){this.cachedPatchData={};for(const t in this.patchDataByPatchId){const n=t,r=this.patchDataByPatchId[n];r&&(this.cachedPatchData[n]=ti(r))}}return this.cachedPatchData}getGlobalServerSidePatchIdsSnapshot(){var t;return this.cachedGlobalServerSidePatchIdsSnapshot===null&&(this.cachedGlobalServerSidePatchIdsSnapshot=((t=this.globalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedGlobalServerSidePatchIdsSnapshot}getPendingClientSidePatchIdsSnapshot(){var t;return this.cachedPendingClientSidePatchIdsSnapshot===null&&(this.cachedPendingClientSidePatchIdsSnapshot=((t=this.pendingClientPatchIds)==null?void 0:t.slice())||[]),this.cachedPendingClientSidePatchIdsSnapshot}getSyncedServerSidePatchIdsSnapshot(){var t;return this.cachedSyncedServerSidePatchIdsSnapshot===null&&(this.cachedSyncedServerSidePatchIdsSnapshot=((t=this.syncedServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSyncedServerSidePatchIdsSnapshot}getSavedServerSidePatchIdsSnapshot(){var t;return this.cachedSavedServerSidePatchIdsSnapshot===null&&(this.cachedSavedServerSidePatchIdsSnapshot=((t=this.savedButNotYetGlobalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSavedServerSidePatchIdsSnapshot}getPublishDisabledSnapshot(){return this.cachedPublishDisabledSnapshot===null&&(this.cachedPublishDisabledSnapshot=this.publishDisabled),this.cachedPublishDisabledSnapshot}getAutoPublishSnapshot(){return this.cachedAutoPublishSnapshot===null&&(this.cachedAutoPublishSnapshot=this.autoPublish),this.cachedAutoPublishSnapshot}getGlobalTransientErrorsSnapshot(){var t;return this.cachedGlobalTransientErrorSnapshot===null&&(this.cachedGlobalTransientErrorSnapshot=((t=this.errors.globalTransientErrorQueue)==null?void 0:t.slice())||[]),this.cachedGlobalTransientErrorSnapshot}getNetworkErrorSnapshot(){return this.cachedNetworkErrorSnapshot===void 0&&(this.cachedNetworkErrorSnapshot=this.errors.hasNetworkErrorTimestamp||null),this.cachedNetworkErrorSnapshot}getParentRefSnapshot(){return this.cachedParentRef===void 0&&(this.cachedParentRef=this.getParentRef()),this.cachedParentRef}addPatchOnClientOnly(t,n,r){var a;const[o]=X.splitModuleFilePathAndModulePath(t);if(this.serverSources===null||((a=this.serverSources)==null?void 0:a[o])===void 0)return this.addGlobalTransientError(`Content at '${o}' is not yet initialized`,r),{status:"patch-error",message:`Content at '${o}' is not yet initialized`,moduleFilePath:o};this.optimisticClientSources[o]===void 0&&(this.optimisticClientSources[o]=this.serverSources[o]);const i=n.filter(l=>l.op!=="file"),s=f9(ti(this.optimisticClientSources[o]),m9,i);if(Tz.isErr(s))return console.error("Could not apply patch:",s.error),this.addGlobalTransientError(`Could apply patch: ${s.error.message}`,r),{status:"patch-error",message:s.error.message,moduleFilePath:o};{const l=s.value,c=ti(this.optimisticClientSources[o]);return this.optimisticClientSources[o]=l,{status:"optimistic-client-sources-updated",moduleFilePath:o,prevSource:c,patch:n}}}async addPatchAwaitable(t,n,r,o,i){const s=this.addPatchOnClientOnly(t,r,i);if(s.status!=="optimistic-client-sources-updated")return s;const{moduleFilePath:a,patch:l}=s,c={type:"add-patches",data:{[a]:[{patch:l,patchId:o,type:n}]},createdAt:i};let u=0;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);let d=await this.executeAddPatches(c,{},i);for(;d.status==="retry"&&u<3&&(u++,await new Promise(h=>setTimeout(h,500*(u+1))),d=await this.executeAddPatches(c,{},i),d.status==="retry"););return this.syncStatus[t]="done",this.invalidateSyncStatus(t),d.status==="done"?{status:"patch-synced",patchId:o,parentRef:d.parentRef,moduleFilePath:a}:(this.optimisticClientSources[a]=s.prevSource,{status:"patch-sync-error",message:"Could not sync patch. Tried 3 times.",moduleFilePath:a})}addPatch(t,n,r,o){var l,c,u,d,h,p,m,v,x,b,w;const i=this.addPatchOnClientOnly(t,r,o);if(i.status!=="optimistic-client-sources-updated")return i;const s=i.moduleFilePath;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);const a=this.pendingOps[this.pendingOps.length-1];if((a==null?void 0:a.type)==="add-patches"){const S=(((c=(l=a.data)==null?void 0:l[s])==null?void 0:c.length)||0)-1,C=(h=(d=(u=a.data)==null?void 0:u[s])==null?void 0:d[S])==null?void 0:h.patch,_=(v=(m=(p=a.data)==null?void 0:p[s])==null?void 0:m[S])==null?void 0:v.patchId;if(h9(C,r)&&((w=(b=(x=a.data)==null?void 0:x[s])==null?void 0:b[S])==null?void 0:w.type)===n&&_&&this.patchDataByPatchId[_])return a.data[s][S].patch=r,a.updatedAt=o,this.invalidatePendingOps(),this.patchDataByPatchId[_].patch=r,this.patchSetInsert(s,_,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-merged",patchId:_,moduleFilePath:s};{a.data[s]||(a.data[s]=[]);const P=this.createPatchId();return a.data[s].push({patch:r,type:n,patchId:P}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(P),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[P]={moduleFilePath:s,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(s,P,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-added",patchId:P,moduleFilePath:s}}}else{const S=this.createPatchId();return this.pendingOps.push({type:"add-patches",data:{[s]:[{patch:r,type:n,patchId:S}]},createdAt:o}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(S),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[S]={moduleFilePath:s,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(s,S,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-added",patchId:S,moduleFilePath:s}}}createPatchId(){return crypto.randomUUID()}patchSetInsert(t,n,r,o){var s;const i=new Date(o).toISOString();for(const a of r)this.patchSets.insert(t,((s=this.schemas)==null?void 0:s[t])??void 0,a,n,i,this.authorId);this.invalidatePatchSets()}deletePatches(t,n){const r=this.pendingOps[this.pendingOps.length-1];if((r==null?void 0:r.type)==="delete-patches"){r.patchIds.push(...t),r.updatedAt=n;return}this.pendingOps.push({type:"delete-patches",patchIds:t,createdAt:n}),this.invalidatePendingOps()}markAllSyncStatusIn(t,n){for(const r in this.syncStatus)r.startsWith(t)&&(this.syncStatus[r]=n)}getParentRef(){if(this.baseSha===null||this.globalServerSidePatchIds===null)return null;const t=this.savedButNotYetGlobalServerSidePatchIds[this.savedButNotYetGlobalServerSidePatchIds.length-1]||this.globalServerSidePatchIds[this.globalServerSidePatchIds.length-1];return t?{type:"patch",patchId:t}:{type:"head",headBaseSha:this.baseSha}}async syncWithUpdatedStat(t,n,r,o,i,s,a,l){const c=this.sourcesSha!==o;if(this.sourcesSha=o,this.baseSha=n,this.mode=t,this.serverSideSchemaSha!==r||this.commitSha!==a)return this.reset(),this.serverSideSchemaSha=r,this.commitSha=a,this.init(t,n,r,o,i,s,a,l);const u=this.globalServerSidePatchIds===null||!du(this.globalServerSidePatchIds,i);if(u){this.globalServerSidePatchIds=i;const d=new Set(i);this.deletePendingPatchId(d),this.deleteSavedButNotYetGlobalServerSidePatchIds(d),await this.syncPatches(!1,l),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),this.invalidatePendingClientSidePatchIds()}return!this.forceSyncAllModules&&(c||u)&&(this.forceSyncAllModules=!0),this.sync(l)}async executeAddPatches(t,n,r){const o=[],i=[];for(const[l,c]of Object.entries(t.data)){const u=l;for(const d of c)o.push({path:u,patchId:d.patchId,patch:d.patch}),i.push(d.patchId),n[u]||(n[u]=new Set),n[u].add(d.type)}const s=this.getParentRef();if(s===null)return this.addGlobalTransientError("Tried to update content with changes, but could not since Val is not yet initialized",r),{status:"retry",reason:"not-initialized"};const a=await this.client("/patches","PUT",{body:{patches:o,parentRef:s}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return console.warn("Network error: trying again..."),this.addNetworkError(r),{status:"retry",reason:"network-error"};if(a.status===409)return this.savedButNotYetGlobalServerSidePatchIds=[],{status:"retry",reason:"conflict"};if(a.status!==200){console.error("Failed to add patches",{error:a.json.message}),this.addGlobalTransientError("Failed to save changes",r,a.json.message);for(const c of i)this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0};const l=new Set(i);this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!l.has(c))}else{const l=new Set(a.json.newPatchIds);this.deletePendingPatchId(l);for(const c of i){const u=c;this.savedButNotYetGlobalServerSidePatchIds.push(u),this.patchDataByPatchId[u]&&(this.patchDataByPatchId[u].isPending=!1)}}return{status:"done",parentRef:s}}deletePendingPatchId(t){let n=0;for(let r=0;r<this.pendingClientPatchIds.length;r++){const o=this.pendingClientPatchIds[r];if(t.has(o)&&(this.pendingClientPatchIds.splice(r,1),r--,n++,t.size===n))break}}deleteSavedButNotYetGlobalServerSidePatchIds(t){let n=0;for(let r=0;r<this.savedButNotYetGlobalServerSidePatchIds.length;r++){const o=this.savedButNotYetGlobalServerSidePatchIds[r];if(t.has(o)&&(this.savedButNotYetGlobalServerSidePatchIds.splice(r,1),r--,n++,t.size===n))break}}async executeDeletePatches(t,n,r){var l;let o=!1;const i=t.patchIds,s=new Set(i),a=await this.client("/patches","DELETE",{query:{id:t.patchIds.reverse()}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return this.addNetworkError(r),{status:"retry",reason:"network-error"};if(a.status!==200)this.addGlobalTransientError("Failed to delete patches",r);else{for(const c of t.patchIds)if(this.patchDataByPatchId[c]){const u=this.patchDataByPatchId[c].moduleFilePath;n[u]||(n[u]=new Set),n[u].add("unknown"),this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0}}else o=!0;this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!s.has(c)),this.globalServerSidePatchIds=((l=this.globalServerSidePatchIds)==null?void 0:l.filter(c=>!s.has(c)))??null}return{status:"done",syncAllRequired:o}}async syncSchema(){const t=await this.client("/schema","GET",{});if(t.status===200){this.schemas={};for(const[n,r]of Object.entries(t.json.schemas)){const o=n;r&&(this.schemas[o]=r)}return this.clientSideSchemaSha!==t.json.schemaSha&&(this.clientSideSchemaSha=t.json.schemaSha),console.debug("Invalidating schema"),this.invalidateSchema(),{status:"done"}}else if(t.status===null)return{status:"retry",reason:"error"};return{status:"retry",reason:"error"}}async syncPatches(t,n){var l;const r=this.globalServerSidePatchIds||[];let o=!1,i=!1;if(this.initializedAt===null||t){this.patchSets=new yd,o=!0;const c=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:void 0}});if(c.status!==200)return this.addGlobalTransientError("Failed to get changes (full sync)",n,`Did not get ok status (got: ${c.status}): ${c.json.message}`),{status:"retry"};for(const u of c.json.patches)u.patch&&(i=!0,this.patchDataByPatchId[u.patchId]={moduleFilePath:u.path,patch:u.patch,isPending:!1,createdAt:u.createdAt,authorId:u.authorId,isCommitted:u.appliedAt?{commitSha:u.appliedAt.commitSha}:void 0});c.json.error&&this.addGlobalTransientError("Some changes has errors",n,c.json.error.message);for(const u of Object.values(c.json.errors||{}))u&&this.addGlobalTransientError("A change has an error",n,u.message)}else{const c=[];for(const u of this.globalServerSidePatchIds||[])this.patchDataByPatchId[u]||c.push(u);if(c.length>0){const d=[];for(let h=0;h<c.length;h+=100)d.push(c.slice(h,h+100));for(const h of d){const p=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:h}});if(p.status!==200)return this.addGlobalTransientError("Failed to get changes (batch)",n,`Did not get ok status (got: ${p.status}): ${p.json.message}`),{status:"retry"};for(const m of p.json.patches)m.patch&&(i=!0,this.patchDataByPatchId[m.patchId]={moduleFilePath:m.path,patch:m.patch,isPending:!1,createdAt:m.createdAt,authorId:m.authorId,isCommitted:m.appliedAt?{commitSha:m.appliedAt.commitSha}:void 0})}}}const s=new Set(r);for(const c of Array.from(this.patchSets.getInsertedPatches())||[])if(!s.has(c)){this.patchSets=new yd,o=!0;break}const a=[];for(const c of r)if(!this.patchSets.isInserted(c)){const u=this.patchDataByPatchId[c],d=(u==null?void 0:u.moduleFilePath)&&((l=this.schemas)==null?void 0:l[u==null?void 0:u.moduleFilePath]);if(u&&d)for(const h of u.patch)o=!0,this.patchSets.insert(u.moduleFilePath,d,h,c,u.createdAt,u.authorId);else a.push(c)}return i&&this.invalidateAllPatches(),o&&this.invalidatePatchSets(),a.length>0?(this.initializedAt!==null&&(console.debug("Missing data for patch ids",a,{currentPatchIds:r,reset:t}),this.mode!=="fs"&&this.addGlobalTransientError("Failed to get changes",n,`Missing data for patch ids: ${a.join(", ")}`)),{status:"retry"}):{status:"done"}}getChangedModules(t){const n=Object.entries(t);if(n.length===0)return[];if(n.length===1){const[r,o]=n[0];if(Array.from(o).every(i=>g9.includes(i)))return[r]}return"all"}async sync(t){var s,a,l,c,u,d,h,p;if(this.isSyncing)return{status:"retry",reason:"already-syncing"};if(this.isPublishing)return{status:"retry",reason:"publishing"};let n=[];this.forceSyncAllModules&&(this.forceSyncAllModules=!1,n="all"),this.initializedAt===null&&(n="all"),this.clientSideSchemaSha!==this.serverSideSchemaSha&&(n="all"),this.isSyncing=!0;let r=[],o=!1;const i=new Set([...this.syncedServerSidePatchIds,...this.savedButNotYetGlobalServerSidePatchIds]);if(this.globalServerSidePatchIds&&this.mode==="http"){for(const m of i)if(!this.globalServerSidePatchIds.includes(m)){this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingClientPatchIds=[],await this.syncPatches(!0,t),o=!0;break}}try{const m={},v=(w,S)=>t-S<=w*1e3,x=(w,S)=>t-S>=w*1e3;if(((s=this.pendingOps[this.pendingOps.length-1])==null?void 0:s.updatedAt)!==void 0&&v(this.MIN_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].updatedAt)&&!x(this.MAX_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].createdAt))return{status:"retry",reason:"too-fast"};r=this.pendingOps.slice(),this.pendingOps=[];let b=!1;for(;r[0];){const w=r[0];if(w.type==="add-patches")try{const S=await this.executeAddPatches(w,m,t);if(S.status!=="done")return S}catch{return{status:"retry",reason:"error"}}else if(w.type==="delete-patches")try{const S=await this.executeDeletePatches(w,m,t);if(S.status!=="done")return S;S.syncAllRequired&&n!=="all"&&(n="all")}catch{return{status:"retry",reason:"error"}}b=!0,r.shift()}if(this.invalidatePendingOps(),n!=="all"){const w=this.getChangedModules(m);if(w==="all")n="all";else for(const S of w)n.push(S)}if(this.clientSideSchemaSha===null||this.schemas===null||this.initializedAt===null){const w=await this.syncSchema();if(w.status!=="done")return w}if(console.debug("Syncing?",{changedModules:n}),n==="all"||n.length>0){const w=n!=="all"&&n.length===1?n[0]:void 0,S=await this.client("/sources/~","PUT",{path:w,query:{validate_sources:!0,validate_binary_files:!1}});if(S.status!==null&&this.resetNetworkError(),S.status===null&&S.json.type==="network_error")return this.addNetworkError(t),{status:"retry",reason:"network-error"};if(S.status!==200)this.addGlobalTransientError("Could not sync content with server. Please wait or reload the application.",t,S.json.message);else{const C=new Set;for(const _ in this.errors.validationErrors){const P=_;(w===void 0||P.startsWith(w))&&(C.add(P),this.errors.validationErrors[P]&&(this.errors.validationErrors={...this.errors.validationErrors,[P]:void 0}))}for(const[_,P]of Object.entries(S.json.modules)){const O=_;if(P){this.serverSources===null&&(this.serverSources={}),this.serverSources[O]=P.source,this.previews===null&&(this.previews={}),this.previews[O]=P.preview||null,this.invalidatePreview(O),(du(this.serverSources[O],this.optimisticClientSources[O])||this.pendingOps.length===0)&&(this.optimisticClientSources={...this.optimisticClientSources,[O]:void 0}),console.debug("Invalidating source",O),this.invalidateSource(O),(a=this.overlayEmitter)==null||a.call(this,O,P.source);for(const M in P.validationErrors){const I=M;this.errors.validationErrors||(this.errors.validationErrors={}),this.errors.validationErrors[I]=P.validationErrors[I],C.add(I)}for(const M of((l=P.patches)==null?void 0:l.applied)||[])this.syncedServerSidePatchIds.push(M);for(const M of((c=P.patches)==null?void 0:c.skipped)||[])this.syncedServerSidePatchIds.push(M)}else this.addGlobalTransientError(`Could not find '${O}' in server reply`,t,"This is most likely a bug");this.markAllSyncStatusIn(O,"done")}this.invalidateAllValidationErrors();for(const _ of Array.from(C))this.invalidateValidationError(_);S.json.schemaSha!==this.clientSideSchemaSha&&await this.syncSchema()}}if(this.autoPublish&&this.mode==="fs"&&this.globalServerSidePatchIds&&this.globalServerSidePatchIds.length>0){let w=!1;for(const S in this.errors.validationErrors||{}){const C=S;if((d=(u=this.errors)==null?void 0:u.validationErrors)!=null&&d[C]&&((p=(h=this.errors)==null?void 0:h.validationErrors)==null?void 0:p[C].length)>0){w=!0;break}}w?console.debug("Skip auto-publish since there's validation errors",this.errors.validationErrors):(await this.publish(this.globalServerSidePatchIds.concat(...Array.from(this.syncedServerSidePatchIds)),void 0,t),b=!0)}return(o||b)&&(this.invalidatePendingClientSidePatchIds(),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds()),{status:"done"}}finally{this.isSyncing=!1,this.pendingOps=[...r,...this.pendingOps]}}async publish(t,n,r){try{if(this.isPublishing)return console.debug("Already publishing changes",r),{status:"retry",reason:"already-publishing"};if(this.isPublishing=!0,this.publishDisabled)return console.debug("Could not publish changes, since the publish is disabled",r),{status:"retry",reason:"publish-disabled"};if(this.publishDisabled=!0,this.invalidatePublishDisabled(),Object.values(this.errors.validationErrors||{}).flatMap(s=>s||[]).length>0)return console.debug("Skipping publish since there's validation errors",this.errors.validationErrors),this.addGlobalTransientError("Could not publish changes, since there are validation errors",r),{status:"retry",reason:"validation-error"};if(t.length===0)return this.addGlobalTransientError("Could not publish changes, since there are no changes to publish",Date.now()),{status:"done"};const i=await this.client("/save","POST",{body:{message:n,patchIds:t}});return i.status===null?(this.addGlobalTransientError("Network error: could not publish",Date.now()),{status:"retry"}):i.status!==200?(this.addGlobalTransientError("Failed to publish changes",Date.now(),i.json.message),{status:"retry"}):(this.mode==="fs"&&(this.globalServerSidePatchIds=[],console.debug("Deleting all patch ids")),this.pendingClientPatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.patchDataByPatchId={},this.patchSets=new yd,await this.syncPatches(!0,r),this.invalidatePatchSets(),this.invalidateAllPatches(),this.invalidatePendingClientSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),{status:"done"})}catch(o){return console.error("Error while publishing",o),this.addGlobalTransientError("Failed to publish changes",Date.now(),o.message),{status:"retry",reason:"error"}}finally{this.isPublishing=!1,this.publishDisabled=!1,this.invalidatePublishDisabled()}}resetNetworkError(){this.errors.hasNetworkErrorTimestamp=null,this.invalidateNetworkError()}addNetworkError(t){this.errors.hasNetworkErrorTimestamp=t,this.invalidateNetworkError()}addGlobalTransientError(t,n,r){this.errors.globalTransientErrorQueue||(this.errors.globalTransientErrorQueue=[]),console.error("Global transient error",t,r||""),this.errors.globalTransientErrorQueue.push({message:t,details:r,timestamp:n,id:crypto.randomUUID()}),this.invalidateGlobalTransientErrors()}removeGlobalTransientErrors(t){if(this.errors.globalTransientErrorQueue){const n=new Set(t);this.errors.globalTransientErrorQueue=this.errors.globalTransientErrorQueue.filter(r=>!n.has(r.id)),this.invalidateGlobalTransientErrors()}}}const m9=new u9,Dn="global",g9=["string","boolean","number","date","richtext","file","image"],v9=(e,t)=>{window.dispatchEvent(new CustomEvent("val-event",{detail:{type:"source-update",moduleFilePath:e,source:t}}))};function y9(e,t,n){var o,i,s;const r={};for(const a of e)r[a.commitSha]=a;for(const a of t)r[a.commitSha]||(r[a.commitSha]={commitMessage:(a==null?void 0:a.commitMessage)||null,deploymentState:"created",creator:a.creator,createdAt:a.createdAt,updatedAt:a.createdAt,commitSha:a.commitSha});for(const a of n)a.commitSha&&(r[a.commitSha]={commitMessage:((o=r[a.commitSha])==null?void 0:o.commitMessage)||null,deploymentState:a.deploymentState,creator:((i=r[a.commitSha])==null?void 0:i.creator)||null,createdAt:((s=r[a.commitSha])==null?void 0:s.createdAt)||a.createdAt,updatedAt:a.updatedAt,commitSha:a.commitSha});return Object.values(r).sort((a,l)=>new Date(l.updatedAt).getTime()-new Date(a.updatedAt).getTime())}function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function x9(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Fv(...e){return t=>e.forEach(n=>x9(n,t))}function $e(...e){return g.useCallback(Fv(...e),e)}function b9(e,t){const n=g.createContext(t),r=i=>{const{children:s,...a}=i,l=g.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=g.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function ho(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];const c=d=>{var b;const{scope:h,children:p,...m}=d,v=((b=h==null?void 0:h[e])==null?void 0:b[l])||a,x=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:x,children:p})};c.displayName=i+"Provider";function u(d,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,w9(o,...t)]}function w9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ns=g.forwardRef((e,t)=>{const{children:n,...r}=e,o=g.Children.toArray(n),i=o.find(S9);if(i){const s=i.props.children,a=o.map(l=>l===i?g.Children.count(s)>1?g.Children.only(null):g.isValidElement(s)?s.props.children:null:l);return f.jsx(kb,{...r,ref:t,children:g.isValidElement(s)?g.cloneElement(s,void 0,a):null})}return f.jsx(kb,{...r,ref:t,children:n})});ns.displayName="Slot";var kb=g.forwardRef((e,t)=>{const{children:n,...r}=e;if(g.isValidElement(n)){const o=E9(n);return g.cloneElement(n,{...k9(r,n.props),ref:t?Fv(t,o):o})}return g.Children.count(n)>1?g.Children.only(null):null});kb.displayName="SlotClone";var Oj=({children:e})=>f.jsx(f.Fragment,{children:e});function S9(e){return g.isValidElement(e)&&e.type===Oj}function k9(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function E9(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var C9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Te=C9.reduce((e,t)=>{const n=g.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?ns:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Mj(e,t){e&&jr.flushSync(()=>e.dispatchEvent(t))}function tn(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function _9(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var P9="DismissableLayer",Eb="dismissableLayer.update",N9="dismissableLayer.pointerDownOutside",T9="dismissableLayer.focusOutside",HC,jj=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hl=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=g.useContext(jj),[u,d]=g.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),m=$e(t,O=>d(O)),v=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(x),w=u?v.indexOf(u):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,C=w>=b,_=j9(O=>{const M=O.target,I=[...c.branches].some(L=>L.contains(M));!C||I||(o==null||o(O),s==null||s(O),O.defaultPrevented||a==null||a())},h),P=R9(O=>{const M=O.target;[...c.branches].some(L=>L.contains(M))||(i==null||i(O),s==null||s(O),O.defaultPrevented||a==null||a())},h);return _9(O=>{w===c.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},h),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(HC=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),WC(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=HC)}},[u,h,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),WC())},[u,c]),g.useEffect(()=>{const O=()=>p({});return document.addEventListener(Eb,O),()=>document.removeEventListener(Eb,O)},[]),f.jsx(Te.div,{...l,ref:m,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,P.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,_.onPointerDownCapture)})});Hl.displayName=P9;var O9="DismissableLayerBranch",M9=g.forwardRef((e,t)=>{const n=g.useContext(jj),r=g.useRef(null),o=$e(t,r);return g.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),f.jsx(Te.div,{...e,ref:o})});M9.displayName=O9;function j9(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){Rj(N9,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function R9(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e),r=g.useRef(!1);return g.useEffect(()=>{const o=i=>{i.target&&!r.current&&Rj(T9,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function WC(){const e=new CustomEvent(Eb);document.dispatchEvent(e)}function Rj(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Mj(o,i):o.dispatchEvent(i)}var _n=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},I9=hF.useId||(()=>{}),A9=0;function Ar(e){const[t,n]=g.useState(I9());return _n(()=>{n(r=>r??String(A9++))},[e]),t?`radix-${t}`:""}const D9=["top","right","bottom","left"],Sa=Math.min,Nr=Math.max,bg=Math.round,Vp=Math.floor,ci=e=>({x:e,y:e}),L9={left:"right",right:"left",bottom:"top",top:"bottom"},F9={start:"end",end:"start"};function Cb(e,t,n){return Nr(e,Sa(t,n))}function rs(e,t){return typeof e=="function"?e(t):e}function is(e){return e.split("-")[0]}function Ru(e){return e.split("-")[1]}function tS(e){return e==="x"?"y":"x"}function nS(e){return e==="y"?"height":"width"}function ka(e){return["top","bottom"].includes(is(e))?"y":"x"}function rS(e){return tS(ka(e))}function z9(e,t,n){n===void 0&&(n=!1);const r=Ru(e),o=rS(e),i=nS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=wg(s)),[s,wg(s)]}function $9(e){const t=wg(e);return[_b(e),t,_b(t)]}function _b(e){return e.replace(/start|end/g,t=>F9[t])}function B9(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function V9(e,t,n,r){const o=Ru(e);let i=B9(is(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(_b)))),i}function wg(e){return e.replace(/left|right|bottom|top/g,t=>L9[t])}function U9(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ij(e){return typeof e!="number"?U9(e):{top:e,right:e,bottom:e,left:e}}function Sg(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function KC(e,t,n){let{reference:r,floating:o}=e;const i=ka(t),s=rS(t),a=nS(s),l=is(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ru(t)){case"start":p[s]-=h*(n&&c?-1:1);break;case"end":p[s]+=h*(n&&c?-1:1);break}return p}const H9=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=KC(c,r,l),h=r,p={},m=0;for(let v=0;v<a.length;v++){const{name:x,fn:b}=a[v],{x:w,y:S,data:C,reset:_}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});u=w??u,d=S??d,p={...p,[x]:{...p[x],...C}},_&&m<=50&&(m++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(c=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:u,y:d}=KC(c,h,l)),v=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:p}};async function rh(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=rs(t,e),m=Ij(p),x=a[h?d==="floating"?"reference":"floating":d],b=Sg(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),C=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},_=Sg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:S,strategy:l}):w);return{top:(b.top-_.top+m.top)/C.y,bottom:(_.bottom-b.bottom+m.bottom)/C.y,left:(b.left-_.left+m.left)/C.x,right:(_.right-b.right+m.right)/C.x}}const W9=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=rs(e,t)||{};if(c==null)return{};const d=Ij(u),h={x:n,y:r},p=rS(o),m=nS(p),v=await s.getDimensions(c),x=p==="y",b=x?"top":"left",w=x?"bottom":"right",S=x?"clientHeight":"clientWidth",C=i.reference[m]+i.reference[p]-h[p]-i.floating[m],_=h[p]-i.reference[p],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let O=P?P[S]:0;(!O||!await(s.isElement==null?void 0:s.isElement(P)))&&(O=a.floating[S]||i.floating[m]);const M=C/2-_/2,I=O/2-v[m]/2-1,L=Sa(d[b],I),U=Sa(d[w],I),$=L,K=O-v[m]-U,W=O/2-v[m]/2+M,B=Cb($,W,K),A=!l.arrow&&Ru(o)!=null&&W!==B&&i.reference[m]/2-(W<$?L:U)-v[m]/2<0,R=A?W<$?W-$:W-K:0;return{[p]:h[p]+R,data:{[p]:B,centerOffset:W-B-R,...A&&{alignmentOffset:R}},reset:A}}}),K9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...x}=rs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=is(o),w=ka(a),S=is(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),_=h||(S||!v?[wg(a)]:$9(a)),P=m!=="none";!h&&P&&_.push(...V9(a,v,m,C));const O=[a,..._],M=await rh(t,x),I=[];let L=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&I.push(M[b]),d){const W=z9(o,s,C);I.push(M[W[0]],M[W[1]])}if(L=[...L,{placement:o,overflows:I}],!I.every(W=>W<=0)){var U,$;const W=(((U=i.flip)==null?void 0:U.index)||0)+1,B=O[W];if(B)return{data:{index:W,overflows:L},reset:{placement:B}};let A=($=L.filter(R=>R.overflows[0]<=0).sort((R,N)=>R.overflows[1]-N.overflows[1])[0])==null?void 0:$.placement;if(!A)switch(p){case"bestFit":{var K;const R=(K=L.filter(N=>{if(P){const D=ka(N.placement);return D===w||D==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(D=>D>0).reduce((D,z)=>D+z,0)]).sort((N,D)=>N[1]-D[1])[0])==null?void 0:K[0];R&&(A=R);break}case"initialPlacement":A=a;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function GC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qC(e){return D9.some(t=>e[t]>=0)}const G9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=rs(e,t);switch(r){case"referenceHidden":{const i=await rh(t,{...o,elementContext:"reference"}),s=GC(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:qC(s)}}}case"escaped":{const i=await rh(t,{...o,altBoundary:!0}),s=GC(i,n.floating);return{data:{escapedOffsets:s,escaped:qC(s)}}}default:return{}}}}};async function q9(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=is(n),a=Ru(n),l=ka(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=rs(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const Y9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await q9(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},J9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...l}=rs(e,t),c={x:n,y:r},u=await rh(t,l),d=ka(is(o)),h=tS(d);let p=c[h],m=c[d];if(i){const x=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+u[x],S=p-u[b];p=Cb(w,p,S)}if(s){const x=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=m+u[x],S=m-u[b];m=Cb(w,m,S)}const v=a.fn({...t,[h]:p,[d]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[d]:s}}}}}},X9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=rs(e,t),u={x:n,y:r},d=ka(o),h=tS(d);let p=u[h],m=u[d];const v=rs(a,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const S=h==="y"?"height":"width",C=i.reference[h]-i.floating[S]+x.mainAxis,_=i.reference[h]+i.reference[S]-x.mainAxis;p<C?p=C:p>_&&(p=_)}if(c){var b,w;const S=h==="y"?"width":"height",C=["top","left"].includes(is(o)),_=i.reference[d]-i.floating[S]+(C&&((b=s.offset)==null?void 0:b[d])||0)+(C?0:x.crossAxis),P=i.reference[d]+i.reference[S]+(C?0:((w=s.offset)==null?void 0:w[d])||0)-(C?x.crossAxis:0);m<_?m=_:m>P&&(m=P)}return{[h]:p,[d]:m}}}},Z9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=rs(e,t),u=await rh(t,c),d=is(o),h=Ru(o),p=ka(o)==="y",{width:m,height:v}=i.floating;let x,b;d==="top"||d==="bottom"?(x=d,b=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,x=h==="end"?"top":"bottom");const w=v-u.top-u.bottom,S=m-u.left-u.right,C=Sa(v-u[x],w),_=Sa(m-u[b],S),P=!t.middlewareData.shift;let O=C,M=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=w),P&&!h){const L=Nr(u.left,0),U=Nr(u.right,0),$=Nr(u.top,0),K=Nr(u.bottom,0);p?M=m-2*(L!==0||U!==0?L+U:Nr(u.left,u.right)):O=v-2*($!==0||K!==0?$+K:Nr(u.top,u.bottom))}await l({...t,availableWidth:M,availableHeight:O});const I=await s.getDimensions(a.floating);return m!==I.width||v!==I.height?{reset:{rects:!0}}:{}}}};function zv(){return typeof window<"u"}function Iu(e){return Aj(e)?(e.nodeName||"").toLowerCase():"#document"}function Dr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bi(e){var t;return(t=(Aj(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Aj(e){return zv()?e instanceof Node||e instanceof Dr(e).Node:!1}function Ho(e){return zv()?e instanceof Element||e instanceof Dr(e).Element:!1}function hi(e){return zv()?e instanceof HTMLElement||e instanceof Dr(e).HTMLElement:!1}function YC(e){return!zv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Dr(e).ShadowRoot}function Hh(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Wo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Q9(e){return["table","td","th"].includes(Iu(e))}function $v(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function oS(e){const t=iS(),n=Ho(e)?Wo(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function eH(e){let t=Ea(e);for(;hi(t)&&!fu(t);){if(oS(t))return t;if($v(t))return null;t=Ea(t)}return null}function iS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function fu(e){return["html","body","#document"].includes(Iu(e))}function Wo(e){return Dr(e).getComputedStyle(e)}function Bv(e){return Ho(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ea(e){if(Iu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||YC(e)&&e.host||bi(e);return YC(t)?t.host:t}function Dj(e){const t=Ea(e);return fu(t)?e.ownerDocument?e.ownerDocument.body:e.body:hi(t)&&Hh(t)?t:Dj(t)}function oh(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Dj(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Dr(o);if(i){const a=Pb(s);return t.concat(s,s.visualViewport||[],Hh(o)?o:[],a&&n?oh(a):[])}return t.concat(o,oh(o,[],n))}function Pb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Lj(e){const t=Wo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=hi(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=bg(n)!==i||bg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function sS(e){return Ho(e)?e:e.contextElement}function Bc(e){const t=sS(e);if(!hi(t))return ci(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Lj(t);let s=(i?bg(n.width):n.width)/r,a=(i?bg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const tH=ci(0);function Fj(e){const t=Dr(e);return!iS()||!t.visualViewport?tH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nH(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Dr(e)?!1:t}function Tl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=sS(e);let s=ci(1);t&&(r?Ho(r)&&(s=Bc(r)):s=Bc(e));const a=nH(i,n,r)?Fj(i):ci(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const h=Dr(i),p=r&&Ho(r)?Dr(r):r;let m=h,v=Pb(m);for(;v&&r&&p!==m;){const x=Bc(v),b=v.getBoundingClientRect(),w=Wo(v),S=b.left+(v.clientLeft+parseFloat(w.paddingLeft))*x.x,C=b.top+(v.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,d*=x.y,l+=S,c+=C,m=Dr(v),v=Pb(m)}}return Sg({width:u,height:d,x:l,y:c})}function aS(e,t){const n=Bv(e).scrollLeft;return t?t.left+n:Tl(bi(e)).left+n}function zj(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:aS(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function rH(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=bi(r),a=t?$v(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=ci(1);const u=ci(0),d=hi(r);if((d||!d&&!i)&&((Iu(r)!=="body"||Hh(s))&&(l=Bv(r)),hi(r))){const p=Tl(r);c=Bc(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=s&&!d&&!i?zj(s,l,!0):ci(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function oH(e){return Array.from(e.getClientRects())}function iH(e){const t=bi(e),n=Bv(e),r=e.ownerDocument.body,o=Nr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Nr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+aS(e);const a=-n.scrollTop;return Wo(r).direction==="rtl"&&(s+=Nr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function sH(e,t){const n=Dr(e),r=bi(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=iS();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function aH(e,t){const n=Tl(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=hi(e)?Bc(e):ci(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function JC(e,t,n){let r;if(t==="viewport")r=sH(e,n);else if(t==="document")r=iH(bi(e));else if(Ho(t))r=aH(t,n);else{const o=Fj(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Sg(r)}function $j(e,t){const n=Ea(e);return n===t||!Ho(n)||fu(n)?!1:Wo(n).position==="fixed"||$j(n,t)}function lH(e,t){const n=t.get(e);if(n)return n;let r=oh(e,[],!1).filter(a=>Ho(a)&&Iu(a)!=="body"),o=null;const i=Wo(e).position==="fixed";let s=i?Ea(e):e;for(;Ho(s)&&!fu(s);){const a=Wo(s),l=oS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Hh(s)&&!l&&$j(e,s))?r=r.filter(u=>u!==s):o=a,s=Ea(s)}return t.set(e,r),r}function cH(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?$v(t)?[]:lH(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=JC(t,u,o);return c.top=Nr(d.top,c.top),c.right=Sa(d.right,c.right),c.bottom=Sa(d.bottom,c.bottom),c.left=Nr(d.left,c.left),c},JC(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uH(e){const{width:t,height:n}=Lj(e);return{width:t,height:n}}function dH(e,t,n){const r=hi(t),o=bi(t),i=n==="fixed",s=Tl(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ci(0);if(r||!r&&!i)if((Iu(t)!=="body"||Hh(o))&&(a=Bv(t)),r){const h=Tl(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=aS(o));const c=o&&!r&&!i?zj(o,a):ci(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function Ox(e){return Wo(e).position==="static"}function XC(e,t){if(!hi(e)||Wo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return bi(e)===n&&(n=n.ownerDocument.body),n}function Bj(e,t){const n=Dr(e);if($v(e))return n;if(!hi(e)){let o=Ea(e);for(;o&&!fu(o);){if(Ho(o)&&!Ox(o))return o;o=Ea(o)}return n}let r=XC(e,t);for(;r&&Q9(r)&&Ox(r);)r=XC(r,t);return r&&fu(r)&&Ox(r)&&!oS(r)?n:r||eH(e)||n}const fH=async function(e){const t=this.getOffsetParent||Bj,n=this.getDimensions,r=await n(e.floating);return{reference:dH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hH(e){return Wo(e).direction==="rtl"}const pH={convertOffsetParentRelativeRectToViewportRelativeRect:rH,getDocumentElement:bi,getClippingRect:cH,getOffsetParent:Bj,getElementRects:fH,getClientRects:oH,getDimensions:uH,getScale:Bc,isElement:Ho,isRTL:hH};function mH(e,t){let n=null,r;const o=bi(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:d,height:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const p=Vp(u),m=Vp(o.clientWidth-(c+d)),v=Vp(o.clientHeight-(u+h)),x=Vp(c),w={rootMargin:-p+"px "+-m+"px "+-v+"px "+-x+"px",threshold:Nr(0,Sa(1,l))||1};let S=!0;function C(_){const P=_[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return s(!0),i}function gH(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=sS(e),u=o||i?[...c?oh(c):[],...oh(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?mH(c,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let m,v=l?Tl(e):null;l&&x();function x(){const b=Tl(e);v&&(b.x!==v.x||b.y!==v.y||b.width!==v.width||b.height!==v.height)&&n(),v=b,m=requestAnimationFrame(x)}return n(),()=>{var b;u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const vH=Y9,yH=J9,xH=K9,bH=Z9,wH=G9,ZC=W9,SH=X9,kH=(e,t,n)=>{const r=new Map,o={platform:pH,...n},i={...o.platform,_c:r};return H9(e,t,{...o,platform:i})};var gm=typeof document<"u"?g.useLayoutEffect:g.useEffect;function kg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!kg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!kg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Vj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function QC(e,t){const n=Vj(e);return Math.round(t*n)/n}function Mx(e){const t=g.useRef(e);return gm(()=>{t.current=e}),t}function EH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=g.useState(r);kg(h,r)||p(r);const[m,v]=g.useState(null),[x,b]=g.useState(null),w=g.useCallback(N=>{N!==P.current&&(P.current=N,v(N))},[]),S=g.useCallback(N=>{N!==O.current&&(O.current=N,b(N))},[]),C=i||m,_=s||x,P=g.useRef(null),O=g.useRef(null),M=g.useRef(u),I=l!=null,L=Mx(l),U=Mx(o),$=Mx(c),K=g.useCallback(()=>{if(!P.current||!O.current)return;const N={placement:t,strategy:n,middleware:h};U.current&&(N.platform=U.current),kH(P.current,O.current,N).then(D=>{const z={...D,isPositioned:$.current!==!1};W.current&&!kg(M.current,z)&&(M.current=z,jr.flushSync(()=>{d(z)}))})},[h,t,n,U,$]);gm(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(N=>({...N,isPositioned:!1})))},[c]);const W=g.useRef(!1);gm(()=>(W.current=!0,()=>{W.current=!1}),[]),gm(()=>{if(C&&(P.current=C),_&&(O.current=_),C&&_){if(L.current)return L.current(C,_,K);K()}},[C,_,K,L,I]);const B=g.useMemo(()=>({reference:P,floating:O,setReference:w,setFloating:S}),[w,S]),A=g.useMemo(()=>({reference:C,floating:_}),[C,_]),R=g.useMemo(()=>{const N={position:n,left:0,top:0};if(!A.floating)return N;const D=QC(A.floating,u.x),z=QC(A.floating,u.y);return a?{...N,transform:"translate("+D+"px, "+z+"px)",...Vj(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:z}},[n,a,A.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:K,refs:B,elements:A,floatingStyles:R}),[u,K,B,A,R])}const CH=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ZC({element:r.current,padding:o}).fn(n):{}:r?ZC({element:r,padding:o}).fn(n):{}}}},_H=(e,t)=>({...vH(e),options:[e,t]}),PH=(e,t)=>({...yH(e),options:[e,t]}),NH=(e,t)=>({...SH(e),options:[e,t]}),TH=(e,t)=>({...xH(e),options:[e,t]}),OH=(e,t)=>({...bH(e),options:[e,t]}),MH=(e,t)=>({...wH(e),options:[e,t]}),jH=(e,t)=>({...CH(e),options:[e,t]});var RH="Arrow",Uj=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return f.jsx(Te.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});Uj.displayName=RH;var IH=Uj;function AH(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:h,children:p,...m}=d,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:x,children:p})}function u(d,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,DH(o,...t)]}function DH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function lS(e){const[t,n]=g.useState(void 0);return _n(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var cS="Popper",[Hj,wi]=AH(cS),[LH,Wj]=Hj(cS),Kj=e=>{const{__scopePopper:t,children:n}=e,[r,o]=g.useState(null);return f.jsx(LH,{scope:t,anchor:r,onAnchorChange:o,children:n})};Kj.displayName=cS;var Gj="PopperAnchor",qj=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=Wj(Gj,n),s=g.useRef(null),a=$e(t,s);return g.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:f.jsx(Te.div,{...o,ref:a})});qj.displayName=Gj;var uS="PopperContent",[FH,zH]=Hj(uS),Yj=g.forwardRef((e,t)=>{var Y,ce,Ee,fe,Ae,Ce;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...v}=e,x=Wj(uS,n),[b,w]=g.useState(null),S=$e(t,Ye=>w(Ye)),[C,_]=g.useState(null),P=lS(C),O=(P==null?void 0:P.width)??0,M=(P==null?void 0:P.height)??0,I=r+(i!=="center"?"-"+i:""),L=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(c)?c:[c],$=U.length>0,K={padding:L,boundary:U.filter(BH),altBoundary:$},{refs:W,floatingStyles:B,placement:A,isPositioned:R,middlewareData:N}=EH({strategy:"fixed",placement:I,whileElementsMounted:(...Ye)=>gH(...Ye,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[_H({mainAxis:o+M,alignmentAxis:s}),l&&PH({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?NH():void 0,...K}),l&&TH({...K}),OH({...K,apply:({elements:Ye,rects:pt,availableWidth:Wt,availableHeight:T})=>{const{width:k,height:E}=pt.reference,j=Ye.floating.style;j.setProperty("--radix-popper-available-width",`${Wt}px`),j.setProperty("--radix-popper-available-height",`${T}px`),j.setProperty("--radix-popper-anchor-width",`${k}px`),j.setProperty("--radix-popper-anchor-height",`${E}px`)}}),C&&jH({element:C,padding:a}),VH({arrowWidth:O,arrowHeight:M}),h&&MH({strategy:"referenceHidden",...K})]}),[D,z]=Zj(A),V=tn(m);_n(()=>{R&&(V==null||V())},[R,V]);const G=(Y=N.arrow)==null?void 0:Y.x,_e=(ce=N.arrow)==null?void 0:ce.y,Se=((Ee=N.arrow)==null?void 0:Ee.centerOffset)!==0,[Be,Z]=g.useState();return _n(()=>{b&&Z(window.getComputedStyle(b).zIndex)},[b]),f.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:R?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Be,"--radix-popper-transform-origin":[(fe=N.transformOrigin)==null?void 0:fe.x,(Ae=N.transformOrigin)==null?void 0:Ae.y].join(" "),...((Ce=N.hide)==null?void 0:Ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(FH,{scope:n,placedSide:D,onArrowChange:_,arrowX:G,arrowY:_e,shouldHideArrow:Se,children:f.jsx(Te.div,{"data-side":D,"data-align":z,...v,ref:S,style:{...v.style,animation:R?void 0:"none"}})})})});Yj.displayName=uS;var Jj="PopperArrow",$H={top:"bottom",right:"left",bottom:"top",left:"right"},Xj=g.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=zH(Jj,r),s=$H[i.placedSide];return f.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:f.jsx(IH,{...o,ref:n,style:{...o.style,display:"block"}})})});Xj.displayName=Jj;function BH(e){return e!==null}var VH=e=>({name:"transformOrigin",options:e,fn(t){var x,b,w;const{placement:n,rects:r,middlewareData:o}=t,s=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Zj(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((b=o.arrow)==null?void 0:b.x)??0)+a/2,p=(((w=o.arrow)==null?void 0:w.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=s?d:`${h}px`,v=`${-l}px`):c==="top"?(m=s?d:`${h}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=s?d:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=s?d:`${p}px`),{data:{x:m,y:v}}}});function Zj(e){const[t,n="center"]=e.split("-");return[t,n]}var Wh=Kj,Au=qj,Kh=Yj,Gh=Xj,UH="Portal",Du=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=g.useState(!1);_n(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?yz.createPortal(f.jsx(Te.div,{...r,ref:t}),s):null});Du.displayName=UH;function HH(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var an=e=>{const{present:t,children:n}=e,r=WH(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),i=$e(r.ref,KH(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:i}):null};an.displayName="Presence";function WH(e){const[t,n]=g.useState(),r=g.useRef({}),o=g.useRef(e),i=g.useRef("none"),s=e?"mounted":"unmounted",[a,l]=HH(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Up(r.current);i.current=a==="mounted"?c:"none"},[a]),_n(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=Up(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),_n(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const v=Up(r.current).includes(p.animationName);if(p.target===t&&v&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(i.current=Up(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Up(e){return(e==null?void 0:e.animationName)||"none"}function KH(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=GH({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=tn(n),l=g.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function GH({defaultProp:e,onChange:t}){const n=g.useState(e),[r]=n,o=g.useRef(r),i=tn(t);return g.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var qH="VisuallyHidden",dS=g.forwardRef((e,t)=>f.jsx(Te.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));dS.displayName=qH;var YH=dS,[Vv,jme]=ho("Tooltip",[wi]),Uv=wi(),Qj="TooltipProvider",JH=700,Nb="tooltip.open",[XH,fS]=Vv(Qj),eR=e=>{const{__scopeTooltip:t,delayDuration:n=JH,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=g.useState(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),f.jsx(XH,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};eR.displayName=Qj;var Hv="Tooltip",[ZH,qh]=Vv(Hv),tR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=fS(Hv,e.__scopeTooltip),c=Uv(t),[u,d]=g.useState(null),h=Ar(),p=g.useRef(0),m=s??l.disableHoverableContent,v=a??l.delayDuration,x=g.useRef(!1),[b=!1,w]=zr({prop:r,defaultProp:o,onChange:O=>{O?(l.onOpen(),document.dispatchEvent(new CustomEvent(Nb))):l.onClose(),i==null||i(O)}}),S=g.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,w(!0)},[w]),_=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),P=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,w(!0),p.current=0},v)},[v,w]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),f.jsx(Wh,{...c,children:f.jsx(ZH,{scope:t,contentId:h,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayed?P():C()},[l.isOpenDelayed,P,C]),onTriggerLeave:g.useCallback(()=>{m?_():(window.clearTimeout(p.current),p.current=0)},[_,m]),onOpen:C,onClose:_,disableHoverableContent:m,children:n})})};tR.displayName=Hv;var Tb="TooltipTrigger",hS=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=qh(Tb,n),i=fS(Tb,n),s=Uv(n),a=g.useRef(null),l=$e(t,a,o.onTriggerChange),c=g.useRef(!1),u=g.useRef(!1),d=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),f.jsx(Au,{asChild:!0,...s,children:f.jsx(Te.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ne(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ne(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:ne(e.onBlur,o.onClose),onClick:ne(e.onClick,o.onClose)})})});hS.displayName=Tb;var pS="TooltipPortal",[QH,eW]=Vv(pS,{forceMount:void 0}),nR=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=qh(pS,t);return f.jsx(QH,{scope:t,forceMount:n,children:f.jsx(an,{present:n||i.open,children:f.jsx(Du,{asChild:!0,container:o,children:r})})})};nR.displayName=pS;var hu="TooltipContent",rR=g.forwardRef((e,t)=>{const n=eW(hu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=qh(hu,e.__scopeTooltip);return f.jsx(an,{present:r||s.open,children:s.disableHoverableContent?f.jsx(oR,{side:o,...i,ref:t}):f.jsx(tW,{side:o,...i,ref:t})})}),tW=g.forwardRef((e,t)=>{const n=qh(hu,e.__scopeTooltip),r=fS(hu,e.__scopeTooltip),o=g.useRef(null),i=$e(t,o),[s,a]=g.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,h=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,v)=>{const x=m.currentTarget,b={x:m.clientX,y:m.clientY},w=iW(b,x.getBoundingClientRect()),S=sW(b,w),C=aW(v.getBoundingClientRect()),_=cW([...S,...C]);a(_),d(!0)},[d]);return g.useEffect(()=>()=>h(),[h]),g.useEffect(()=>{if(l&&u){const m=x=>p(x,u),v=x=>p(x,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,h]),g.useEffect(()=>{if(s){const m=v=>{const x=v.target,b={x:v.clientX,y:v.clientY},w=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!lW(b,s);w?h():S&&(h(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,s,c,h]),f.jsx(oR,{...e,ref:i})}),[nW,rW]=Vv(Hv,{isInside:!1}),oR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=qh(hu,n),c=Uv(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(Nb,u),()=>document.removeEventListener(Nb,u)),[u]),g.useEffect(()=>{if(l.trigger){const d=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),f.jsx(Hl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:f.jsxs(Kh,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(Oj,{children:r}),f.jsx(nW,{scope:n,isInside:!0,children:f.jsx(YH,{id:l.contentId,role:"tooltip",children:o||r})})]})})});rR.displayName=hu;var iR="TooltipArrow",oW=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Uv(n);return rW(iR,n).isInside?null:f.jsx(Gh,{...o,...r,ref:t})});oW.displayName=iR;function iW(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function sW(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function aW(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function lW(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function cW(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),uW(t)}function uW(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var dW=eR,fW=tR,hW=hS,sR=rR;function aR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=aR(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function lR(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=aR(e))&&(r&&(r+=" "),r+=t);return r}const mS="-",pW=e=>{const t=gW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(mS);return a[0]===""&&a.length!==1&&a.shift(),cR(a,t)||mW(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},cR=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?cR(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(mS);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},e_=/^\[(.+)\]$/,mW=e=>{if(e_.test(e)){const t=e_.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},gW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return yW(Object.entries(e.classGroups),n).forEach(([i,s])=>{Ob(s,r,i,t)}),r},Ob=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:t_(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(vW(o)){Ob(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Ob(s,t_(t,i),n,r)})})},t_=(e,t)=>{let n=e;return t.split(mS).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},vW=e=>e.isThemeGetter,yW=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,xW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},uR="!",bW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,d;for(let x=0;x<a.length;x++){let b=a[x];if(c===0){if(b===o&&(r||a.slice(x,x+i)===t)){l.push(a.slice(u,x)),u=x+i;continue}if(b==="/"){d=x;continue}}b==="["?c++:b==="]"&&c--}const h=l.length===0?a:a.substring(u),p=h.startsWith(uR),m=p?h.substring(1):h,v=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},wW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},SW=e=>({cache:xW(e.cacheSize),parseClassName:bW(e),...pW(e)}),kW=/\s+/,EW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(kW);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(c);let m=!!p,v=r(m?h.substring(0,p):h);if(!v){if(!m){a=c+(a.length>0?" "+a:a);continue}if(v=r(h),!v){a=c+(a.length>0?" "+a:a);continue}m=!1}const x=wW(u).join(":"),b=d?x+uR:x,w=b+v;if(i.includes(w))continue;i.push(w);const S=o(v,m);for(let C=0;C<S.length;++C){const _=S[C];i.push(b+_)}a=c+(a.length>0?" "+a:a)}return a};function CW(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=dR(t))&&(r&&(r+=" "),r+=n);return r}const dR=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=dR(e[r]))&&(n&&(n+=" "),n+=t);return n};function _W(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=SW(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=EW(l,n);return o(l,u),u}return function(){return i(CW.apply(null,arguments))}}const wt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},fR=/^\[(?:([a-z-]+):)?(.+)\]$/i,PW=/^\d+\/\d+$/,NW=new Set(["px","full","screen"]),TW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OW=/\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$/,MW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,jW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_i=e=>Vc(e)||NW.has(e)||PW.test(e),ks=e=>Lu(e,"length",BW),Vc=e=>!!e&&!Number.isNaN(Number(e)),jx=e=>Lu(e,"number",Vc),xd=e=>!!e&&Number.isInteger(Number(e)),IW=e=>e.endsWith("%")&&Vc(e.slice(0,-1)),Ve=e=>fR.test(e),Es=e=>TW.test(e),AW=new Set(["length","size","percentage"]),DW=e=>Lu(e,AW,hR),LW=e=>Lu(e,"position",hR),FW=new Set(["image","url"]),zW=e=>Lu(e,FW,UW),$W=e=>Lu(e,"",VW),bd=()=>!0,Lu=(e,t,n)=>{const r=fR.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},BW=e=>OW.test(e)&&!MW.test(e),hR=()=>!1,VW=e=>jW.test(e),UW=e=>RW.test(e),HW=()=>{const e=wt("colors"),t=wt("spacing"),n=wt("blur"),r=wt("brightness"),o=wt("borderColor"),i=wt("borderRadius"),s=wt("borderSpacing"),a=wt("borderWidth"),l=wt("contrast"),c=wt("grayscale"),u=wt("hueRotate"),d=wt("invert"),h=wt("gap"),p=wt("gradientColorStops"),m=wt("gradientColorStopPositions"),v=wt("inset"),x=wt("margin"),b=wt("opacity"),w=wt("padding"),S=wt("saturate"),C=wt("scale"),_=wt("sepia"),P=wt("skew"),O=wt("space"),M=wt("translate"),I=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",Ve,t],$=()=>[Ve,t],K=()=>["",_i,ks],W=()=>["auto",Vc,Ve],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],A=()=>["solid","dashed","dotted","double","none"],R=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",Ve],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[Vc,Ve];return{cacheSize:500,separator:":",theme:{colors:[bd],spacing:[_i,ks],blur:["none","",Es,Ve],brightness:V(),borderColor:[e],borderRadius:["none","","full",Es,Ve],borderSpacing:$(),borderWidth:K(),contrast:V(),grayscale:D(),hueRotate:V(),invert:D(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[IW,ks],inset:U(),margin:U(),opacity:V(),padding:$(),saturate:V(),scale:V(),sepia:D(),skew:V(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",Ve]}],container:["container"],columns:[{columns:[Es]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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"],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:[...B(),Ve]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xd,Ve]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ve]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",xd,Ve]}],"grid-cols":[{"grid-cols":[bd]}],"col-start-end":[{col:["auto",{span:["full",xd,Ve]},Ve]}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":[bd]}],"row-start-end":[{row:["auto",{span:[xd,Ve]},Ve]}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ve]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ve,t]}],"min-w":[{"min-w":[Ve,t,"min","max","fit"]}],"max-w":[{"max-w":[Ve,t,"none","full","min","max","fit","prose",{screen:[Es]},Es]}],h:[{h:[Ve,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ve,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ve,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ve,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Es,ks]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",jx]}],"font-family":[{font:[bd]}],"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:["tighter","tight","normal","wide","wider","widest",Ve]}],"line-clamp":[{"line-clamp":["none",Vc,jx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_i,Ve]}],"list-image":[{"list-image":["none",Ve]}],"list-style-type":[{list:["none","disc","decimal",Ve]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...A(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_i,ks]}],"underline-offset":[{"underline-offset":["auto",_i,Ve]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),LW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",DW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},zW]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...A(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:A()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...A()]}],"outline-offset":[{"outline-offset":[_i,Ve]}],"outline-w":[{outline:[_i,ks]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[_i,ks]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Es,$W]}],"shadow-color":[{shadow:[bd]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...R(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":R()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Es,Ve]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ve]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",Ve]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[xd,Ve]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ve]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",Ve]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",Ve]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_i,ks,jx]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},WW=_W(HW);function ze(...e){return WW(lR(e))}const KW=dW,pR=fW,GW=hW,gS=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(sR,{ref:r,sideOffset:t,className:ze("z-50 overflow-hidden rounded-md border bg-bg-primary-solid px-3 py-2 text-sm text-text-primary shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));gS.displayName=sR.displayName;const rt=ke.createContext(new Proxy({},{get:()=>{throw new Error("Cannot use ValContext outside of ValProvider")}}));function mR({children:e,client:t,dispatchValEvents:n}){var V,G,_e,Se,Be;const[r,o,i,s,a,l]=r9(t),c=g.useMemo(()=>new p9(t,(Z,Y)=>{n&&v9(Z,Y)}),[n]),u="data"in r&&r.data?r.data.config:void 0,d="error"in r?r.error:void 0,[h,p]=g.useState();g.useEffect(()=>{if(h===void 0||h===!0)if(l){const Z=setTimeout(()=>{p(l)},2e3);return()=>{clearTimeout(Z)}}else l||p(!1)},[l,h]);const[m,v]=g.useState(null);g.useEffect(()=>{try{const Z=localStorage.getItem("val-theme-"+((u==null?void 0:u.project)||"unknown"));if(Z)if(Z==="light"||Z==="dark")v(Z);else throw new Error(`Invalid Val theme: ${Z}`);else d&&v("dark")}catch(Z){console.error("Error getting theme from local storage",Z)}},[u,d]),g.useEffect(()=>{u!=null&&u.defaultTheme&&m===null?(u==null?void 0:u.defaultTheme)==="dark"||(u==null?void 0:u.defaultTheme)==="light"?v(u.defaultTheme):console.warn(`Invalid config default theme: ${u.defaultTheme}`):u!==void 0&&m===null&&v("dark")},[m,u]);const x=g.useRef(null),b="data"in r&&r.data?r.data.baseSha:void 0,[w,S]=g.useState([]),C=g.useRef(new Set);g.useEffect(()=>{"data"in r&&r.data&&S(Z=>{var Y,ce,Ee,fe,Ae,Ce;return(Y=r.data)!=null&&Y.deployments&&((ce=r.data.deployments)==null?void 0:ce.length)>0||(Ee=r.data)!=null&&Ee.commits&&((fe=r.data.commits)==null?void 0:fe.length)>0?y9(Z,((Ae=r.data)==null?void 0:Ae.commits)||[],((Ce=r.data)==null?void 0:Ce.deployments)||[]).filter(Ye=>!C.current.has(Ye.commitSha)):Z})},["data"in r&&((V=r.data)==null?void 0:V.deployments)&&((G=r.data)==null?void 0:G.deployments.length),"data"in r&&((_e=r.data)==null?void 0:_e.commits)&&((Se=r.data)==null?void 0:Se.commits.length)]);const _=g.useCallback(Z=>{S(Y=>Y.filter(ce=>ce.commitSha!==Z)),C.current.add(Z)},[]),[P,O]=g.useState(new Set);g.useEffect(()=>{var Z;"data"in r&&((Z=r.data)!=null&&Z.commitSha)&&O(Y=>{var Ee;if(((Ee=r.data)==null?void 0:Ee.commitSha)===void 0||Y.has(r.data.commitSha))return Y;const ce=new Set(Y);return ce.add(r.data.commitSha),ce})},["data"in r&&((Be=r.data)==null?void 0:Be.commitSha)]);const[M,I]=g.useState({status:"not-asked"}),[L,U]=g.useState(!1),$=g.useSyncExternalStore(c.subscribe("schema"),()=>c.getAllSchemasSnapshot(),()=>c.getAllSchemasSnapshot());g.useEffect(()=>{if($){const Z=$;let Y=!1;for(const ce of Object.values(Z))if(Od(ce)){Y=!0;break}U(Y)}},[$]),g.useEffect(()=>{let Z=0;function Y(){Z++,M.status!=="ready"&&Z<10&&t("/remote/settings","GET",{}).then(ce=>{ce.status===200?I({status:"ready",coreVersion:ce.json.coreVersion,buckets:ce.json.remoteFileBuckets.map(Ee=>Ee.bucket),publicProjectId:ce.json.publicProjectId}):("errorCode"in ce.json&&ce.json.errorCode?I({status:"inactive",reason:ce.json.errorCode,message:ce.json.message}):I({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(Y,5e3))}).catch(ce=>{console.error("Error getting remote settings",ce),I({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(Y,5e3)})}L&&(I({status:"loading"}),Y())},[L]);const K=g.useRef("not-initialized"),[W,B]=g.useState(!1),A=$u(c);g.useEffect(()=>{if(A===null&&K.current==="done"&&(K.current="not-initialized"),"data"in r&&r.data&&K.current==="not-initialized"){K.current="in-progress";let Z=null;const Y=async()=>{if("data"in r&&r.data){console.debug("ValSyncEngine init started...",r.data.profileId);const ce=await c.init(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now());console.debug("ValSyncEngine init result",ce),ce.status==="retry"?(K.current="retry",Z=setTimeout(Y,4e3)):(console.debug("Val is initialized!",ce),K.current="done",Z&&clearTimeout(Z),B(!0))}else throw K.current="not-initialized",Error("Unexpected state: init was started with stat.data but now it is not there")};return Y(),()=>{Z&&clearTimeout(Z)}}else"data"in r&&r.data&&K.current==="done"&&c.syncWithUpdatedStat(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now())},[r,c,A]),g.useEffect(()=>{if(!W)return;let Z=null;const Y=async()=>{if(A===null){B(!1),K.current="not-initialized";return}await c.sync(Date.now()),Z&&clearTimeout(Z),Z=setTimeout(Y,1e3)};return Y(),()=>{Z&&clearTimeout(Z)}},[c,A,W]);const[R,N]=g.useState({type:"not-asked"}),D=g.useSyncExternalStore(c.subscribe("pending-ops-count"),()=>c.getPendingOpsSnapshot(),()=>c.getPendingOpsSnapshot());g.useEffect(()=>{const Z=Y=>{D>0&&(Y.preventDefault(),Y.returnValue="")};return window.addEventListener("beforeunload",Z),()=>{window.removeEventListener("beforeunload",Z)}},[D]);const z=qW(t,i,l);return f.jsx(rt.Provider,{value:{client:t,publishSummaryState:R,setPublishSummaryState:N,syncEngine:c,profileId:"data"in r&&r.data?r.data.profileId:null,mode:"data"in r&&r.data?r.data.mode:"unknown",serviceUnavailable:h,baseSha:b,observedCommitShas:P,deployments:w,dismissDeployment:_,portalRef:x.current,authenticationState:i,theme:m,setTheme:Z=>{if(Z==="dark"||Z==="light"){try{localStorage.setItem("val-theme-"+((u==null?void 0:u.project)||"unknown"),Z),localStorage.setItem("val-theme-unknown",Z)}catch(Y){console.error("Error setting theme in local storage",Y)}v(Z)}else console.warn(`Cannot set invalid theme theme: ${Z}`)},config:u,profiles:"data"in z&&z.data?z.data:{},remoteFiles:M},children:f.jsx(KW,{children:f.jsxs(NM,{initialProps:{mode:"default"},children:[f.jsx("div",{"data-val-portal":"true",ref:x,...m?{"data-mode":m}:{}}),e]})})})}function qW(e,t,n){const r=g.useRef(!0),[o,i]=g.useState({status:"not-asked"}),s=g.useCallback(async()=>{i(l=>({status:"loading",data:"data"in l?l.data:void 0}));const a=await e("/profiles","GET",{});if(a.status===200){const l={};for(const c of a.json.profiles)l[c.profileId]={fullName:c.fullName,email:c.email,avatar:c.avatar};i({status:"done",data:l})}else console.error("Could not get profiles",a.json),r.current=!0,i(l=>({status:"error",data:"data"in l?l.data:void 0}))},[e,o]);return g.useEffect(()=>{r.current&&(r.current=!1,o.status==="error"?setTimeout(()=>s(),2e3):o.status==="not-asked"&&s())},[t,e,o,n]),o}function Gr(){return g.useContext(rt).portalRef}function Wv(){const{theme:e,setTheme:t}=g.useContext(rt);return{theme:e,setTheme:t}}function Fu(){const{config:e}=g.useContext(rt),t=g.useRef(e&&{...e,remoteHost:kC,appHost:hb,studioPrefix:"/val/~"});return g.useEffect(()=>{e&&(t.current={...e,remoteHost:kC,appHost:hb,studioPrefix:"/val/~"})},[e]),t.current}function vS(){const{remoteFiles:e}=g.useContext(rt);return e}function yS(){const{remoteFiles:e}=g.useContext(rt),[t,n]=g.useState(null);function r(o){return Math.floor(Math.random()*o)}return g.useEffect(()=>{e.status==="ready"&&e.buckets.length>0&&t===null&&n(e.buckets[r(e.buckets.length)])},[e]),t}function gR(){const{authenticationState:e}=g.useContext(rt);return e}function YW(){const{serviceUnavailable:e}=g.useContext(rt);return e===!0?"service-unavailable":"connected"}const n_=new TextEncoder,JW=y.object({patchId:y.string().refine(e=>e.length>0),filePath:y.string().refine(e=>e.length>0)});function On(e){const{syncEngine:t,client:n}=g.useContext(rt),[r,o]=X.splitModuleFilePathAndModulePath(e),i=g.useMemo(()=>X.createPatchPath(o),[o]),s=g.useCallback((p,m)=>{t.addPatch(r,m,p,Date.now())},[t,r]),a=g.useCallback((p,m,v)=>t.addPatchAwaitable(r,m,p,v,Date.now()),[t,r]),l=g.useCallback((p,m,v)=>{t.addPatch(p,v,m,Date.now())},[t]),c=g.useCallback(async()=>{let p=await n("/direct-file-upload-settings","POST",{}),m=0;for(;p.status===null&&m<5;)console.warn("Failed to get direct file upload settings, retrying...",p),await new Promise(v=>setTimeout(v,500*(m+1))),p=await n("/direct-file-upload-settings","POST",{}),m++;return p.status===200?{status:"success",data:p.json}:{status:"error",error:"Could not get direct file upload settings"}},[n]),u=g.useCallback(async(p,m,v,x,b,w,S)=>{const C=m?{"x-val-auth-nonce":m}:{},{filePath:_,value:P,metadata:O,remote:M}=w;let I;if(M){const $=X.remote.splitRemoteRef(_);if($.status==="error")return Promise.reject({status:"error",error:{message:`Could not create correct file path of remote file (${$.error}). This is most likely a Val bug.`}});I="/"+$.filePath}else I=_;const L=JSON.stringify({filePath:I,parentRef:v,data:P,type:b,metadata:O,remote:M}),U=n_.encode(L).length;return S(0,U),new Promise($=>{const K=new XMLHttpRequest;K.upload.addEventListener("progress",W=>{W.lengthComputable&&S(W.loaded,W.total)}),K.addEventListener("load",()=>{if(K.status>=200&&K.status<300)try{const W=K.responseText,B=JSON.parse(W),A=JW.safeParse(B);A.success?$({status:"done",patchId:A.data.patchId,filePath:A.data.filePath}):$({status:"error",error:{message:`While saving a file we got an unexpected response (${W==null?void 0:W.slice(0,100)}...)`}})}catch(W){$({status:"error",error:{message:`Got an exception while saving a file. Error: ${W instanceof Error?W.message:String(W)}`}})}else $({status:"error",error:{message:"Could not save patch file. HTTP error: "+K.status+" "+K.statusText}})}),K.addEventListener("error",()=>{$({status:"error",error:{message:"Could save source file (network error?)"}})}),K.addEventListener("abort",()=>{$({status:"error",error:{message:"Upload was aborted"}})}),K.responseType="text",K.open("POST",`${p}/patches/${x}/files`),K.setRequestHeader("Content-Type","application/json");for(const[W,B]of Object.entries(C))K.setRequestHeader(W,B);K.send(L)})},[]),d=g.useSyncExternalStore(t.subscribe("parent-ref"),()=>t.getParentRefSnapshot(),()=>t.getParentRefSnapshot()),h=g.useCallback(async(p,m,v,x)=>{if(d===null){v("Cannot upload files yet. Not initialized.");return}const b=await c();if(b.status!=="success"){v(b.error);return}const{baseUrl:w,nonce:S}=b.data,C=[],_=[];for(const I of p)I.op==="file"?(C.push(I),_.push({...I,value:typeof I.value=="string"?X.getSHA256Hash(n_.encode(I.value)):I.value})):_.push(I);const P=t.createPatchId();let O=0;for(const I of C){const L=await u(w,S,d,P,m,I,(U,$)=>{x(U,$,O,C.length)});if(L.status==="error"){v(L.error.message);return}O++}const M=await a(_,m,P);if(M.status!=="patch-synced"){v(M.message);return}},[c,a,u,d,t]);return{patchPath:i,addPatch:s,addAndUploadPatchWithFileOps:h,addModuleFilePatch:l}}function XW(){const{syncEngine:e}=g.useContext(rt);return{deletePatches:g.useCallback(n=>{const r=[];for(let o=0;o<n.length;o+=100)r.push(n.slice(o,o+100));for(const o of r)e.deletePatches(o,Date.now())},[e])}}function ZW(){const{deployments:e,dismissDeployment:t,observedCommitShas:n}=g.useContext(rt);return{deployments:e,dismissDeployment:t,observedCommitShas:n}}function QW(){const{syncEngine:e}=g.useContext(rt);return{status:"success",data:g.useSyncExternalStore(e.subscribe("patch-sets"),()=>e.getSerializedPatchSetsSnapshot(),()=>e.getSerializedPatchSetsSnapshot())}}function e7(){const{syncEngine:e}=g.useContext(rt),t=g.useSyncExternalStore(e.subscribe("all-patches"),()=>e.getAllPatchesSnapshot(),()=>e.getAllPatchesSnapshot()),n=Yh();return g.useMemo(()=>{const o=new Set;for(const i of n){const s=t[i];s!=null&&s.isCommitted&&o.add(i)}return o},[t,n])}function vR(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("global-server-side-patch-ids"),()=>e.getGlobalServerSidePatchIdsSnapshot(),()=>e.getGlobalServerSidePatchIdsSnapshot())}function yR(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("pending-client-side-patch-ids"),()=>e.getPendingClientSidePatchIdsSnapshot(),()=>e.getPendingClientSidePatchIdsSnapshot())}function Yh(){const{syncEngine:e}=g.useContext(rt),t=vR(),n=yR(),r=g.useSyncExternalStore(e.subscribe("saved-server-side-patch-ids"),()=>e.getSavedServerSidePatchIdsSnapshot(),()=>e.getSavedServerSidePatchIdsSnapshot());return g.useMemo(()=>{const i=new Set,s=[];for(const a of t)i.has(a)||s.push(a),i.add(a);for(const a of r)i.has(a)||s.push(a),i.add(a);for(const a of n)i.has(a)||s.push(a),i.add(a);return s},[t,n,r])}function zu(){const{mode:e}=g.useContext(rt);return e}function Kv(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("pending-ops-count"),()=>e.getPendingOpsSnapshot(),()=>e.getPendingOpsSnapshot())>0?"loading":"success"}const t7=y.union([y.object({type:y.literal("not-asked"),isGenerating:y.boolean().optional()}),y.object({type:y.literal("manual").or(y.literal("ai")),text:y.string(),patchIds:y.array(y.string()).nullable(),isGenerating:y.boolean()})]);function Jh(){const{syncEngine:e,client:t,publishSummaryState:n,setPublishSummaryState:r,config:o}=g.useContext(rt),i=Yh(),s=g.useSyncExternalStore(e.subscribe("publish-disabled"),()=>e.getPublishDisabledSnapshot(),()=>e.getPublishDisabledSnapshot()),[a,l]=g.useState(!1);g.useEffect(()=>{var m,v;((v=(m=o==null?void 0:o.ai)==null?void 0:m.commitMessages)==null?void 0:v.disabled)===void 0||o.ai.commitMessages.disabled===!1?l(!0):l(!1)},[o]),g.useEffect(()=>{if(n.type==="not-asked"){const m=r7(o==null?void 0:o.project);m&&m.type!=="not-asked"&&i.length>0&&r(m)}},[n,o==null?void 0:o.project,r]);const c=g.useCallback(async()=>{if(i===null)return{type:"error",message:"Empty patch set"};if("isGenerating"in n&&n.isGenerating)return{type:"error",message:"Already generating summary"};r(m=>({...m,isGenerating:!0}));try{const m=await t("/commit-summary","GET",{query:{patch_id:i}});return m.status===200?m.json.commitSummary?{type:"ai",text:m.json.commitSummary}:{type:"error",message:"Commit summary could not be generated"}:{type:"error",message:m.json.message}}finally{r(m=>({...m,isGenerating:!1}))}},[t,i,n]),[u,d]=g.useState(!1),h=g.useCallback(async m=>i===null?{status:"error",message:"No changes to publish"}:u?{status:"error",message:"Already publishing"}:(d(!0),e.publish(i,m,Date.now()).then(v=>(v.status==="done"&&(o7(o==null?void 0:o.project),r(x=>({type:"not-asked",isGenerating:x.isGenerating}))),v)).finally(()=>{d(!1)})),[i,u,o==null?void 0:o.project,e]),p=g.useCallback(m=>{r(v=>{let x;return m.type==="not-asked"?x={type:"not-asked",isGenerating:v.isGenerating}:x={type:m.type,text:m.text,patchIds:i,isGenerating:!!v.isGenerating},n7(x,o==null?void 0:o.project),x})},[i,r,o==null?void 0:o.project]);return{publish:h,publishDisabled:s,isPublishing:u,generateSummary:c,canGenerate:a,summary:n,setSummary:p}}function n7(e,t){try{localStorage.setItem("val-publish-summary-"+(t||"unknown"),JSON.stringify(e))}catch(n){console.error("Error setting publish summary in local storage",n)}return e}function r7(e){try{const t=localStorage.getItem("val-publish-summary-"+(e||"unknown"));if(t){const n=t7.safeParse(JSON.parse(t));if(n.success)return n.data;console.warn("Error parsing publish summary from local storage",n.error)}}catch(t){console.error("Error getting publish summary from local storage",t)}return null}function o7(e){try{localStorage.removeItem("val-publish-summary-"+(e||"unknown"))}catch(t){console.error("Error deleting publish summary from local storage",t)}}function i7(){const{profileId:e,profiles:t}=g.useContext(rt);return e?t[e]??null:null}const $u=e=>g.useSyncExternalStore(e.subscribe("initialized-at"),()=>e.getInitializedAtSnapshot(),()=>e.getInitializedAtSnapshot()).data;function xS(){const{syncEngine:e}=g.useContext(rt);return{autoPublish:g.useSyncExternalStore(e.subscribe("auto-publish"),()=>e.getAutoPublishSnapshot(),()=>e.getAutoPublishSnapshot()),setAutoPublish:n=>{e.setAutoPublish(Date.now(),n)}}}function xR(e){const{syncEngine:t}=g.useContext(rt),[n]=g.useMemo(()=>X.splitModuleFilePathAndModulePath(e),[e]),r=g.useSyncExternalStore(t.subscribe("preview",n),()=>t.getPreviewSnapshot(n),()=>t.getPreviewSnapshot(n)),o=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=$u(t);return g.useMemo(()=>{const s=o.status==="success"&&o.optimistic,a=r==null?void 0:r[e];return i===null||s?{status:"loading",data:a&&"data"in a?a==null?void 0:a.data:void 0}:a},[r,i,o,e])}function Dt(e){const{syncEngine:t}=g.useContext(rt),[n,r]=g.useMemo(()=>X.splitModuleFilePathAndModulePath(e),[e]),o=g.useSyncExternalStore(t.subscribe("schema"),()=>t.getSchemaSnapshot(n),()=>t.getSchemaSnapshot(n)),i=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),s=g.useMemo(()=>{var c;if(o.status!=="success")return o;if(i.status!=="success")return i;const l=(c=X.resolvePath(r,i.data,o.data))==null?void 0:c.schema;return l?{status:"success",data:l}:{status:"resolved-schema-not-found"}},[o,i,n,r]);return $u(t)===null?{status:"loading"}:s.status!=="success"?s.status==="resolved-schema-not-found"?{status:"not-found"}:s.status==="no-schemas"?{status:"error",error:"No schemas"}:s.status==="module-schema-not-found"?{status:"not-found"}:{status:"loading"}:s}function Xh(){const{syncEngine:e}=g.useContext(rt),t=g.useSyncExternalStore(e.subscribe("schema"),()=>e.getAllSchemasSnapshot(),()=>e.getAllSchemasSnapshot());if($u(e)===null)return{status:"loading"};if(t===null)return console.warn("Schemas: not found"),{status:"error",error:"Schemas not found"};const r={};for(const[o,i]of Object.entries(t)){const s=o;i&&(r[s]=i)}return{status:"success",data:r}}function s7(e){const{syncEngine:t}=g.useContext(rt);return g.useSyncExternalStore(t.subscribe("validation-error",e),()=>t.getValidationErrorSnapshot(e),()=>t.getValidationErrorSnapshot(e))||[]}function Da(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("all-validation-errors"),()=>e.getAllValidationErrorsSnapshot(),()=>e.getAllValidationErrorsSnapshot())}function a7(){const{syncEngine:e}=g.useContext(rt);return{globalTransientErrors:g.useSyncExternalStore(e.subscribe("global-transient-errors"),()=>e.getGlobalTransientErrorsSnapshot(),()=>e.getGlobalTransientErrorsSnapshot()),removeGlobalTransientErrors:n=>{e.removeGlobalTransientErrors(n)}}}function l7(){const{syncEngine:e,remoteFiles:t}=g.useContext(rt),n=g.useSyncExternalStore(e.subscribe("network-error"),()=>e.getNetworkErrorSnapshot(),()=>e.getNetworkErrorSnapshot());return n!==null?{type:"network-error",networkError:n}:t.status==="inactive"?{type:"remote-files-error",error:t.message}:null}function bS(){return{globalErrors:[],patchErrors:{},skippedPatches:{}}}function wS(){const{profiles:e}=g.useContext(rt);return e}function at(e,t){const{syncEngine:n}=g.useContext(rt),[r,o]=e?X.splitModuleFilePathAndModulePath(e):["",""],i=g.useSyncExternalStore(n.subscribe("source",r),()=>n.getSourceSnapshot(r),()=>n.getSourceSnapshot(r)),s=$u(n);return g.useMemo(()=>{if(s===null)return{status:"loading"};if(i.status==="success"){const l=i.data;return l!==void 0&&t!==void 0?c7(r,o,t,l,i.optimistic):{status:"not-found"}}return{status:"error",error:i.message||"Unknown error"}},[i,o,r,s,t])}function SS(){const{syncEngine:e}=g.useContext(rt);return g.useSyncExternalStore(e.subscribe("all-sources"),()=>e.getAllSourcesSnapshot(),()=>e.getAllSourcesSnapshot())}function kS(e){const{syncEngine:t}=g.useContext(rt),[n,r]=X.splitModuleFilePathAndModulePath(e),o=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=$u(t);return g.useMemo(()=>i===null?{status:"loading"}:o.status==="success"?bR(r,o.data):{status:"error",error:o.message||"Unknown error"},[o,i,r,n])}function bR(e,t){let n=t;if(t===void 0)return{status:"not-found"};for(const r of X.splitModulePath(e)){if(n===null)return{status:"error",error:`Expected object at ${e}, got null`};if(n===void 0)return{status:"error",error:`Expected object at ${e}, got undefined`};if(typeof n!="object")return{status:"error",error:`Expected object at ${e}, got ${JSON.stringify(n)}`};if(Ys(n)){const o=Number(r);if(Number.isNaN(o))return{status:"error",error:`Expected number at ${e}, got ${r}`};n=n[o]}else n=n[r]}return n===void 0?{status:"error",error:`Expected object at ${e}, got undefined`}:{status:"success",data:n}}function c7(e,t,n,r,o){const i=bR(t,r);if("data"in i&&i.data!==void 0){const s=u7(e,t,n,i.data);return s.status==="success"?{status:"success",data:s.data,clientSideOnly:o}:s}return i}function u7(e,t,n,r){if(r===null)return{status:"success",data:null};const o=n;if(o==="object"||o==="record"){if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Ys(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Rx(e,t,s);return{status:"success",data:i}}else if(o==="array"){if(typeof r!="object"||!Ys(r))return{status:"error",error:`Expected array, got ${typeof r}`};const i=[];for(let s=0;s<r.length;s++)i.push(Rx(e,t,s));return{status:"success",data:i}}else{if(o==="boolean")return typeof r!="boolean"&&r!==null?{status:"error",error:`Expected boolean, got ${typeof r}`}:{status:"success",data:r};if(o==="number")return typeof r!="number"&&r!==null?{status:"error",error:`Expected number, got ${typeof r}`}:{status:"success",data:r};if(o==="richtext")return typeof r!="object"||!Ys(r)?{status:"error",error:`Expected richtext (i.e. array), got ${typeof r}`}:{status:"success",data:r};if(o==="date"||o==="string"||o==="literal")return typeof r!="string"&&r!==null?{status:"error",error:`Expected string, got ${typeof r}: ${JSON.stringify(r)}`}:{status:"success",data:r};if(o==="file"||o==="image")return typeof r!="object"||!(vt in r)||r[vt]===void 0?{status:"error",error:`Expected object with ${vt} property, got ${typeof r}`}:"metadata"in r&&r.metatadata&&typeof r.metatadata!="object"?{status:"error",error:`Expected metadata of ${o} to be an object, got ${typeof r.metadata}`}:{status:"success",data:r};if(o==="keyOf")return typeof r!="string"?{status:"error",error:`Expected string, got ${typeof r}`}:{status:"success",data:r};if(o==="union"){if(typeof r=="string")return{status:"success",data:r};if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Ys(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Rx(e,t,s);return{status:"success",data:i}}else return{status:"error",error:`Unknown schema type: ${o}`}}}function Rx(e,t,n){return t?e+va+t+"."+JSON.stringify(n):e+va+n}var wR={exports:{}};/*!
|
|
52
52
|
Copyright (c) 2018 Jed Watson.
|
|
53
53
|
Licensed under the MIT License (MIT), see
|
|
54
54
|
http://jedwatson.github.io/classnames
|
|
@@ -426,7 +426,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
426
426
|
To pick up a draggable item, press the space bar.
|
|
427
427
|
While dragging, use the arrow keys to move the item.
|
|
428
428
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
429
|
-
`},Nq={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Tq(e){let{announcements:t=Nq,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Pq}=e;const{announce:i,announcement:s}=Eq(),a=ip("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),Cq(g.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:p}=d;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(d){let{active:h,over:p}=d;i(t.onDragOver({active:h,over:p}))},onDragEnd(d){let{active:h,over:p}=d;i(t.onDragEnd({active:h,over:p}))},onDragCancel(d){let{active:h,over:p}=d;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!l)return null;const u=ke.createElement(ke.Fragment,null,ke.createElement(Sq,{id:r,value:o.draggable}),ke.createElement(kq,{id:a,announcement:s}));return n?jr.createPortal(u,n):u}var en;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function jg(){}function Wx(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Oq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ko=Object.freeze({x:0,y:0});function JI(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function XI(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Mq(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function P_(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function ZI(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function N_(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const jq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=N_(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=JI(N_(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(XI)},Rq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=P_(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=P_(l),u=o.reduce((h,p,m)=>h+JI(c[m],p),0),d=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(XI)};function Iq(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const Aq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=Iq(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(Mq)};function Dq(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function QI(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ko}function Lq(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Fq=Lq(1);function zq(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function $q(e,t,n){const r=zq(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const Bq={ignoreTransform:!1};function Ku(e,t){t===void 0&&(t=Bq);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=yr(e).getComputedStyle(e);c&&(n=$q(n,c,u))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function T_(e){return Ku(e,{ignoreTransform:!0})}function Vq(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Uq(e,t){return t===void 0&&(t=yr(e).getComputedStyle(e)),t.position==="fixed"}function Hq(e,t){t===void 0&&(t=yr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function sy(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(KS(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!rp(o)||GI(o)||n.includes(o))return n;const i=yr(e).getComputedStyle(o);return o!==e&&Hq(o,i)&&n.push(o),Uq(o,i)?n:r(o.parentNode)}return e?r(e):n}function eA(e){const[t]=sy(e,1);return t??null}function Kx(e){return!iy||!e?null:Hu(e)?e:WS(e)?KS(e)||e===Wu(e).scrollingElement?window:rp(e)?e:null:null}function tA(e){return Hu(e)?e.scrollX:e.scrollLeft}function nA(e){return Hu(e)?e.scrollY:e.scrollTop}function zb(e){return{x:tA(e),y:nA(e)}}var dn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(dn||(dn={}));function rA(e){return!iy||!e?!1:e===document.scrollingElement}function oA(e){const t={x:0,y:0},n=rA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const Wq={x:.2,y:.2};function Kq(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Wq);const{isTop:c,isBottom:u,isLeft:d,isRight:h}=oA(e),p={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+v.height?(p.y=dn.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(p.y=dn.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&a>=t.right-v.width?(p.x=dn.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(p.x=dn.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:p,speed:m}}function Gq(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function iA(e){return e.reduce((t,n)=>Wc(t,zb(n)),Ko)}function qq(e){return e.reduce((t,n)=>t+tA(n),0)}function Yq(e){return e.reduce((t,n)=>t+nA(n),0)}function Jq(e,t){if(t===void 0&&(t=Ku),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);eA(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Xq=[["x",["left","right"],qq],["y",["top","bottom"],Yq]];class YS{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=sy(n),o=iA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of Xq)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Zq(e){const{EventTarget:t}=yr(e);return e instanceof t?e:Wu(e)}function Gx(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Xr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Xr||(Xr={}));function O_(e){e.preventDefault()}function Qq(e){e.stopPropagation()}var Ze;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ze||(Ze={}));const sA={start:[Ze.Space,Ze.Enter],cancel:[Ze.Esc],end:[Ze.Space,Ze.Enter,Ze.Tab]},eY=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ze.Right:return{...n,x:n.x+25};case Ze.Left:return{...n,x:n.x-25};case Ze.Down:return{...n,y:n.y+25};case Ze.Up:return{...n,y:n.y-25}}};class JS{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new hf(Wu(n)),this.windowListeners=new hf(yr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Xr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Jq(r),n(Ko)}handleKeyDown(t){if(qS(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=sA,coordinateGetter:s=eY,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Ko;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const h=ah(d,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const x=t.code,{isTop:b,isRight:w,isLeft:S,isBottom:C,maxScroll:_,minScroll:P}=oA(v),O=Gq(v),M={x:Math.min(x===Ze.Right?O.right-O.width/2:O.right,Math.max(x===Ze.Right?O.left:O.left+O.width/2,d.x)),y:Math.min(x===Ze.Down?O.bottom-O.height/2:O.bottom,Math.max(x===Ze.Down?O.top:O.top+O.height/2,d.y))},I=x===Ze.Right&&!w||x===Ze.Left&&!S,L=x===Ze.Down&&!C||x===Ze.Up&&!b;if(I&&M.x!==d.x){const U=v.scrollLeft+h.x,$=x===Ze.Right&&U<=_.x||x===Ze.Left&&U>=P.x;if($&&!h.y){v.scrollTo({left:U,behavior:a});return}$?p.x=v.scrollLeft-U:p.x=x===Ze.Right?v.scrollLeft-_.x:v.scrollLeft-P.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(L&&M.y!==d.y){const U=v.scrollTop+h.y,$=x===Ze.Down&&U<=_.y||x===Ze.Up&&U>=P.y;if($&&!h.x){v.scrollTo({top:U,behavior:a});return}$?p.y=v.scrollTop-U:p.y=x===Ze.Down?v.scrollTop-_.y:v.scrollTop-P.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,Wc(ah(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}JS.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=sA,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function M_(e){return!!(e&&"distance"in e)}function j_(e){return!!(e&&"delay"in e)}class XS{constructor(t,n,r){var o;r===void 0&&(r=Zq(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=Wu(s),this.documentListeners=new hf(this.document),this.listeners=new hf(r),this.windowListeners=new hf(yr(s)),this.initialCoordinates=(o=Fb(i))!=null?o:Ko,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.DragStart,O_),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),this.windowListeners.add(Xr.ContextMenu,O_),this.documentListeners.add(Xr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(j_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(M_(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Xr.Click,Qq,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=Fb(t))!=null?n:Ko,c=ah(o,l);if(!r&&a){if(M_(a)){if(a.tolerance!=null&&Gx(c,a.tolerance))return this.handleCancel();if(Gx(c,a.distance))return this.handleStart()}if(j_(a)&&Gx(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ze.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const tY={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class aA extends XS{constructor(t){const{event:n}=t,r=Wu(n.target);super(t,tY,r)}}aA.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const nY={move:{name:"mousemove"},end:{name:"mouseup"}};var $b;(function(e){e[e.RightClick=2]="RightClick"})($b||($b={}));class lA extends XS{constructor(t){super(t,nY,Wu(t.event.target))}}lA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===$b.RightClick?!1:(r==null||r({event:n}),!0)}}];const qx={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class cA extends XS{constructor(t){super(t,qx)}static setup(){return window.addEventListener(qx.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(qx.move.name,t)};function t(){}}}cA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var pf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(pf||(pf={}));var Rg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Rg||(Rg={}));function rY(e){let{acceleration:t,activator:n=pf.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Rg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:h}=e;const p=iY({delta:d,disabled:!i}),[m,v]=vq(),x=g.useRef({x:0,y:0}),b=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case pf.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case pf.DraggableRect:return o}},[n,o,l]),S=g.useRef(null),C=g.useCallback(()=>{const P=S.current;if(!P)return;const O=x.current.x*b.current.x,M=x.current.y*b.current.y;P.scrollBy(O,M)},[]),_=g.useMemo(()=>a===Rg.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const P of _){if((r==null?void 0:r(P))===!1)continue;const O=c.indexOf(P),M=u[O];if(!M)continue;const{direction:I,speed:L}=Kq(P,M,w,t,h);for(const U of["x","y"])p[U][I[U]]||(L[U]=0,I[U]=0);if(L.x>0||L.y>0){v(),S.current=P,m(C,s),x.current=L,b.current=I;return}}x.current={x:0,y:0},b.current={x:0,y:0},v()},[t,C,r,v,i,s,JSON.stringify(w),JSON.stringify(p),m,c,_,u,JSON.stringify(h)])}const oY={x:{[dn.Backward]:!1,[dn.Forward]:!1},y:{[dn.Backward]:!1,[dn.Forward]:!1}};function iY(e){let{delta:t,disabled:n}=e;const r=Lb(t);return op(o=>{if(n||!r||!o)return oY;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[dn.Backward]:o.x[dn.Backward]||i.x===-1,[dn.Forward]:o.x[dn.Forward]||i.x===1},y:{[dn.Backward]:o.y[dn.Backward]||i.y===-1,[dn.Forward]:o.y[dn.Forward]||i.y===1}}},[n,t,r])}function sY(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return op(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function aY(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var ch;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ch||(ch={}));var Bb;(function(e){e.Optimized="optimized"})(Bb||(Bb={}));const R_=new Map;function lY(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=g.useState(null),{frequency:a,measure:l,strategy:c}=o,u=g.useRef(e),d=x(),h=sh(d),p=g.useCallback(function(b){b===void 0&&(b=[]),!h.current&&s(w=>w===null?b:w.concat(b.filter(S=>!w.includes(S))))},[h]),m=g.useRef(null),v=op(b=>{if(d&&!n)return R_;if(!b||b===R_||u.current!==e||i!=null){const w=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const C=S.node.current,_=C?new YS(l(C),C):null;S.rect.current=_,_&&w.set(S.id,_)}return w}return b},[e,i,n,d,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{d||p()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,d,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:i!=null};function x(){switch(c){case ch.Always:return!1;case ch.BeforeDragging:return n;default:return!n}}}function uA(e,t){return op(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function cY(e,t){return uA(e,t)}function uY(e){let{callback:t,disabled:n}=e;const r=GS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function ay(e){let{callback:t,disabled:n}=e;const r=GS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function dY(e){return new YS(Ku(e),e)}function I_(e,t,n){t===void 0&&(t=dY);const[r,o]=g.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=uY({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=ay({callback:i});return mi(()=>{i(),e?(a==null||a.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[e]),r}function fY(e){const t=uA(e);return QI(e,t)}const A_=[];function hY(e){const t=g.useRef(e),n=op(r=>e?r&&r!==A_&&e&&t.current&&e.parentNode===t.current.parentNode?r:sy(e):A_,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function pY(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=Kx(i.target);s&&n(a=>a?(a.set(s,zb(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=Kx(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,zb(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const c=Kx(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Wc(i,s),Ko):iA(e):Ko,[e,t])}function D_(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==Ko;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ah(e,n.current):Ko}function mY(e){g.useEffect(()=>{if(!iy)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function gY(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function dA(e){return g.useMemo(()=>e?Vq(e):null,[e])}const L_=[];function vY(e,t){t===void 0&&(t=Ku);const[n]=e,r=dA(n?yr(n):null),[o,i]=g.useState(L_);function s(){i(()=>e.length?e.map(l=>rA(l)?r:new YS(t(l),l)):L_)}const a=ay({callback:s});return mi(()=>{a==null||a.disconnect(),s(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function yY(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return rp(t)?t:e}function xY(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(rp(u)){r(d=>{const h=t(u);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=ay({callback:o}),s=g.useCallback(c=>{const u=yY(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=Mg(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const bY=[{sensor:aA,options:{}},{sensor:JS,options:{}}],wY={current:{}},bm={draggable:{measure:T_},droppable:{measure:T_,strategy:ch.WhileDragging,frequency:Bb.Optimized},dragOverlay:{measure:Ku}};class mf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const SY={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:jg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bm,measureDroppableContainers:jg,windowRect:null,measuringScheduled:!1},kY={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:jg,draggableNodes:new Map,over:null,measureDroppableContainers:jg},ly=g.createContext(kY),fA=g.createContext(SY);function EY(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mf}}}function CY(e,t){switch(t.type){case en.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new mf(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new mf(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case en.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new mf(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function _Y(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(ly),i=Lb(r),s=Lb(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!qS(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=bq(u);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function PY(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function NY(e){return g.useMemo(()=>({draggable:{...bm.draggable,...e==null?void 0:e.draggable},droppable:{...bm.droppable,...e==null?void 0:e.droppable},dragOverlay:{...bm.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function TY(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=g.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;mi(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=QI(u,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=eA(c);h&&h.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const hA=g.createContext({...Ko,scaleX:1,scaleY:1});var Ds;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ds||(Ds={}));const OY=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=bY,collisionDetection:d=Aq,measuring:h,modifiers:p,...m}=t;const v=g.useReducer(CY,void 0,EY),[x,b]=v,[w,S]=_q(),[C,_]=g.useState(Ds.Uninitialized),P=C===Ds.Initialized,{draggable:{active:O,nodes:M,translate:I},droppable:{containers:L}}=x,U=O!=null?M.get(O):null,$=g.useRef({initial:null,translated:null}),K=g.useMemo(()=>{var jn;return O!=null?{id:O,data:(jn=U==null?void 0:U.data)!=null?jn:wY,rect:$}:null},[O,U]),W=g.useRef(null),[B,A]=g.useState(null),[R,N]=g.useState(null),D=sh(m,Object.values(m)),z=ip("DndDescribedBy",s),V=g.useMemo(()=>L.getEnabled(),[L]),G=NY(h),{droppableRects:_e,measureDroppableContainers:Se,measuringScheduled:Be}=lY(V,{dragging:P,dependencies:[I.x,I.y],config:G.droppable}),Z=sY(M,O),Y=g.useMemo(()=>R?Fb(R):null,[R]),ce=G3(),Ee=cY(Z,G.draggable.measure);TY({activeNode:O!=null?M.get(O):null,config:ce.layoutShiftCompensation,initialRect:Ee,measure:G.draggable.measure});const fe=I_(Z,G.draggable.measure,Ee),Ie=I_(Z?Z.parentElement:null),Ce=g.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:_e,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=L.getNodeFor((n=Ce.current.over)==null?void 0:n.id),pt=xY({measure:G.dragOverlay.measure}),Wt=(r=pt.nodeRef.current)!=null?r:Z,T=P?(o=pt.rect)!=null?o:fe:null,k=!!(pt.nodeRef.current&&pt.rect),E=fY(k?null:fe),j=dA(Wt?yr(Wt):null),F=hY(P?Ye??Z:null),J=vY(F),ee=PY(p,{transform:{x:I.x-E.x,y:I.y-E.y,scaleX:1,scaleY:1},activatorEvent:R,active:K,activeNodeRect:fe,containerNodeRect:Ie,draggingNodeRect:T,over:Ce.current.over,overlayNodeRect:pt.rect,scrollableAncestors:F,scrollableAncestorRects:J,windowRect:j}),Je=Y?Wc(Y,I):null,st=pY(F),yt=D_(st),ln=D_(st,[fe]),ct=Wc(ee,yt),yo=T?Fq(T,ee):null,ps=K&&yo?d({active:K,collisionRect:yo,droppableRects:_e,droppableContainers:V,pointerCoordinates:Je}):null,ed=ZI(ps,"id"),[ms,lE]=g.useState(null),V3=k?ee:Wc(ee,ln),U3=Dq(V3,(i=ms==null?void 0:ms.rect)!=null?i:null,fe),By=g.useRef(null),cE=g.useCallback((jn,br)=>{let{sensor:wr,options:gs}=br;if(W.current==null)return;const Yr=M.get(W.current);if(!Yr)return;const Sr=jn.nativeEvent,Xo=new wr({active:W.current,activeNode:Yr,event:Sr,options:gs,context:Ce,onAbort(yn){if(!M.get(yn))return;const{onDragAbort:Zo}=D.current,ki={id:yn};Zo==null||Zo(ki),w({type:"onDragAbort",event:ki})},onPending(yn,vs,Zo,ki){if(!M.get(yn))return;const{onDragPending:nd}=D.current,ys={id:yn,constraint:vs,initialCoordinates:Zo,offset:ki};nd==null||nd(ys),w({type:"onDragPending",event:ys})},onStart(yn){const vs=W.current;if(vs==null)return;const Zo=M.get(vs);if(!Zo)return;const{onDragStart:ki}=D.current,td={activatorEvent:Sr,active:{id:vs,data:Zo.data,rect:$}};jr.unstable_batchedUpdates(()=>{ki==null||ki(td),_(Ds.Initializing),b({type:en.DragStart,initialCoordinates:yn,active:vs}),w({type:"onDragStart",event:td}),A(By.current),N(Sr)})},onMove(yn){b({type:en.DragMove,coordinates:yn})},onEnd:Jl(en.DragEnd),onCancel:Jl(en.DragCancel)});By.current=Xo;function Jl(yn){return async function(){const{active:Zo,collisions:ki,over:td,scrollAdjustedTranslate:nd}=Ce.current;let ys=null;if(Zo&&nd){const{cancelDrop:rd}=D.current;ys={activatorEvent:Sr,active:Zo,collisions:ki,delta:nd,over:td},yn===en.DragEnd&&typeof rd=="function"&&await Promise.resolve(rd(ys))&&(yn=en.DragCancel)}W.current=null,jr.unstable_batchedUpdates(()=>{b({type:yn}),_(Ds.Uninitialized),lE(null),A(null),N(null),By.current=null;const rd=yn===en.DragEnd?"onDragEnd":"onDragCancel";if(ys){const Vy=D.current[rd];Vy==null||Vy(ys),w({type:rd,event:ys})}})}}},[M]),H3=g.useCallback((jn,br)=>(wr,gs)=>{const Yr=wr.nativeEvent,Sr=M.get(gs);if(W.current!==null||!Sr||Yr.dndKit||Yr.defaultPrevented)return;const Xo={active:Sr};jn(wr,br.options,Xo)===!0&&(Yr.dndKit={capturedBy:br.sensor},W.current=gs,cE(wr,br))},[M,cE]),uE=aY(u,H3);mY(u),mi(()=>{fe&&C===Ds.Initializing&&_(Ds.Initialized)},[fe,C]),g.useEffect(()=>{const{onDragMove:jn}=D.current,{active:br,activatorEvent:wr,collisions:gs,over:Yr}=Ce.current;if(!br||!wr)return;const Sr={active:br,activatorEvent:wr,collisions:gs,delta:{x:ct.x,y:ct.y},over:Yr};jr.unstable_batchedUpdates(()=>{jn==null||jn(Sr),w({type:"onDragMove",event:Sr})})},[ct.x,ct.y]),g.useEffect(()=>{const{active:jn,activatorEvent:br,collisions:wr,droppableContainers:gs,scrollAdjustedTranslate:Yr}=Ce.current;if(!jn||W.current==null||!br||!Yr)return;const{onDragOver:Sr}=D.current,Xo=gs.get(ed),Jl=Xo&&Xo.rect.current?{id:Xo.id,rect:Xo.rect.current,data:Xo.data,disabled:Xo.disabled}:null,yn={active:jn,activatorEvent:br,collisions:wr,delta:{x:Yr.x,y:Yr.y},over:Jl};jr.unstable_batchedUpdates(()=>{lE(Jl),Sr==null||Sr(yn),w({type:"onDragOver",event:yn})})},[ed]),mi(()=>{Ce.current={activatorEvent:R,active:K,activeNode:Z,collisionRect:yo,collisions:ps,droppableRects:_e,draggableNodes:M,draggingNode:Wt,draggingNodeRect:T,droppableContainers:L,over:ms,scrollableAncestors:F,scrollAdjustedTranslate:ct},$.current={initial:T,translated:yo}},[K,Z,ps,yo,M,Wt,T,_e,L,ms,F,ct]),rY({...ce,delta:I,draggingRect:yo,pointerCoordinates:Je,scrollableAncestors:F,scrollableAncestorRects:J});const W3=g.useMemo(()=>({active:K,activeNode:Z,activeNodeRect:fe,activatorEvent:R,collisions:ps,containerNodeRect:Ie,dragOverlay:pt,draggableNodes:M,droppableContainers:L,droppableRects:_e,over:ms,measureDroppableContainers:Se,scrollableAncestors:F,scrollableAncestorRects:J,measuringConfiguration:G,measuringScheduled:Be,windowRect:j}),[K,Z,fe,R,ps,Ie,pt,M,L,_e,ms,Se,F,J,G,Be,j]),K3=g.useMemo(()=>({activatorEvent:R,activators:uE,active:K,activeNodeRect:fe,ariaDescribedById:{draggable:z},dispatch:b,draggableNodes:M,over:ms,measureDroppableContainers:Se}),[R,uE,K,fe,b,z,M,ms,Se]);return ke.createElement(YI.Provider,{value:S},ke.createElement(ly.Provider,{value:K3},ke.createElement(fA.Provider,{value:W3},ke.createElement(hA.Provider,{value:U3},c)),ke.createElement(_Y,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ke.createElement(Tq,{...a,hiddenTextDescribedById:z}));function G3(){const jn=(B==null?void 0:B.autoScrollEnabled)===!1,br=typeof l=="object"?l.enabled===!1:l===!1,wr=P&&!jn&&!br;return typeof l=="object"?{...l,enabled:wr}:{enabled:wr}}}),MY=g.createContext(null),F_="button",jY="Draggable";function RY(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=ip(jY),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:h}=g.useContext(ly),{role:p=F_,roleDescription:m="draggable",tabIndex:v=0}=o??{},x=(l==null?void 0:l.id)===t,b=g.useContext(x?hA:MY),[w,S]=Mg(),[C,_]=Mg(),P=gY(s,t),O=sh(n);mi(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:C,data:O}),()=>{const I=d.get(t);I&&I.key===i&&d.delete(t)}),[d,t]);const M=g.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&p===F_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,v,x,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:M,isDragging:x,listeners:r?void 0:P,node:w,over:h,setNodeRef:S,setActivatorNodeRef:_,transform:b}}function IY(){return g.useContext(fA)}const AY="Droppable",DY={timeout:25};function LY(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=ip(AY),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(ly),u=g.useRef({disabled:n}),d=g.useRef(!1),h=g.useRef(null),p=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:x}={...DY,...o},b=sh(v??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),p.current=null},x)},[x]),S=ay({callback:w,disabled:m||!s}),C=g.useCallback((M,I)=>{S&&(I&&(S.unobserve(I),d.current=!1),M&&S.observe(M))},[S]),[_,P]=Mg(C),O=sh(t);return g.useEffect(()=>{!S||!_.current||(S.disconnect(),d.current=!1,S.observe(_.current))},[_,S]),g.useEffect(()=>(a({type:en.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:h,data:O}}),()=>a({type:en.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:en.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:h,isOver:(l==null?void 0:l.id)===r,node:_,over:l,setNodeRef:P}}function ZS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function FY(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Yp(e){return e!==null&&e>=0}function zY(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function $Y(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const pA=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=ZS(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Jp={scaleX:1,scaleY:1},BY=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...Jp}:null}const l=VY(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...Jp}:o<n&&o>=s?{x:0,y:a.height+l,...Jp}:{x:0,y:0,...Jp}};function VY(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const mA="Sortable",gA=ke.createContext({activeIndex:-1,containerId:mA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pA,disabled:{draggable:!1,droppable:!1}});function UY(e){let{children:t,id:n,items:r,strategy:o=pA,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=IY(),d=ip(mA,n),h=a.rect!==null,p=g.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),m=s!=null,v=s?p.indexOf(s.id):-1,x=c?p.indexOf(c.id):-1,b=g.useRef(p),w=!zY(p,b.current),S=x!==-1&&v===-1||w,C=$Y(i);mi(()=>{w&&m&&u(p)},[w,p,m,u]),g.useEffect(()=>{b.current=p},[p]);const _=g.useMemo(()=>({activeIndex:v,containerId:d,disabled:C,disableTransforms:S,items:p,overIndex:x,useDragOverlay:h,sortedRects:FY(p,l),strategy:o}),[v,d,C.draggable,C.droppable,S,p,x,l,h,o]);return ke.createElement(gA.Provider,{value:_},t)}const HY=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return ZS(n,r,o).indexOf(t)},WY=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},KY={duration:200,easing:"ease"},vA="transform",GY=lh.Transition.toString({property:vA,duration:0,easing:"linear"}),qY={roleDescription:"sortable"};function YY(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return mi(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=Ku(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),g.useEffect(()=>{i&&s(null)},[i]),i}function JY(e){let{animateLayoutChanges:t=WY,attributes:n,disabled:r,data:o,getNewIndex:i=HY,id:s,strategy:a,resizeObserverConfig:l,transition:c=KY}=e;const{items:u,containerId:d,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:v,overIndex:x,useDragOverlay:b,strategy:w}=g.useContext(gA),S=XY(r,p),C=u.indexOf(s),_=g.useMemo(()=>({sortable:{containerId:d,index:C,items:u},...o}),[d,o,C,u]),P=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:O,node:M,isOver:I,setNodeRef:L}=LY({id:s,data:_,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:U,activatorEvent:$,activeNodeRect:K,attributes:W,setNodeRef:B,listeners:A,isDragging:R,over:N,setActivatorNodeRef:D,transform:z}=RY({id:s,data:_,attributes:{...qY,...n},disabled:S.draggable}),V=gq(L,B),G=!!U,_e=G&&!m&&Yp(h)&&Yp(x),Se=!b&&R,Be=Se&&_e?z:null,Y=_e?Be??(a??w)({rects:v,activeNodeRect:K,activeIndex:h,overIndex:x,index:C}):null,ce=Yp(h)&&Yp(x)?i({id:s,items:u,activeIndex:h,overIndex:x}):C,Ee=U==null?void 0:U.id,fe=g.useRef({activeId:Ee,items:u,newIndex:ce,containerId:d}),Ie=u!==fe.current.items,Ce=t({active:U,containerId:d,isDragging:R,isSorting:G,id:s,index:C,items:u,newIndex:fe.current.newIndex,previousItems:fe.current.items,previousContainerId:fe.current.containerId,transition:c,wasDragging:fe.current.activeId!=null}),Ye=YY({disabled:!Ce,index:C,node:M,rect:O});return g.useEffect(()=>{G&&fe.current.newIndex!==ce&&(fe.current.newIndex=ce),d!==fe.current.containerId&&(fe.current.containerId=d),u!==fe.current.items&&(fe.current.items=u)},[G,ce,d,u]),g.useEffect(()=>{if(Ee===fe.current.activeId)return;if(Ee&&!fe.current.activeId){fe.current.activeId=Ee;return}const Wt=setTimeout(()=>{fe.current.activeId=Ee},50);return()=>clearTimeout(Wt)},[Ee]),{active:U,activeIndex:h,attributes:W,data:_,rect:O,index:C,newIndex:ce,items:u,isOver:I,isSorting:G,isDragging:R,listeners:A,node:M,overIndex:x,over:N,setNodeRef:V,setActivatorNodeRef:D,setDroppableNodeRef:L,setDraggableNodeRef:B,transform:Ye??Y,transition:pt()};function pt(){if(Ye||Ie&&fe.current.newIndex===C)return GY;if(!(Se&&!qS($)||!c)&&(G||Ce))return lh.Transition.toString({...c,property:vA})}}function XY(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Ig(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ZY=[Ze.Down,Ze.Right,Ze.Up,Ze.Left],QY=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(ZY.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case Ze.Down:r.top<h.top&&l.push(d);break;case Ze.Up:r.top>h.top&&l.push(d);break;case Ze.Left:r.left>h.left&&l.push(d);break;case Ze.Right:r.left<h.left&&l.push(d);break}});const c=Rq({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=ZI(c,"id");if(u===(s==null?void 0:s.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),h=i.get(u),p=h?o.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&d&&h){const x=sy(m).some((P,O)=>a[O]!==P),b=yA(d,h),w=eJ(d,h),S=x||!b?{x:0,y:0}:{x:w?r.width-p.width:0,y:w?r.height-p.height:0},C={x:p.left,y:p.top};return S.x&&S.y?C:ah(C,S)}}}};function yA(e,t){return!Ig(e)||!Ig(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function eJ(e,t){return!Ig(e)||!Ig(t)||!yA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Gu=g.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:ze("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Gu.displayName="Input";function $r({path:e}){const t=Da()||{},n=Mn(),r=[];for(const o in t)o.startsWith(e)&&r.push(...t[o].map(i=>({...i,path:o})));if(r.length===0)return null;if(r.length===1){const o=r[0];return f.jsxs("div",{className:"p-4 font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx("div",{children:o.message}),e!==o.path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at"," ",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(o.path)},children:o.path})]})]})}return f.jsx(US,{type:"single",collapsible:!0,children:f.jsxs(Gi,{value:"validation-errors",className:"font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx(la,{className:"p-4",children:f.jsxs("div",{className:"flex justify-between w-full",children:[f.jsx("span",{className:"truncate",children:"Multiple validation errors"}),f.jsxs("span",{className:"pr-4",children:["(",r.length,")"]})]})}),f.jsx(qi,{children:r.map(o=>f.jsxs("div",{className:"px-4",children:[f.jsx("div",{children:o.message}),e!==o.path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(o.path)},children:o.path})]})]},o.path))})]})})}function xA({path:e,autoFocus:t}){const n="string",r=Dt(e),o=kS(e),{patchPath:i,addPatch:s}=On(e),[a,l]=g.useState(null),c="data"in o&&o.data,u="clientSideOnly"in o&&o.clientSideOnly;return g.useEffect(()=>{u===!1&&l(typeof c=="string"?c:null)},[c,u]),r.status==="error"?f.jsx(Jt,{path:e,error:r.error,type:n}):o.status==="error"?f.jsx(nt,{path:e,error:o.error,type:n}):o.status=="not-found"||r.status==="not-found"?f.jsx(Pn,{path:e,type:n}):r.status==="loading"?f.jsx(gt,{path:e,type:n}):!("data"in o)||o.data===void 0?f.jsx(gt,{path:e,type:n}):r.data.type!==n?f.jsx(vr,{path:e,expectedType:n,actualType:r.data.type}):f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsxs("div",{className:"relative w-full",children:[f.jsx(Gu,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,value:a||"",onChange:d=>{l(d.target.value),s([{op:"replace",path:i,value:d.target.value}],n)}}),f.jsx("span",{className:ve("absolute right-0 -translate-x-full top-4 duration-1000",{"opacity-0":o.data===a,"opacity-100":o.data!==a}),children:f.jsx(co,{className:"transition-opacity animate-spin",size:12})})]})]})}function tJ({path:e}){const t=at(e,"string");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"string"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function nJ({path:e}){const t="boolean",n=Dt(e),r=at(e,t),{patchPath:o,addPatch:i}=On(e);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(Uu,{checked:a,onCheckedChange:()=>{let l=!1;n.data.opt?a===!0?l=null:a===null?l=!1:a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1):a===!0?l=!1:a==="indeterminate"||a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1),i([{op:"replace",path:o,value:l}],n.data.type)}})]})}function rJ({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=On(e);return typeof t!="boolean"&&t!==null?f.jsx(nt,{path:e,error:"Expected boolean",type:"boolean"}):f.jsx(Uu,{id:e,disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:i,value:!0}]:t===!1&&n?[{op:"replace",path:i,value:null}]:t===!1?[{op:"replace",path:i,value:!0}]:[{op:"replace",path:i,value:!1}],"boolean")}})}function oJ({path:e}){const t=at(e,"boolean");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"boolean"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):t.data===!0?f.jsx("div",{className:"flex items-center justify-center w-4 h-4 border rounded border-text-primary",children:f.jsx(Bu,{className:"w-3 h-3"})}):t.data===!1?f.jsx("div",{className:"w-4 h-4 border rounded border-text-primary"}):(console.warn("Unexpected value for boolean field",t.data),f.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function iJ({path:e}){const t="number",n=Dt(e),r=at(e,t),{patchPath:o,addPatch:i}=On(e);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(Gu,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}],t)}})]})}function sJ({path:e}){const t=at(e,"number");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"number"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}var aJ=[" ","Enter","ArrowUp","ArrowDown"],lJ=[" ","Enter"],sp="Select",[cy,uy,cJ]=ty(sp),[qu,zme]=ho(sp,[cJ,wi]),dy=wi(),[uJ,Fa]=qu(sp),[dJ,fJ]=qu(sp),bA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:h,required:p,form:m}=e,v=dy(t),[x,b]=g.useState(null),[w,S]=g.useState(null),[C,_]=g.useState(!1),P=Qh(c),[O=!1,M]=zr({prop:r,defaultProp:o,onChange:i}),[I,L]=zr({prop:s,defaultProp:a,onChange:l}),U=g.useRef(null),$=x?m||!!x.closest("form"):!0,[K,W]=g.useState(new Set),B=Array.from(K).map(A=>A.props.value).join(";");return f.jsx(Wh,{...v,children:f.jsxs(uJ,{required:p,scope:t,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:_,contentId:Ar(),value:I,onValueChange:L,open:O,onOpenChange:M,dir:P,triggerPointerDownPosRef:U,disabled:h,children:[f.jsx(cy.Provider,{scope:t,children:f.jsx(dJ,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(A=>{W(R=>new Set(R).add(A))},[]),onNativeOptionRemove:g.useCallback(A=>{W(R=>{const N=new Set(R);return N.delete(A),N})},[]),children:n})}),$?f.jsxs(UA,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:I,onChange:A=>L(A.target.value),disabled:h,form:m,children:[I===void 0?f.jsx("option",{value:""}):null,Array.from(K)]},B):null]})})};bA.displayName=sp;var wA="SelectTrigger",SA=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=dy(n),s=Fa(wA,n),a=s.disabled||r,l=$e(t,s.onTriggerChange),c=uy(n),u=g.useRef("touch"),[d,h,p]=HA(v=>{const x=c().filter(S=>!S.disabled),b=x.find(S=>S.value===s.value),w=WA(x,v,b);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),p()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return f.jsx(Au,{asChild:!0,...i,children:f.jsx(Te.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":VA(s.value)?"":void 0,...o,ref:l,onClick:ne(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:ne(o.onPointerDown,v=>{u.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:ne(o.onKeyDown,v=>{const x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(x&&v.key===" ")&&aJ.includes(v.key)&&(m(),v.preventDefault())})})})});SA.displayName=wA;var kA="SelectValue",EA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Fa(kA,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=$e(t,l.onValueNodeChange);return _n(()=>{c(u)},[c,u]),f.jsx(Te.span,{...a,ref:d,style:{pointerEvents:"none"},children:VA(l.value)?f.jsx(f.Fragment,{children:s}):i})});EA.displayName=kA;var hJ="SelectIcon",CA=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(Te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});CA.displayName=hJ;var pJ="SelectPortal",_A=e=>f.jsx(Du,{asChild:!0,...e});_A.displayName=pJ;var Ml="SelectContent",PA=g.forwardRef((e,t)=>{const n=Fa(Ml,e.__scopeSelect),[r,o]=g.useState();if(_n(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?jr.createPortal(f.jsx(NA,{scope:e.__scopeSelect,children:f.jsx(cy.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),i):null}return f.jsx(TA,{...e,ref:t})});PA.displayName=Ml;var Eo=10,[NA,za]=qu(Ml),mJ="SelectContentImpl",TA=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x,...b}=e,w=Fa(Ml,n),[S,C]=g.useState(null),[_,P]=g.useState(null),O=$e(t,Y=>C(Y)),[M,I]=g.useState(null),[L,U]=g.useState(null),$=uy(n),[K,W]=g.useState(!1),B=g.useRef(!1);g.useEffect(()=>{if(S)return Xv(S)},[S]),Jv();const A=g.useCallback(Y=>{const[ce,...Ee]=$().map(Ce=>Ce.ref.current),[fe]=Ee.slice(-1),Ie=document.activeElement;for(const Ce of Y)if(Ce===Ie||(Ce==null||Ce.scrollIntoView({block:"nearest"}),Ce===ce&&_&&(_.scrollTop=0),Ce===fe&&_&&(_.scrollTop=_.scrollHeight),Ce==null||Ce.focus(),document.activeElement!==Ie))return},[$,_]),R=g.useCallback(()=>A([M,S]),[A,M,S]);g.useEffect(()=>{K&&R()},[K,R]);const{onOpenChange:N,triggerPointerDownPosRef:D}=w;g.useEffect(()=>{if(S){let Y={x:0,y:0};const ce=fe=>{var Ie,Ce;Y={x:Math.abs(Math.round(fe.pageX)-(((Ie=D.current)==null?void 0:Ie.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((Ce=D.current)==null?void 0:Ce.y)??0))}},Ee=fe=>{Y.x<=10&&Y.y<=10?fe.preventDefault():S.contains(fe.target)||N(!1),document.removeEventListener("pointermove",ce),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[S,N,D]),g.useEffect(()=>{const Y=()=>N(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[N]);const[z,V]=HA(Y=>{const ce=$().filter(Ie=>!Ie.disabled),Ee=ce.find(Ie=>Ie.ref.current===document.activeElement),fe=WA(ce,Y,Ee);fe&&setTimeout(()=>fe.ref.current.focus())}),G=g.useCallback((Y,ce,Ee)=>{const fe=!B.current&&!Ee;(w.value!==void 0&&w.value===ce||fe)&&(I(Y),fe&&(B.current=!0))},[w.value]),_e=g.useCallback(()=>S==null?void 0:S.focus(),[S]),Se=g.useCallback((Y,ce,Ee)=>{const fe=!B.current&&!Ee;(w.value!==void 0&&w.value===ce||fe)&&U(Y)},[w.value]),Be=r==="popper"?Vb:OA,Z=Be===Vb?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x}:{};return f.jsx(NA,{scope:n,content:S,viewport:_,onViewportChange:P,itemRefCallback:G,selectedItem:M,onItemLeave:_e,itemTextRefCallback:Se,focusSelectedItem:R,selectedItemText:L,position:r,isPositioned:K,searchRef:z,children:f.jsx(tp,{as:ns,allowPinchZoom:!0,children:f.jsx(ep,{asChild:!0,trapped:w.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:ne(o,Y=>{var ce;(ce=w.trigger)==null||ce.focus({preventScroll:!0}),Y.preventDefault()}),children:f.jsx(Hl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:f.jsx(Be,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:Y=>Y.preventDefault(),...b,...Z,onPlaced:()=>W(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ne(b.onKeyDown,Y=>{const ce=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!ce&&Y.key.length===1&&V(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let fe=$().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const Ie=Y.target,Ce=fe.indexOf(Ie);fe=fe.slice(Ce+1)}setTimeout(()=>A(fe)),Y.preventDefault()}})})})})})})});TA.displayName=mJ;var gJ="SelectItemAlignedPosition",OA=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Fa(Ml,n),s=za(Ml,n),[a,l]=g.useState(null),[c,u]=g.useState(null),d=$e(t,O=>u(O)),h=uy(n),p=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=s,S=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&x&&b){const O=i.trigger.getBoundingClientRect(),M=c.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),L=b.getBoundingClientRect();if(i.dir!=="rtl"){const Ie=L.left-M.left,Ce=I.left-Ie,Ye=O.left-Ce,pt=O.width+Ye,Wt=Math.max(pt,M.width),T=window.innerWidth-Eo,k=Mb(Ce,[Eo,Math.max(Eo,T-Wt)]);a.style.minWidth=pt+"px",a.style.left=k+"px"}else{const Ie=M.right-L.right,Ce=window.innerWidth-I.right-Ie,Ye=window.innerWidth-O.right-Ce,pt=O.width+Ye,Wt=Math.max(pt,M.width),T=window.innerWidth-Eo,k=Mb(Ce,[Eo,Math.max(Eo,T-Wt)]);a.style.minWidth=pt+"px",a.style.right=k+"px"}const U=h(),$=window.innerHeight-Eo*2,K=v.scrollHeight,W=window.getComputedStyle(c),B=parseInt(W.borderTopWidth,10),A=parseInt(W.paddingTop,10),R=parseInt(W.borderBottomWidth,10),N=parseInt(W.paddingBottom,10),D=B+A+K+N+R,z=Math.min(x.offsetHeight*5,D),V=window.getComputedStyle(v),G=parseInt(V.paddingTop,10),_e=parseInt(V.paddingBottom,10),Se=O.top+O.height/2-Eo,Be=$-Se,Z=x.offsetHeight/2,Y=x.offsetTop+Z,ce=B+A+Y,Ee=D-ce;if(ce<=Se){const Ie=U.length>0&&x===U[U.length-1].ref.current;a.style.bottom="0px";const Ce=c.clientHeight-v.offsetTop-v.offsetHeight,Ye=Math.max(Be,Z+(Ie?_e:0)+Ce+R),pt=ce+Ye;a.style.height=pt+"px"}else{const Ie=U.length>0&&x===U[0].ref.current;a.style.top="0px";const Ye=Math.max(Se,B+v.offsetTop+(Ie?G:0)+Z)+Ee;a.style.height=Ye+"px",v.scrollTop=ce-Se+v.offsetTop}a.style.margin=`${Eo}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,a,c,v,x,b,i.dir,r]);_n(()=>S(),[S]);const[C,_]=g.useState();_n(()=>{c&&_(window.getComputedStyle(c).zIndex)},[c]);const P=g.useCallback(O=>{O&&m.current===!0&&(S(),w==null||w(),m.current=!1)},[S,w]);return f.jsx(yJ,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:f.jsx(Te.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});OA.displayName=gJ;var vJ="SelectPopperPosition",Vb=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Eo,...i}=e,s=dy(n);return f.jsx(Kh,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Vb.displayName=vJ;var[yJ,QS]=qu(Ml,{}),Ub="SelectViewport",MA=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=za(Ub,n),s=QS(Ub,n),a=$e(t,i.onViewportChange),l=g.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(cy.Slot,{scope:n,children:f.jsx(Te.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ne(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&d){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-Eo*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),b=Math.max(v,x);if(b<m){const w=b+p,S=Math.min(m,w),C=w-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=C>0?C:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});MA.displayName=Ub;var jA="SelectGroup",[xJ,bJ]=qu(jA),wJ=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ar();return f.jsx(xJ,{scope:n,id:o,children:f.jsx(Te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});wJ.displayName=jA;var RA="SelectLabel",IA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=bJ(RA,n);return f.jsx(Te.div,{id:o.id,...r,ref:t})});IA.displayName=RA;var Ag="SelectItem",[SJ,AA]=qu(Ag),DA=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Fa(Ag,n),l=za(Ag,n),c=a.value===r,[u,d]=g.useState(i??""),[h,p]=g.useState(!1),m=$e(t,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,r,o)}),v=Ar(),x=g.useRef("touch"),b=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(SJ,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{d(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:f.jsx(cy.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(Te.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:ne(s.onFocus,()=>p(!0)),onBlur:ne(s.onBlur,()=>p(!1)),onClick:ne(s.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:ne(s.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:ne(s.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:ne(s.onPointerMove,w=>{var S;x.current=w.pointerType,o?(S=l.onItemLeave)==null||S.call(l):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ne(s.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ne(s.onKeyDown,w=>{var C;((C=l.searchRef)==null?void 0:C.current)!==""&&w.key===" "||(lJ.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});DA.displayName=Ag;var Md="SelectItemText",LA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Fa(Md,n),a=za(Md,n),l=AA(Md,n),c=fJ(Md,n),[u,d]=g.useState(null),h=$e(t,b=>d(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,b,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=g.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=c;return _n(()=>(v(m),()=>x(m)),[v,x,m]),f.jsxs(f.Fragment,{children:[f.jsx(Te.span,{id:l.textId,...i,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?jr.createPortal(i.children,s.valueNode):null]})});LA.displayName=Md;var FA="SelectItemIndicator",zA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return AA(FA,n).isSelected?f.jsx(Te.span,{"aria-hidden":!0,...r,ref:t}):null});zA.displayName=FA;var Hb="SelectScrollUpButton",kJ=g.forwardRef((e,t)=>{const n=za(Hb,e.__scopeSelect),r=QS(Hb,e.__scopeSelect),[o,i]=g.useState(!1),s=$e(t,r.onScrollButtonChange);return _n(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx($A,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});kJ.displayName=Hb;var Wb="SelectScrollDownButton",EJ=g.forwardRef((e,t)=>{const n=za(Wb,e.__scopeSelect),r=QS(Wb,e.__scopeSelect),[o,i]=g.useState(!1),s=$e(t,r.onScrollButtonChange);return _n(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx($A,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});EJ.displayName=Wb;var $A=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=za("SelectScrollButton",n),s=g.useRef(null),a=uy(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),_n(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),f.jsx(Te.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ne(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:ne(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:ne(o.onPointerLeave,()=>{l()})})}),CJ="SelectSeparator",BA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(Te.div,{"aria-hidden":!0,...r,ref:t})});BA.displayName=CJ;var Kb="SelectArrow",_J=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=dy(n),i=Fa(Kb,n),s=za(Kb,n);return i.open&&s.position==="popper"?f.jsx(Gh,{...o,...r,ref:t}):null});_J.displayName=Kb;function VA(e){return e===""||e===void 0}var UA=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=$e(t,o),s=MS(n);return g.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const d=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(d)}},[s,n]),f.jsx(dS,{asChild:!0,children:f.jsx("select",{...r,ref:i,defaultValue:n})})});UA.displayName="BubbleSelect";function HA(e){const t=tn(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function WA(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=PJ(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function PJ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var KA=bA,ek=SA,NJ=EA,TJ=CA,OJ=_A,tk=PA,GA=MA,qA=IA,nk=DA,YA=LA,MJ=zA,JA=BA;const rk=KA,ok=NJ,fy=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(ek,{ref:r,className:ze("flex h-10 m-1 w-[calc(100%-8px)] items-center justify-between rounded-md border border-input bg-bg-primary px-3 py-2 text-sm ring-offset-background placeholder:text-fg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,f.jsx(TJ,{asChild:!0,children:f.jsx(Zh,{className:"w-4 h-4 opacity-50"})})]}));fy.displayName=ek.displayName;const hy=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>f.jsx(OJ,{container:r,children:f.jsx(tk,{ref:i,className:ze("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-primary text-text-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:f.jsx(GA,{className:ze("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));hy.displayName=tk.displayName;const jJ=g.forwardRef(({className:e,...t},n)=>f.jsx(qA,{ref:n,className:ze("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));jJ.displayName=qA.displayName;const py=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(nk,{ref:r,className:ze("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-text-primary outline-none focus:bg-bg-brand-primary_alt focus:text-text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(MJ,{children:f.jsx(Bu,{className:"w-4 h-4"})})}),f.jsx(YA,{children:t})]}));py.displayName=nk.displayName;const RJ=g.forwardRef(({className:e,...t},n)=>f.jsx(JA,{ref:n,className:ze("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));RJ.displayName=JA.displayName;function vu(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,vu(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?vu(e.items[0]):e.key.value;if(e.type==="date")return us(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}function ca(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function IJ(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function AJ({children:e}){return f.jsx("div",{children:IJ(e)})}function XA(e){const[t,n]=X.splitModuleFilePathAndModulePath(e),r=X.joinModuleFilePathAndModulePath(t,X.splitModulePath(n).slice(0,-1).join(".")),o=Dt(r);return{path:r,schema:"data"in o?o.data:void 0}}const z_=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",DJ=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",LJ=e=>(e==null?void 0:e.type)==="record",FJ=e=>(e==null?void 0:e.type)==="array";function zJ(e,t,n,r){if(!t[n])return console.error(`Get keysOf Source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,d)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof d=="string"&&d===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(B_(d)||ZA(d))for(const p in d){const m=d==null?void 0:d[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l($_(c,p),v,m)}}else if(u.type==="array"){if($J(d)){let p=0;for(const m of d)l($_(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&B_(d)){const m=d[p];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[p];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,d)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function $_(e,t){return e.includes(va)?`${e}.${JSON.stringify(t)}`:`${e}${va}${JSON.stringify(t)}`}function B_(e){return ZA(e)}function ZA(e){return typeof e=="object"&&!!e&&!Ys(e)}function $J(e){return typeof e=="object"&&!!e&&Ys(e)}function BJ({path:e,disabled:t}){const[n,r]=X.splitModuleFilePathAndModulePath(e),o=X.splitModuleFilePath(n),i=X.splitModulePath(r),{navigate:s}=Mn();return f.jsxs("div",{className:"w-full",children:[f.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>f.jsxs(g.Fragment,{children:[l===0&&f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:ve({"text-muted":!(i.length===0&&l===o.length-1)}),children:pu(a)}),l>0&&l<o.length-1&&f.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),f.jsx("button",{type:"button",disabled:t,title:X.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(X.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:ve({"text-muted":l===i.length-2}),children:pu(a)})]},`${a}-${l}`))})]})}function QA({path:e,variant:t}){const n=Dt(e),{path:r,schema:o}=XA(e),i=e2(e),s=i[i.length-1],a=WJ(r,z_(e,r,o)?s==null?void 0:s.part:void 0);return f.jsxs("span",{className:"inline-flex items-center gap-2",children:[z_(e,r,o)&&f.jsxs(f.Fragment,{children:[f.jsx(V_,{refs:a,variant:t}),f.jsx(HJ,{defaultValue:s.text,path:e,parentPath:r,variant:t,refs:a}),f.jsx(UJ,{path:e,parentPath:r,variant:t,refs:a})]}),FJ("data"in n?n.data:void 0)&&f.jsx(VJ,{path:e,variant:t}),LJ("data"in n?n.data:void 0)&&f.jsxs(f.Fragment,{children:[f.jsx(V_,{refs:a,variant:t}),f.jsx(KJ,{path:e,variant:t})]})]})}function V_({refs:e,variant:t}){const n=Gr();return e.length===0?null:f.jsxs(ss,{children:[f.jsxs(fl,{children:[f.jsx(Hc,{children:f.jsx(_t,{asChild:!0,size:ap(t),variant:lp(t),children:f.jsx(Vu,{children:f.jsx(MR,{size:my(t)})})})}),f.jsx(hl,{side:"top",children:"References to this record"})]}),f.jsx(pi,{container:n,children:f.jsx("div",{className:"text-sm",children:f.jsx("ul",{children:e.map(r=>{const[o,i]=X.splitModuleFilePathAndModulePath(r),s=X.createPatchPath(i);return f.jsx("li",{children:f.jsx(oy,{moduleFilePath:o,patchPath:s})},r)})})})})]})}function my(e){return e==="module"?16:12}function ap(e){return"icon"}function lp(e){return e==="module"?"outline":"ghost"}function VJ({path:e,variant:t}){const{navigate:n}=Mn(),{addPatch:r,patchPath:o}=On(e),i=Dt(e),s=at(e,"array"),[a]=X.splitModuleFilePathAndModulePath(e);if(!("data"in s)||!s.data||!("data"in i))return null;const l=i.data;if(l.type!=="array")return console.error("Cannot add to non-array",s,{parentPath:e}),null;const c=s.data.length;return f.jsx(_t,{title:"Add",size:ap(t),variant:lp(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:vu(l.item)}],l.type),l.item.type!=="string"&&n(X.joinModuleFilePathAndModulePath(a,X.patchPathToModulePath(u)))},children:f.jsx(TR,{size:my(t)})})}function UJ({path:e,parentPath:t,variant:n,refs:r}){const{navigate:o}=Mn(),{addPatch:i,patchPath:s}=On(e),a=at(t,"record");return!("data"in a)||a.data===void 0||a.data===null?(console.error("Parent source not found",a,{path:e}),null):f.jsxs(fl,{children:[f.jsx(Hc,{children:f.jsx(_t,{size:ap(n),variant:lp(n),disabled:r.length>0,onClick:()=>{i([{op:"remove",path:s}],"record"),o(t)},children:f.jsx(q7,{size:my(n)})})}),f.jsx(hl,{side:"top",children:r.length>0?f.jsxs("div",{children:[f.jsx("p",{children:"Cannot delete record."}),f.jsxs("p",{children:["You must change the following references"," ",f.jsx(MR,{size:10,className:"inline"})," to be able to delete:"]}),f.jsx("ul",{children:r.map(l=>f.jsx("li",{children:f.jsx(BJ,{path:l})},l))})]}):f.jsx("p",{children:"Delete record"})})]})}function HJ({defaultValue:e,path:t,parentPath:n,variant:r,refs:o}){const[i,s]=X.splitModuleFilePathAndModulePath(n),{navigate:a}=Mn(),{addPatch:l,addModuleFilePatch:c}=On(t),u=at(n,"record"),[d,h]=g.useState(e),[p,m]=g.useState(!1),v=Gr();g.useEffect(()=>{const w=S=>{S.key==="Escape"&&m(!1)};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}},[]);const x=X.createPatchPath(s);if(!("data"in u)||u.data===void 0||u.data===null)return console.error("Parent source not found",u,{path:t}),null;const b=d===e||d===""||d in u.data;return f.jsxs(ss,{open:p,children:[f.jsxs(fl,{children:[f.jsx(Hc,{children:f.jsx(_t,{asChild:!0,size:ap(r),variant:lp(r),children:f.jsx(Vu,{onClick:()=>{m(!0)},children:f.jsx(V7,{size:16})})})}),f.jsx(hl,{side:"top",children:"Change name"})]}),f.jsx(pi,{container:v,className:"text-text-primary",children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:w=>{w.preventDefault();const S=[{op:"move",from:x.concat(e),path:x.concat(d)}];l(S,"record");for(const C of o){const[_,P]=X.splitModuleFilePathAndModulePath(C),O=X.createPatchPath(P);c(_,[{op:"replace",path:O,value:d}],"record")}a(X.joinModuleFilePathAndModulePath(i,X.patchPathToModulePath(x.concat(d))),{replace:!0}),m(!1)},children:[f.jsx(Gu,{type:"text",value:d,onChange:w=>{h(w.target.value)}}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(_t,{disabled:b,variant:"outline",type:"submit",children:"Update"}),f.jsx(_t,{variant:"ghost",type:"reset",onClick:()=>{m(!1),h(e)},children:"Cancel"})]})]})})]})}function WJ(e,t){const n=Xh(),r=Kv(),o=SS();return g.useMemo(()=>"data"in n&&n.data!==void 0&&n.data[e]!==void 0?zJ(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}function KJ({path:e,variant:t}){const n=at(e,"record"),r=Dt(e),o=Gr(),{addPatch:i}=On(e),[s,a]=g.useState(""),{navigate:l}=Mn(),[c,u]=g.useState(!1);if(g.useEffect(()=>{const v=x=>{x.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}},[]),!("data"in n)||n.data===void 0||n.data===null)return console.error("Source not found",n,{path:e}),null;if(!("data"in r)||r.data===void 0)return console.error("Schema not found",n,{path:e}),null;const d=r.data;if(d.type!=="record")return console.error("Schema is not a record",r,{path:e}),null;const h=s===""||s in n.data,[p,m]=X.splitModuleFilePathAndModulePath(e);return f.jsxs(ss,{open:c,children:[f.jsx(_t,{asChild:!0,size:ap(t),variant:lp(t),children:f.jsx(Vu,{onClick:()=>{u(!0)},title:"Add",children:f.jsx(TR,{size:my(t)})})}),f.jsx(pi,{container:o,children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{v.preventDefault();const x=X.createPatchPath(m).concat(s);i([{op:"add",path:x,value:vu(d.item)}],"record"),l(X.joinModuleFilePathAndModulePath(p,X.patchPathToModulePath(x))),u(!1)},children:[f.jsx(Gu,{autoFocus:!0,value:s,onChange:v=>{a(v.target.value)}}),f.jsx("div",{children:f.jsx(_t,{type:"submit",disabled:h,variant:"outline",children:"Add"})})]})})]})}function e2(e){const[t,n]=X.splitModuleFilePathAndModulePath(e),r=X.splitModuleFilePath(t).map(a=>({text:pu(a),part:a,sourcePath:t}));if(!n)return r;const o=X.splitModulePath(n),i=[];let s="";for(let a=0;a<o.length;a++){let l=(s?s+".":"")+JSON.stringify(o[a]);n.startsWith(l)||(l=(s?s+".":"")+o[a]),s=l,i.push({text:o[a],part:o[a],sourcePath:X.joinModuleFilePathAndModulePath(t,l)})}return r.concat(i)}function t2({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var S,C;const s=Kv(),a=s7(n),{patchPath:l,addPatch:c}=On(n),u=Dt(n),d=at(n,o),[h,p]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var _,P;"data"in d&&d.data===null&&"data"in u&&!u.data.opt&&(((_=u.data)==null?void 0:_.type)==="image"||((P=u.data)==null?void 0:P.type)==="file")&&v(!0)},[d,u]);const x="data"in d?d.data:void 0,b="data"in u&&((S=u.data)==null?void 0:S.type)==="boolean",w="data"in u&&((C=u.data)==null?void 0:C.opt)===!0;return f.jsxs("div",{className:ve("p-4 border rounded-lg",{"bg-bg-tertiary":!r,"border-border-error":a.length>0}),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[!b&&w&&f.jsx(Uu,{disabled:s==="loading",checked:x!==null||m,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&x===null?v(!0):c(x===null?[{op:"replace",path:l,value:vu({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}],u.data.type)}}),b&&f.jsx(rJ,{path:n,isNullable:w,loadingStatus:s,source:x}),typeof e=="string"&&f.jsx(AJ,{children:e}),e&&typeof e!="string"&&e]}),f.jsxs("div",{className:"flex items-center gap-2",children:[x!==null&&f.jsx(QA,{path:n,variant:"field"}),x!==null&&!b&&f.jsxs("button",{onClick:()=>p(_=>!_),className:ve("transform transition-transform",{"rotate-180":h}),children:[i==="1"&&f.jsx(Zh,{size:16}),i==="2"&&f.jsx(y7,{size:16})]})]})]}),!b&&f.jsx(pl,{type:"single",collapsible:!0,value:h&&(x!==null||m)?"open":"closed",children:f.jsx(Gi,{value:"open",className:"w-full border-b-0",children:f.jsx(qi,{children:t})})})]})}function GJ({path:e}){const t="object",n=Dt(e),r=at(e,t);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=ca(e,i);return f.jsx(t2,{label:i,path:a,type:s.type,children:f.jsx(zy,{path:a,schema:s},a)},a)})})]})}function qJ({path:e}){const t="object",n=Dt(e);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.data.type!=="object")return f.jsx(vr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return f.jsx(n2,{path:e,schema:r})}function n2({path:e,schema:t}){return f.jsx("div",{id:e,className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=ca(e,n);return f.jsx(YJ,{label:n,children:f.jsx(tE,{path:r})},n)})})}function YJ({label:e,children:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flex whitespace-nowrap text-fg-quinary",children:ff(e)}),t]})}function Gb(e){return typeof e.key!="string"}function JJ({path:e}){const t="union",n=Dt(e),r=at(e,t);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(Gb(n.data))return typeof o!="string"&&o!==null?f.jsx(nt,{path:e,error:"Expected source to be a string, but found: "+typeof o,type:t}):f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(ZJ,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(i=>(i==null?void 0:i.type)==="literal"?[i.value]:(console.warn("Unexpected item in string union",i),[]))})]});if(!Gb(n.data))return typeof o!="object"?f.jsx(nt,{path:e,error:"Expected source to be an object, but found: "+typeof o,type:t}):Array.isArray(o)?f.jsx(nt,{path:e,error:"Expected source to be an object, but found an array",type:t}):f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(XJ,{path:e,schema:n.data})]})}function XJ({path:e,schema:t}){const n=kS(e),{addPatch:r,patchPath:o}=On(e),i=Gr(),s=ca(e,t.key),a=at(s,"literal");if(!("data"in a)||a.data===void 0)return f.jsx(gt,{path:e,type:"union"});const l=t.items.find(d=>{var p;const h=(p=d.items)==null?void 0:p[t.key];return h.type==="literal"?h.value===a.data:(console.error("Expected literal schema in object union",h),!1)});if((l==null?void 0:l.items)===void 0)return f.jsx(gt,{path:e,type:"union"});const c=t.items.flatMap(d=>{var p;const h=(p=d.items)==null?void 0:p[t.key];return h.type==="literal"?[h.value]:(console.error("Expected literal schema in object union",h),[])}),u=g.useRef({});return g.useEffect(()=>{n!==void 0&&a.data!==void 0&&typeof a.data=="string"&&n.status==="success"&&(u.current[e]||(u.current[e]={}),u.current[e][a.data]=n.data)},[n,a,e]),f.jsxs("div",{className:"grid gap-4",children:[f.jsxs(rk,{value:a.data??void 0,onValueChange:d=>{const h=t.items.find(m=>{var x;const v=(x=m.items)==null?void 0:x[t.key];return v.type==="literal"?v.value===d:(console.error("Expected literal schema in object union",v),!1)});if((h==null?void 0:h.items)===void 0){console.error(`Selected schema with ${t.key} = ${d} not found`);return}const p=u.current[e][d]||vu(h);p[t.key]=d,r([{op:"replace",path:o,value:p}],t.type)},children:[f.jsx(fy,{children:f.jsx(ok,{children:a.data})}),f.jsx(hy,{container:i,className:"w-32",children:c==null?f.jsx(r2,{}):c.map(d=>f.jsx(py,{value:d,children:d},d))})]}),Object.keys(l==null?void 0:l.items).filter(d=>d!==(t==null?void 0:t.key)).map(d=>{var p,m,v;const h=ca(e,d);return f.jsx(t2,{path:h,foldLevel:"1",transparent:!0,label:d,type:(m=(p=l==null?void 0:l.items)==null?void 0:p[d])==null?void 0:m.type,children:f.jsx(zy,{path:h,schema:(v=l==null?void 0:l.items)==null?void 0:v[d]},d)},h)})]})}function ZJ({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=On(e),i=Gr();return f.jsxs(rk,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}],"union")},children:[f.jsx(fy,{children:f.jsx(ok,{children:t})}),f.jsx(hy,{className:"w-32",container:i,children:n==null?f.jsx(r2,{}):n.map(s=>f.jsx(py,{value:s,children:s},s))})]})}function r2(){return f.jsx("div",{children:"Loading..."})}function QJ({path:e}){const t="union",n=kS(e),r=Dt(e);if(n.status==="error")return f.jsx(nt,{path:e,error:n.error,type:"union"});if(!("data"in n)||n.data===void 0)return f.jsx(mr,{path:e});if(!("data"in r)||r.data===void 0)return f.jsx(mr,{path:e});if(n.data===null)return f.jsx(gr,{path:e});if(r.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(Gb(o))return typeof n.data!="string"?f.jsx(nt,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,type:t}):f.jsx("div",{className:"truncate",children:n.data});{const i=n.data;if(!i)return f.jsx(gr,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return f.jsx(nt,{path:e,error:"Expected source to be an object, but found: "+typeof i,type:t});const s=o.items.find(a=>{var c;const l=(c=a.items)==null?void 0:c[o.key];if((l==null?void 0:l.type)==="literal"&&i!==null&&typeof i=="object"&&o.key in i&&!Ys(i))return l.value===i[o.key]});return s?f.jsx(n2,{path:e,schema:s}):f.jsx(nt,{path:e,error:"Expected source to have key "+o.key+" but it was not found",type:t})}}function o2(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=new Image;a.addEventListener("load",()=>{const l=Iv.Buffer.from(s.split(",")[1],"base64"),c=X.getSHA256Hash(l);if(a.naturalWidth&&a.naturalHeight){const u=X.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,fileHash:c,mimeType:u,fileExt:u&&X.mimeTypeToFileExt(u)})}else t({src:s,filename:r==null?void 0:r.name,fileHash:c})}),a.src=s}else n(s?{message:"Unexpected image result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function eX(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=Iv.Buffer.from(s.split(",")[1],"base64"),l=X.getSHA256Hash(a),c=X.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,fileHash:l,mimeType:c,fileExt:c&&X.mimeTypeToFileExt(c)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function tX(e){return e.split(".").pop()||""}const nX=new TextEncoder;async function i2(e,t,n,r,o,i,s,a="/public/val"){const l=X.createFilename(t,n,o,r);if(!l||!o)return[];const c=`${a}/${l}`,u=X.remote.hashToRemoteFileHash(r),d=s?X.remote.createRemoteRef(s.remoteHost,{publicProjectId:s.publicProjectId,coreVersion:s.coreVersion,bucket:s.bucket,validationHash:X.remote.getValidationHash(s.coreVersion,s.schema,tX(l),o,u,nX),fileHash:u,filePath:`${a.slice(1)}/${l}`}):c;return[{value:{[vt]:d,[De]:s?"remote":"file",...i!=="file"?{[fb]:i}:{},metadata:o},op:"replace",path:e},{value:t,metadata:o,op:"file",path:e,filePath:d,remote:s!==null}]}function rX({path:e}){var U;const t="file",n=Fu(),r=yS(),o=vS(),i=Dt(e),s=at(e,t),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,h]=g.useState(null),[p,m]=g.useState(!1),{patchPath:v,addAndUploadPatchWithFileOps:x}=On(e),[b,w]=g.useState(null),S="data"in s&&s.data,C=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{if(S&&S.metadata&&!C){const $=De in S&&S[De]==="remote"?X.convertRemoteSource({...S,[De]:"remote"}).url:X.convertFileSource({...S,[De]:"file"}).url;h($),m(!1)}},[s]),g.useEffect(()=>{var $,K,W;i.status==="success"&&i.data.type==="file"&&((K=($=i.data.options)==null?void 0:$.accept)!=null&&K.startsWith("video/"))&&l(!0),S&&typeof((W=S.metadata)==null?void 0:W.mimeType)=="string"&&(S.metadata.mimeType.startsWith("video/")?l(!0):l(!1))},[i,S]),i.status==="error")return f.jsx(Jt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(i.status==="loading")return f.jsx(gt,{path:e,type:t});if(n===void 0)return f.jsx(gt,{path:e,type:t});if(i.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:i.data.type});const _=s.data;if(_===void 0)return f.jsx(Pn,{path:e,type:t});const O=i.data.type==="file"&&i.data.remote&&o.status!=="ready",M=i.data.remote&&o.status==="ready"&&r?{publicProjectId:o.publicProjectId,coreVersion:o.coreVersion,bucket:r,schema:i.data,remoteHost:n.remoteHost}:null;let I=null;if(_!=null&&_._ref)if(i.data.remote){const $=X.remote.splitRemoteRef(_==null?void 0:_._ref);$.status==="success"&&(I=$.filePath)}else I=_==null?void 0:_._ref;let L=null;return I&&(L=I.split("/").slice(-1)[0]),f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),c&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:c}),f.jsxs("div",{className:"grid gap-2",children:[L&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"text-sm text-text-secondary",children:L}),p&&f.jsx(co,{className:`animate-spin text-text-secondary ${p?"block":"hidden"}`,size:16}),b!==null&&f.jsxs("div",{className:"text-sm text-text-secondary",children:[b,"%"]})]}),f.jsxs("div",{className:"flex items-center gap-4",children:[_&&(a?f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("video",{className:"w-full h-auto rounded-lg",controls:!0,src:De in _&&_[De]==="remote"?X.convertRemoteSource({..._,[De]:"remote"}).url:X.convertFileSource({..._,[De]:"file"}).url}),f.jsx(_t,{asChild:!0,variant:"ghost",className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})})]}):f.jsxs(f.Fragment,{children:[f.jsx(_t,{asChild:!0,variant:"ghost",className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})}),f.jsxs("a",{className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",download:L,href:De in _&&_[De]==="remote"?X.convertRemoteSource({..._,[De]:"remote"}).url:X.convertFileSource({..._,[De]:"file"}).url,children:[f.jsx("span",{children:" Open file"}),f.jsx($7,{})]})]})),f.jsx("input",{disabled:O,hidden:!0,id:`file_input:${e}`,type:"file",accept:(U=i.data.options)==null?void 0:U.accept,onChange:$=>{eX($).then(K=>{var N;const W="file",B=d;h(K.src),m(!0);const A={src:K.src,filename:K.filename};let R;K.mimeType&&(R={mimeType:K.mimeType}),u(null),i2(v,A.src,A.filename??null,K.fileHash,R,W,M,(N=n.files)==null?void 0:N.directory).then(D=>{m(!0),w(0),x(D,W,z=>{h(B),u(z)},(z,V,G,_e)=>{const Se=z*(G+1)/(V*_e);w(Math.round(Se*100))}).finally(()=>{w(null),m(!1)})}).catch(D=>{console.error("Failed to create file patch",D),m(!1),h(B),u("Could not upload file. Please try again later")}),$.target.value=""})}})]})]})]})}function oX({path:e}){const t=at(e,"image");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"image"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx(_R,{size:12})}function iX({path:e}){var K,W,B,A;const t="image",n=Fu(),r=vS(),o=yS(),i=Dt(e),s=at(e,t),[a,l]=g.useState(void 0),[c,u]=g.useState(null),[d,h]=g.useState(null),[p,m]=g.useState(!1),{addPatch:v,patchPath:x,addAndUploadPatchWithFileOps:b}=On(e),[w,S]=g.useState(null),C="data"in s&&s.data,_=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{if(C)if(C.metadata){if(!_){const N=De in C&&C[De]==="remote"?X.convertRemoteSource({...C,[De]:"remote"}).url:X.convertFileSource({...C,[De]:"file"}).url;h(N),m(!1)}const R=C.metadata;if(typeof R.width!="number"||typeof R.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof R.width} and height was: ${typeof R.height}`);return}if("hotspot"in R){if(typeof R.hotspot=="object"&&R.hotspot&&"x"in R.hotspot&&"y"in R.hotspot){const{x:N,y:D}=R.hotspot;typeof N=="number"&&typeof D=="number"?l({x:N,y:D}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof N} and y: ${typeof D}`)}}else l(void 0)}else l(void 0)},[s]),i.status==="error")return f.jsx(Jt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(i.status==="loading")return f.jsx(gt,{path:e,type:t});if(n===void 0)return f.jsx(gt,{path:e,type:t});if(i.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:i.data.type});const P=s.data;if(P===void 0)return f.jsx(Pn,{path:e,type:t});const M=i.data.type==="image"&&i.data.remote&&r.status!=="ready",I=i.data.remote&&r.status==="ready"&&o?{publicProjectId:r.publicProjectId,bucket:o,coreVersion:r.coreVersion,schema:i.data,remoteHost:n.remoteHost}:null,L=X.createValPathOfItem(e,"metadata"),U=X.createValPathOfItem(L,"alt"),$=X.createValPathOfItem(L,"hotspot");return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),c&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:c}),i.data.type==="image"&&i.data.remote&&r.status==="inactive"&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:sX(r.reason)}),f.jsxs("div",{className:"flex flex-col gap-2",children:[P&&f.jsxs("div",{className:"p-4 rounded-lg bg-bg-secondary",children:[f.jsx("span",{id:U,children:"Alt text"}),f.jsx(Gu,{value:(K=P.metadata)!=null&&K.alt&&typeof((W=P.metadata)==null?void 0:W.alt)=="string"?(B=P.metadata)==null?void 0:B.alt:"",disabled:M,onChange:R=>{const N=R.target.value;P.metadata&&"alt"in P.metadata?v([{op:"replace",value:N,path:x.concat(["metadata","alt"])}],"string"):P.metadata&&!("alt"in P.metadata)?v([{op:"add",value:N,path:x.concat(["metadata","alt"])}],"string"):P.metadata===void 0?v([{op:"add",value:{...a?{hotspot:a}:{},alt:N},path:x.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof P.metadata}`)}})]}),P&&d&&f.jsxs("div",{className:"relative rounded-lg bg-bg-secondary",children:[p&&f.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[f.jsx("div",{className:"absolute inset-0 w-full h-full opacity-50 bg-bg-secondary"}),f.jsx(co,{size:24,className:"animate-spin"}),f.jsx("div",{className:"mt-2 text-xs font-thin text-white z-5",children:w!==null?`${w}%`:""})]}),f.jsx("img",{src:d,draggable:!1,className:"object-contain max-h-[500px] w-full",style:{cursor:"crosshair"},id:$,onClick:R=>{const{width:N,height:D,left:z,top:V}=R.currentTarget.getBoundingClientRect(),G={x:Math.max((R.clientX-6-z)/N,0),y:Math.max((R.clientY-6-V)/D,0)};P.metadata&&"hotspot"in P.metadata?v([{op:"replace",path:x.concat(["metadata","hotspot"]),value:G}],"object"):P.metadata?v([{op:"add",path:x.concat(["metadata","hotspot"]),value:G}],"object"):P.metadata===void 0?v([{op:"add",value:{...G?{hotspot:G}:{}},path:x.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof P.metadata}`)}}),a&&f.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-solid border-2 absolute pointer-events-none",style:{top:`${a.y*100}%`,left:`${a.x*100}%`}})]}),f.jsx(_t,{asChild:!0,className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`img_input:${e}`,children:"Upload"})}),f.jsx("input",{disabled:s.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((A=i.data.options)==null?void 0:A.accept)||"image/*",onChange:R=>{o2(R).then(N=>{var _e,Se;const D="image",z=d;h(N.src),m(!0);const V={src:N.src,filename:N.filename};let G;N.width&&N.height&&N.mimeType&&(G={width:N.width,height:N.height,mimeType:N.mimeType,alt:C&&typeof((_e=C==null?void 0:C.metadata)==null?void 0:_e.alt)=="string"?C.metadata.alt:void 0}),u(null),i2(x,V.src,V.filename??null,N.fileHash,G,D,I,(Se=n.files)==null?void 0:Se.directory).then(Be=>{m(!0),S(0),b(Be,D,Z=>{h(z),u(Z)},(Z,Y,ce,Ee)=>{const fe=Z*(ce+1)/(Y*Ee);S(Math.round(fe*100))}).finally(()=>{S(null),m(!1)})}).catch(Be=>{console.error("Failed to create file patch",Be),m(!1),h(z),u("Could not upload file. Please try again later")}),R.target.value=""})}})]})]})}function sX(e){switch(e){case"api-key-missing":return"Val is running in production mode. To upload remote files and images, the VAL_API_KEY env must be set. Contact a developer to fix this issue.";case"error-could-not-get-settings":return`Could not get settings from the Val remote server. This means that updating or changing certain types of files and images might not work. Check your internet connection and try again. (Error code: ${e})`;case"no-internet-connection":return"Cannot upload remote files and images, since this requires an internet connection";case"pat-error":return"Val is running in development mode. To upload remote files and images, you must either login (by running `npx -p @valbuild/cli val login`) or set the VAL_API_KEY env";case"project-not-configured":return"Project is not configured. To upload remote files and images, the val.config must contain a project id that is obtained from https://app.val.build. Contact a developer to fix this issue.";case"unauthorized":return"Cannot upload remote files and images since you are unauthorized";case"unauthorized-personal-access-token-error":return"Cannot upload remote files and images since the personal access token is unauthorized. Try to login again by running `npx -p @valbuild/cli val login`";case"unknown-error":return"Unknown error";default:return e}}function aX({path:e}){const t=at(e,"image");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"image"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=t.data;return f.jsx("img",{src:De in n&&n[De]==="remote"?X.convertRemoteSource({...n,[De]:"remote"}).url:X.convertFileSource({...n,[De]:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function lX({path:e}){const t="keyOf",{navigate:n}=Mn(),r=Dt(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:r.data.schema.type,path:r.data.path}:void 0,i=at(o==null?void 0:o.path,o==null?void 0:o.type),s=at(e,t),{patchPath:a,addPatch:l}=On(e),c=Gr();if(r.status==="error")return f.jsx(Jt,{path:e,error:r.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:o==null?void 0:o.type});if(s.status=="not-found"||r.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return f.jsx(Jt,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&i.status==="not-found")return f.jsx(Jt,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in s)||s.data===void 0)return f.jsx(gt,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:r.data.type});if(!i)return f.jsx(Jt,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in i&&i.data===null)return f.jsx(Jt,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in i&&i.data?Object.keys(i.data):void 0,d=s.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),u&&u.length>0&&d!==null&&!u.includes(d)&&f.jsx("div",{className:"flex flex-col gap-2 p-4 rounded bg-bg-error-primary text-text-error-primary",children:f.jsxs("span",{children:["Value must be one of: ",u.join(", ")]})}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs(rk,{value:d??"",onValueChange:h=>{l([{op:"replace",path:a,value:h}],t)},children:[f.jsx(fy,{children:f.jsx(ok,{children:d})}),f.jsx(hy,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?f.jsx(cX,{}):u.map(h=>f.jsx(py,{value:h,children:h},h))})]}),d&&(o==null?void 0:o.path)&&f.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(X.createValPathOfItem(o.path,d))},children:f.jsx(m7,{size:16})})]})]})}function cX(){return f.jsx("span",{children:"Loading..."})}function uX({path:e}){const t=at(e,"keyOf");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"keyOf"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function s2({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return f.jsx(H8,{showOutsideDays:r,captionLayout:n,className:ze("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex flex-row justify-center pt-1 relative items-center",caption_dropdowns:"flex flex-row space-x-2",caption_label:`text-sm font-medium ${i?"hidden":""}`,nav:"space-x-1 flex items-center",dropdown_month:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown_year:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown:"bg-transparent border-solid rounded-md border-2 border-secondary",nav_button:ze(Rb({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:ze(Rb({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",...t},components:{IconLeft:()=>f.jsx(v7,{className:"w-4 h-4"}),IconRight:()=>f.jsx(Gv,{className:"w-4 h-4"}),Dropdown:({caption:s,children:a,value:l,onChange:c})=>{const u=d=>{c&&c({target:{value:d}})};return f.jsx("div",{className:"flex flex-row space-x-2",children:f.jsxs(KA,{onValueChange:u,value:String(l),children:[f.jsx(ek,{asChild:!0,children:f.jsxs(_t,{variant:"ghost",size:"sm",children:[s,f.jsx(Zh,{className:"w-4 h-4"})]})}),f.jsx(tk,{className:"z-50 p-1 rounded-md bg-bg-secondary_alt text-text-secondary",children:f.jsx(GA,{className:"pb-4 pr-4 overflow-y-auto rounded-md shadow-lg max-h-48 bg-bg-tertiary text-text-tertiary",children:g.Children.map(a,d=>{if(g.isValidElement(d)){const{value:h,children:p}=d.props;return f.jsx(nk,{value:String(h),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary_hover hover:text-text-secondary_hover",children:f.jsx(YA,{children:p})},h)}return null})})})]})})}},...o})}s2.displayName="Calendar";function dX({path:e}){var h,p;const t="date",n=Dt(e),r=at(e,t),{patchPath:o,addPatch:i}=On(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=Gr();if(g.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const m=new Date(r.data);a(m)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const d=n.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsxs(ss,{open:l,onOpenChange:m=>{c(m)},children:[f.jsx(Vu,{asChild:!0,onClick:()=>{c(!0)},children:f.jsxs(_t,{variant:"outline",className:ve("w-[280px] justify-start text-left font-normal bg-bg-primary",!s&&"text-muted-foreground"),children:[f.jsx(kR,{className:"w-4 h-4 mr-2"}),s?us(s,"PPP"):f.jsx("span",{children:"Pick a date"})]})}),f.jsx(pi,{className:"w-auto p-0",container:u,children:f.jsx(s2,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(h=d.options)!=null&&h.from?new Date(d.options.from):void 0,toDate:(p=d.options)!=null&&p.to?new Date(d.options.to):void 0,selected:s||void 0,onSelect:m=>{m&&(a(m),i([{op:"replace",value:m.toISOString().slice(0,10),path:o}],d.type),c(!1))}})})]})]})}function fX({path:e}){const t=at(e,"date");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"date"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function hX({path:e}){const t=at(e,"literal");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"literal"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{id:e,className:"truncate",children:t.data})}function a2(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function l2(){return f.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-primary"})}function c2({error:e}){return f.jsx("div",{className:"p-4 text-white bg-bg-error-primary",children:f.jsxs("div",{children:["Preview error: ",e]})})}function pX({path:e}){const t="record",n=Da()||{},{navigate:r}=Mn(),o=Dt(e),i=xR(e),s=at(e,t);if(o.status==="error")return f.jsx(Jt,{path:e,error:o.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||o.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(o.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in s)||s.data===void 0)return f.jsx(gt,{path:e,type:t});if(o.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:o.data.type});const a=s.data,l=i&&"data"in i&&i.data&&i.data.layout==="list"&&i.data.parent==="record"?i.data:void 0;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),(i==null?void 0:i.status)==="error"&&f.jsx(c2,{error:i.message,path:e}),l&&f.jsx(gX,{path:e,...l}),!l&&f.jsx("div",{className:"grid grid-cols-1 gap-4",children:a&&Object.entries(a).map(([c])=>f.jsxs("div",{onClick:()=>r(ca(e,c)),className:ve("bg-primary-foreground cursor-pointer min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4","hover:bg-bg-secondary_subtle"),children:[f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsx("div",{className:"pb-4 font-semibold text-md",children:c}),a2(ca(e,c),n)&&f.jsx(l2,{})]}),f.jsx("div",{children:f.jsx(tE,{path:ca(e,c)})})]},c))})]})}function mX({title:e,image:t,subtitle:n}){return f.jsxs("div",{className:ve("flex w-full items-start justify-between pl-4 flex-grow text-left"),children:[f.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[f.jsx("div",{className:"text-lg font-medium",children:e}),n&&f.jsx("div",{className:"flex-shrink block overflow-hidden text-sm text-gray-500 text-ellipsis max-h-5",children:n})]}),t&&f.jsx(vX,{src:t,alt:e})]})}function gX({path:e,items:t}){const{navigate:n}=Mn();return f.jsx("div",{className:"flex flex-col w-full space-y-4",children:t.map(([r,{title:o,subtitle:i,image:s}])=>f.jsx("button",{onClick:()=>n(ca(e,r)),className:ve("hover:bg-bg-secondary_subtle","border rounded-lg cursor-pointer border-border-primary"),children:f.jsx(mX,{title:o,subtitle:i,image:s})},r))})}function vX({src:e,alt:t}){var i;const[n,r]=g.useState(!1);if(e==null)return f.jsx("div",{className:"flex-shrink-0 w-20 h-20 ml-4 opacity-25 bg-bg-brand-secondary"});const o=X.convertFileSource(e).url;return f.jsxs("div",{className:"relative flex-shrink-0 w-20 h-20 ml-4",children:[!n&&f.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),f.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(i=e.metadata)!=null&&i.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function yX({path:e}){const t=at(e,"record");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"record"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=Object.keys(t.data);return f.jsxs("div",{className:"text-left",children:[f.jsx("span",{className:"text-fg-brand-primary",children:n.length}),f.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let gy=()=>({events:{},emit(e,...t){(this.events[e]||[]).forEach(n=>n(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(n=>n!==t)}});var qb={exports:{}};(function(e,t){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;o===void 0&&(o=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var h=u.stack;return r(this,"stack",{configurable:!0,value:h,writable:!0}),h},set:function(h){r(c,"stack",{configurable:!0,value:h,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),o(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var s=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},s!==void 0&&(s(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}t=e.exports=a,t.BaseError=i})(qb,qb.exports);var u2=qb.exports,U_="ProseMirror-selectednode",d2="",Js="\0",H_="__state_override__",xX={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},He=xX,as=Symbol.for("__remirror__"),mn=(e=>(e.PlainExtension="RemirrorPlainExtension",e.NodeExtension="RemirrorNodeExtension",e.MarkExtension="RemirrorMarkExtension",e.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",e.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",e.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",e.Manager="RemirrorManager",e.Preset="RemirrorPreset",e.PresetConstructor="RemirrorPresetConstructor",e))(mn||{}),ht=(e=>(e[e.Critical=1e6]="Critical",e[e.Highest=1e5]="Highest",e[e.High=1e4]="High",e[e.Medium=1e3]="Medium",e[e.Default=100]="Default",e[e.Low=10]="Low",e[e.Lowest=0]="Lowest",e))(ht||{}),ir=(e=>(e[e.None=0]="None",e[e.Create=1]="Create",e[e.EditorView=2]="EditorView",e[e.Runtime=3]="Runtime",e[e.Destroy=4]="Destroy",e))(ir||{}),oe=(e=>(e.Undo="_|undo|_",e.Redo="_|redo|_",e.Bold="_|bold|_",e.Italic="_|italic|_",e.Underline="_|underline|_",e.Strike="_|strike|_",e.Code="_|code|_",e.Paragraph="_|paragraph|_",e.H1="_|h1|_",e.H2="_|h2|_",e.H3="_|h3|_",e.H4="_|h4|_",e.H5="_|h5|_",e.H6="_|h6|_",e.TaskList="_|task|_",e.BulletList="_|bullet|_",e.OrderedList="_|number|_",e.Quote="_|quote|_",e.Divider="_|divider|_",e.Codeblock="_|codeblock|_",e.ClearFormatting="_|clear|_",e.Superscript="_|sup|_",e.Subscript="_|sub|_",e.LeftAlignment="_|left-align|_",e.CenterAlignment="_|center-align|_",e.RightAlignment="_|right-align|_",e.JustifyAlignment="_|justify-align|_",e.InsertLink="_|link|_",e.Find="_|find|_",e.FindBackwards="_|find-backwards|_",e.FindReplace="_|find-replace|_",e.AddFootnote="_|footnote|_",e.AddComment="_|comment|_",e.ContextMenu="_|context-menu|_",e.IncreaseFontSize="_|inc-font-size|_",e.DecreaseFontSize="_|dec-font-size|_",e.IncreaseIndent="_|indent|_",e.DecreaseIndent="_|dedent|_",e.Shortcuts="_|shortcuts|_",e.Copy="_|copy|_",e.Cut="_|cut|_",e.Paste="_|paste|_",e.PastePlain="_|paste-plain|_",e.SelectAll="_|select-all|_",e.Format="_|format|_",e))(oe||{}),re=(e=>(e.PROD="RMR0000",e.UNKNOWN="RMR0001",e.INVALID_COMMAND_ARGUMENTS="RMR0002",e.CUSTOM="RMR0003",e.CORE_HELPERS="RMR0004",e.MUTATION="RMR0005",e.INTERNAL="RMR0006",e.MISSING_REQUIRED_EXTENSION="RMR0007",e.MANAGER_PHASE_ERROR="RMR0008",e.INVALID_GET_EXTENSION="RMR0010",e.INVALID_MANAGER_ARGUMENTS="RMR0011",e.SCHEMA="RMR0012",e.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",e.INVALID_MANAGER_EXTENSION="RMR0014",e.DUPLICATE_COMMAND_NAMES="RMR0016",e.DUPLICATE_HELPER_NAMES="RMR0017",e.NON_CHAINABLE_COMMAND="RMR0018",e.INVALID_EXTENSION="RMR0019",e.INVALID_CONTENT="RMR0021",e.INVALID_NAME="RMR0050",e.EXTENSION="RMR0100",e.EXTENSION_SPEC="RMR0101",e.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",e.INVALID_SET_EXTENSION_OPTIONS="RMR0103",e.REACT_PROVIDER_CONTEXT="RMR0200",e.REACT_GET_ROOT_PROPS="RMR0201",e.REACT_EDITOR_VIEW="RMR0202",e.REACT_CONTROLLED="RMR0203",e.REACT_NODE_VIEW="RMR0204",e.REACT_GET_CONTEXT="RMR0205",e.REACT_COMPONENTS="RMR0206",e.REACT_HOOKS="RMR0207",e.I18N_CONTEXT="RMR0300",e))(re||{}),bX=function(t){return wX(t)&&!SX(t)};function wX(e){return!!e&&typeof e=="object"}function SX(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||CX(e)}var kX=typeof Symbol=="function"&&Symbol.for,EX=kX?Symbol.for("react.element"):60103;function CX(e){return e.$$typeof===EX}function _X(e){return Array.isArray(e)?[]:{}}function uh(e,t){return t.clone!==!1&&t.isMergeableObject(e)?yu(_X(e),e,t):e}function PX(e,t,n){return e.concat(t).map(function(r){return uh(r,n)})}function NX(e,t){if(!t.customMerge)return yu;var n=t.customMerge(e);return typeof n=="function"?n:yu}function TX(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function W_(e){return Object.keys(e).concat(TX(e))}function f2(e,t){try{return t in e}catch{return!1}}function OX(e,t){return f2(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function MX(e,t,n){var r={};return n.isMergeableObject(e)&&W_(e).forEach(function(o){r[o]=uh(e[o],n)}),W_(t).forEach(function(o){OX(e,o)||(f2(e,o)&&n.isMergeableObject(t[o])?r[o]=NX(o,n)(e[o],t[o],n):r[o]=uh(t[o],n))}),r}function yu(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||PX,n.isMergeableObject=n.isMergeableObject||bX,n.cloneUnlessOtherwiseSpecified=uh;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):MX(e,t,n):uh(t,n)}yu.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return yu(r,o,n)},{})};var jX=yu,RX=jX;const IX=Ma(RX);/*!
|
|
429
|
+
`},Nq={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Tq(e){let{announcements:t=Nq,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Pq}=e;const{announce:i,announcement:s}=Eq(),a=ip("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),Cq(g.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:p}=d;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(d){let{active:h,over:p}=d;i(t.onDragOver({active:h,over:p}))},onDragEnd(d){let{active:h,over:p}=d;i(t.onDragEnd({active:h,over:p}))},onDragCancel(d){let{active:h,over:p}=d;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!l)return null;const u=ke.createElement(ke.Fragment,null,ke.createElement(Sq,{id:r,value:o.draggable}),ke.createElement(kq,{id:a,announcement:s}));return n?jr.createPortal(u,n):u}var en;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function jg(){}function Wx(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Oq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ko=Object.freeze({x:0,y:0});function JI(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function XI(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Mq(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function P_(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function ZI(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function N_(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const jq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=N_(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=JI(N_(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(XI)},Rq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=P_(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=P_(l),u=o.reduce((h,p,m)=>h+JI(c[m],p),0),d=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(XI)};function Iq(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const Aq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=Iq(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(Mq)};function Dq(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function QI(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ko}function Lq(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Fq=Lq(1);function zq(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function $q(e,t,n){const r=zq(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const Bq={ignoreTransform:!1};function Ku(e,t){t===void 0&&(t=Bq);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=yr(e).getComputedStyle(e);c&&(n=$q(n,c,u))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function T_(e){return Ku(e,{ignoreTransform:!0})}function Vq(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Uq(e,t){return t===void 0&&(t=yr(e).getComputedStyle(e)),t.position==="fixed"}function Hq(e,t){t===void 0&&(t=yr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function sy(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(KS(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!rp(o)||GI(o)||n.includes(o))return n;const i=yr(e).getComputedStyle(o);return o!==e&&Hq(o,i)&&n.push(o),Uq(o,i)?n:r(o.parentNode)}return e?r(e):n}function eA(e){const[t]=sy(e,1);return t??null}function Kx(e){return!iy||!e?null:Hu(e)?e:WS(e)?KS(e)||e===Wu(e).scrollingElement?window:rp(e)?e:null:null}function tA(e){return Hu(e)?e.scrollX:e.scrollLeft}function nA(e){return Hu(e)?e.scrollY:e.scrollTop}function zb(e){return{x:tA(e),y:nA(e)}}var dn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(dn||(dn={}));function rA(e){return!iy||!e?!1:e===document.scrollingElement}function oA(e){const t={x:0,y:0},n=rA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const Wq={x:.2,y:.2};function Kq(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Wq);const{isTop:c,isBottom:u,isLeft:d,isRight:h}=oA(e),p={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+v.height?(p.y=dn.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(p.y=dn.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&a>=t.right-v.width?(p.x=dn.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(p.x=dn.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:p,speed:m}}function Gq(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function iA(e){return e.reduce((t,n)=>Wc(t,zb(n)),Ko)}function qq(e){return e.reduce((t,n)=>t+tA(n),0)}function Yq(e){return e.reduce((t,n)=>t+nA(n),0)}function Jq(e,t){if(t===void 0&&(t=Ku),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);eA(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Xq=[["x",["left","right"],qq],["y",["top","bottom"],Yq]];class YS{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=sy(n),o=iA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of Xq)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Zq(e){const{EventTarget:t}=yr(e);return e instanceof t?e:Wu(e)}function Gx(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Xr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Xr||(Xr={}));function O_(e){e.preventDefault()}function Qq(e){e.stopPropagation()}var Ze;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ze||(Ze={}));const sA={start:[Ze.Space,Ze.Enter],cancel:[Ze.Esc],end:[Ze.Space,Ze.Enter,Ze.Tab]},eY=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ze.Right:return{...n,x:n.x+25};case Ze.Left:return{...n,x:n.x-25};case Ze.Down:return{...n,y:n.y+25};case Ze.Up:return{...n,y:n.y-25}}};class JS{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new hf(Wu(n)),this.windowListeners=new hf(yr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Xr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Jq(r),n(Ko)}handleKeyDown(t){if(qS(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=sA,coordinateGetter:s=eY,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Ko;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const h=ah(d,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const x=t.code,{isTop:b,isRight:w,isLeft:S,isBottom:C,maxScroll:_,minScroll:P}=oA(v),O=Gq(v),M={x:Math.min(x===Ze.Right?O.right-O.width/2:O.right,Math.max(x===Ze.Right?O.left:O.left+O.width/2,d.x)),y:Math.min(x===Ze.Down?O.bottom-O.height/2:O.bottom,Math.max(x===Ze.Down?O.top:O.top+O.height/2,d.y))},I=x===Ze.Right&&!w||x===Ze.Left&&!S,L=x===Ze.Down&&!C||x===Ze.Up&&!b;if(I&&M.x!==d.x){const U=v.scrollLeft+h.x,$=x===Ze.Right&&U<=_.x||x===Ze.Left&&U>=P.x;if($&&!h.y){v.scrollTo({left:U,behavior:a});return}$?p.x=v.scrollLeft-U:p.x=x===Ze.Right?v.scrollLeft-_.x:v.scrollLeft-P.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(L&&M.y!==d.y){const U=v.scrollTop+h.y,$=x===Ze.Down&&U<=_.y||x===Ze.Up&&U>=P.y;if($&&!h.x){v.scrollTo({top:U,behavior:a});return}$?p.y=v.scrollTop-U:p.y=x===Ze.Down?v.scrollTop-_.y:v.scrollTop-P.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,Wc(ah(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}JS.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=sA,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function M_(e){return!!(e&&"distance"in e)}function j_(e){return!!(e&&"delay"in e)}class XS{constructor(t,n,r){var o;r===void 0&&(r=Zq(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=Wu(s),this.documentListeners=new hf(this.document),this.listeners=new hf(r),this.windowListeners=new hf(yr(s)),this.initialCoordinates=(o=Fb(i))!=null?o:Ko,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Xr.Resize,this.handleCancel),this.windowListeners.add(Xr.DragStart,O_),this.windowListeners.add(Xr.VisibilityChange,this.handleCancel),this.windowListeners.add(Xr.ContextMenu,O_),this.documentListeners.add(Xr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(j_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(M_(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Xr.Click,Qq,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Xr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=Fb(t))!=null?n:Ko,c=ah(o,l);if(!r&&a){if(M_(a)){if(a.tolerance!=null&&Gx(c,a.tolerance))return this.handleCancel();if(Gx(c,a.distance))return this.handleStart()}if(j_(a)&&Gx(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ze.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const tY={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class aA extends XS{constructor(t){const{event:n}=t,r=Wu(n.target);super(t,tY,r)}}aA.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const nY={move:{name:"mousemove"},end:{name:"mouseup"}};var $b;(function(e){e[e.RightClick=2]="RightClick"})($b||($b={}));class lA extends XS{constructor(t){super(t,nY,Wu(t.event.target))}}lA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===$b.RightClick?!1:(r==null||r({event:n}),!0)}}];const qx={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class cA extends XS{constructor(t){super(t,qx)}static setup(){return window.addEventListener(qx.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(qx.move.name,t)};function t(){}}}cA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var pf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(pf||(pf={}));var Rg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Rg||(Rg={}));function rY(e){let{acceleration:t,activator:n=pf.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Rg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:h}=e;const p=iY({delta:d,disabled:!i}),[m,v]=vq(),x=g.useRef({x:0,y:0}),b=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case pf.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case pf.DraggableRect:return o}},[n,o,l]),S=g.useRef(null),C=g.useCallback(()=>{const P=S.current;if(!P)return;const O=x.current.x*b.current.x,M=x.current.y*b.current.y;P.scrollBy(O,M)},[]),_=g.useMemo(()=>a===Rg.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const P of _){if((r==null?void 0:r(P))===!1)continue;const O=c.indexOf(P),M=u[O];if(!M)continue;const{direction:I,speed:L}=Kq(P,M,w,t,h);for(const U of["x","y"])p[U][I[U]]||(L[U]=0,I[U]=0);if(L.x>0||L.y>0){v(),S.current=P,m(C,s),x.current=L,b.current=I;return}}x.current={x:0,y:0},b.current={x:0,y:0},v()},[t,C,r,v,i,s,JSON.stringify(w),JSON.stringify(p),m,c,_,u,JSON.stringify(h)])}const oY={x:{[dn.Backward]:!1,[dn.Forward]:!1},y:{[dn.Backward]:!1,[dn.Forward]:!1}};function iY(e){let{delta:t,disabled:n}=e;const r=Lb(t);return op(o=>{if(n||!r||!o)return oY;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[dn.Backward]:o.x[dn.Backward]||i.x===-1,[dn.Forward]:o.x[dn.Forward]||i.x===1},y:{[dn.Backward]:o.y[dn.Backward]||i.y===-1,[dn.Forward]:o.y[dn.Forward]||i.y===1}}},[n,t,r])}function sY(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return op(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function aY(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var ch;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ch||(ch={}));var Bb;(function(e){e.Optimized="optimized"})(Bb||(Bb={}));const R_=new Map;function lY(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=g.useState(null),{frequency:a,measure:l,strategy:c}=o,u=g.useRef(e),d=x(),h=sh(d),p=g.useCallback(function(b){b===void 0&&(b=[]),!h.current&&s(w=>w===null?b:w.concat(b.filter(S=>!w.includes(S))))},[h]),m=g.useRef(null),v=op(b=>{if(d&&!n)return R_;if(!b||b===R_||u.current!==e||i!=null){const w=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const C=S.node.current,_=C?new YS(l(C),C):null;S.rect.current=_,_&&w.set(S.id,_)}return w}return b},[e,i,n,d,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{d||p()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,d,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:i!=null};function x(){switch(c){case ch.Always:return!1;case ch.BeforeDragging:return n;default:return!n}}}function uA(e,t){return op(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function cY(e,t){return uA(e,t)}function uY(e){let{callback:t,disabled:n}=e;const r=GS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function ay(e){let{callback:t,disabled:n}=e;const r=GS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function dY(e){return new YS(Ku(e),e)}function I_(e,t,n){t===void 0&&(t=dY);const[r,o]=g.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=uY({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=ay({callback:i});return mi(()=>{i(),e?(a==null||a.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[e]),r}function fY(e){const t=uA(e);return QI(e,t)}const A_=[];function hY(e){const t=g.useRef(e),n=op(r=>e?r&&r!==A_&&e&&t.current&&e.parentNode===t.current.parentNode?r:sy(e):A_,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function pY(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=Kx(i.target);s&&n(a=>a?(a.set(s,zb(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=Kx(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,zb(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const c=Kx(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Wc(i,s),Ko):iA(e):Ko,[e,t])}function D_(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==Ko;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ah(e,n.current):Ko}function mY(e){g.useEffect(()=>{if(!iy)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function gY(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function dA(e){return g.useMemo(()=>e?Vq(e):null,[e])}const L_=[];function vY(e,t){t===void 0&&(t=Ku);const[n]=e,r=dA(n?yr(n):null),[o,i]=g.useState(L_);function s(){i(()=>e.length?e.map(l=>rA(l)?r:new YS(t(l),l)):L_)}const a=ay({callback:s});return mi(()=>{a==null||a.disconnect(),s(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function yY(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return rp(t)?t:e}function xY(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(rp(u)){r(d=>{const h=t(u);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=ay({callback:o}),s=g.useCallback(c=>{const u=yY(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=Mg(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const bY=[{sensor:aA,options:{}},{sensor:JS,options:{}}],wY={current:{}},bm={draggable:{measure:T_},droppable:{measure:T_,strategy:ch.WhileDragging,frequency:Bb.Optimized},dragOverlay:{measure:Ku}};class mf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const SY={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:jg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bm,measureDroppableContainers:jg,windowRect:null,measuringScheduled:!1},kY={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:jg,draggableNodes:new Map,over:null,measureDroppableContainers:jg},ly=g.createContext(kY),fA=g.createContext(SY);function EY(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mf}}}function CY(e,t){switch(t.type){case en.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new mf(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new mf(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case en.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new mf(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function _Y(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(ly),i=Lb(r),s=Lb(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!qS(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=bq(u);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function PY(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function NY(e){return g.useMemo(()=>({draggable:{...bm.draggable,...e==null?void 0:e.draggable},droppable:{...bm.droppable,...e==null?void 0:e.droppable},dragOverlay:{...bm.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function TY(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=g.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;mi(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=QI(u,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=eA(c);h&&h.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const hA=g.createContext({...Ko,scaleX:1,scaleY:1});var Ds;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ds||(Ds={}));const OY=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=bY,collisionDetection:d=Aq,measuring:h,modifiers:p,...m}=t;const v=g.useReducer(CY,void 0,EY),[x,b]=v,[w,S]=_q(),[C,_]=g.useState(Ds.Uninitialized),P=C===Ds.Initialized,{draggable:{active:O,nodes:M,translate:I},droppable:{containers:L}}=x,U=O!=null?M.get(O):null,$=g.useRef({initial:null,translated:null}),K=g.useMemo(()=>{var jn;return O!=null?{id:O,data:(jn=U==null?void 0:U.data)!=null?jn:wY,rect:$}:null},[O,U]),W=g.useRef(null),[B,A]=g.useState(null),[R,N]=g.useState(null),D=sh(m,Object.values(m)),z=ip("DndDescribedBy",s),V=g.useMemo(()=>L.getEnabled(),[L]),G=NY(h),{droppableRects:_e,measureDroppableContainers:Se,measuringScheduled:Be}=lY(V,{dragging:P,dependencies:[I.x,I.y],config:G.droppable}),Z=sY(M,O),Y=g.useMemo(()=>R?Fb(R):null,[R]),ce=G3(),Ee=cY(Z,G.draggable.measure);TY({activeNode:O!=null?M.get(O):null,config:ce.layoutShiftCompensation,initialRect:Ee,measure:G.draggable.measure});const fe=I_(Z,G.draggable.measure,Ee),Ae=I_(Z?Z.parentElement:null),Ce=g.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:_e,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=L.getNodeFor((n=Ce.current.over)==null?void 0:n.id),pt=xY({measure:G.dragOverlay.measure}),Wt=(r=pt.nodeRef.current)!=null?r:Z,T=P?(o=pt.rect)!=null?o:fe:null,k=!!(pt.nodeRef.current&&pt.rect),E=fY(k?null:fe),j=dA(Wt?yr(Wt):null),F=hY(P?Ye??Z:null),J=vY(F),ee=PY(p,{transform:{x:I.x-E.x,y:I.y-E.y,scaleX:1,scaleY:1},activatorEvent:R,active:K,activeNodeRect:fe,containerNodeRect:Ae,draggingNodeRect:T,over:Ce.current.over,overlayNodeRect:pt.rect,scrollableAncestors:F,scrollableAncestorRects:J,windowRect:j}),Je=Y?Wc(Y,I):null,st=pY(F),yt=D_(st),ln=D_(st,[fe]),ct=Wc(ee,yt),yo=T?Fq(T,ee):null,ps=K&&yo?d({active:K,collisionRect:yo,droppableRects:_e,droppableContainers:V,pointerCoordinates:Je}):null,ed=ZI(ps,"id"),[ms,lE]=g.useState(null),V3=k?ee:Wc(ee,ln),U3=Dq(V3,(i=ms==null?void 0:ms.rect)!=null?i:null,fe),By=g.useRef(null),cE=g.useCallback((jn,br)=>{let{sensor:wr,options:gs}=br;if(W.current==null)return;const Yr=M.get(W.current);if(!Yr)return;const Sr=jn.nativeEvent,Xo=new wr({active:W.current,activeNode:Yr,event:Sr,options:gs,context:Ce,onAbort(yn){if(!M.get(yn))return;const{onDragAbort:Zo}=D.current,ki={id:yn};Zo==null||Zo(ki),w({type:"onDragAbort",event:ki})},onPending(yn,vs,Zo,ki){if(!M.get(yn))return;const{onDragPending:nd}=D.current,ys={id:yn,constraint:vs,initialCoordinates:Zo,offset:ki};nd==null||nd(ys),w({type:"onDragPending",event:ys})},onStart(yn){const vs=W.current;if(vs==null)return;const Zo=M.get(vs);if(!Zo)return;const{onDragStart:ki}=D.current,td={activatorEvent:Sr,active:{id:vs,data:Zo.data,rect:$}};jr.unstable_batchedUpdates(()=>{ki==null||ki(td),_(Ds.Initializing),b({type:en.DragStart,initialCoordinates:yn,active:vs}),w({type:"onDragStart",event:td}),A(By.current),N(Sr)})},onMove(yn){b({type:en.DragMove,coordinates:yn})},onEnd:Jl(en.DragEnd),onCancel:Jl(en.DragCancel)});By.current=Xo;function Jl(yn){return async function(){const{active:Zo,collisions:ki,over:td,scrollAdjustedTranslate:nd}=Ce.current;let ys=null;if(Zo&&nd){const{cancelDrop:rd}=D.current;ys={activatorEvent:Sr,active:Zo,collisions:ki,delta:nd,over:td},yn===en.DragEnd&&typeof rd=="function"&&await Promise.resolve(rd(ys))&&(yn=en.DragCancel)}W.current=null,jr.unstable_batchedUpdates(()=>{b({type:yn}),_(Ds.Uninitialized),lE(null),A(null),N(null),By.current=null;const rd=yn===en.DragEnd?"onDragEnd":"onDragCancel";if(ys){const Vy=D.current[rd];Vy==null||Vy(ys),w({type:rd,event:ys})}})}}},[M]),H3=g.useCallback((jn,br)=>(wr,gs)=>{const Yr=wr.nativeEvent,Sr=M.get(gs);if(W.current!==null||!Sr||Yr.dndKit||Yr.defaultPrevented)return;const Xo={active:Sr};jn(wr,br.options,Xo)===!0&&(Yr.dndKit={capturedBy:br.sensor},W.current=gs,cE(wr,br))},[M,cE]),uE=aY(u,H3);mY(u),mi(()=>{fe&&C===Ds.Initializing&&_(Ds.Initialized)},[fe,C]),g.useEffect(()=>{const{onDragMove:jn}=D.current,{active:br,activatorEvent:wr,collisions:gs,over:Yr}=Ce.current;if(!br||!wr)return;const Sr={active:br,activatorEvent:wr,collisions:gs,delta:{x:ct.x,y:ct.y},over:Yr};jr.unstable_batchedUpdates(()=>{jn==null||jn(Sr),w({type:"onDragMove",event:Sr})})},[ct.x,ct.y]),g.useEffect(()=>{const{active:jn,activatorEvent:br,collisions:wr,droppableContainers:gs,scrollAdjustedTranslate:Yr}=Ce.current;if(!jn||W.current==null||!br||!Yr)return;const{onDragOver:Sr}=D.current,Xo=gs.get(ed),Jl=Xo&&Xo.rect.current?{id:Xo.id,rect:Xo.rect.current,data:Xo.data,disabled:Xo.disabled}:null,yn={active:jn,activatorEvent:br,collisions:wr,delta:{x:Yr.x,y:Yr.y},over:Jl};jr.unstable_batchedUpdates(()=>{lE(Jl),Sr==null||Sr(yn),w({type:"onDragOver",event:yn})})},[ed]),mi(()=>{Ce.current={activatorEvent:R,active:K,activeNode:Z,collisionRect:yo,collisions:ps,droppableRects:_e,draggableNodes:M,draggingNode:Wt,draggingNodeRect:T,droppableContainers:L,over:ms,scrollableAncestors:F,scrollAdjustedTranslate:ct},$.current={initial:T,translated:yo}},[K,Z,ps,yo,M,Wt,T,_e,L,ms,F,ct]),rY({...ce,delta:I,draggingRect:yo,pointerCoordinates:Je,scrollableAncestors:F,scrollableAncestorRects:J});const W3=g.useMemo(()=>({active:K,activeNode:Z,activeNodeRect:fe,activatorEvent:R,collisions:ps,containerNodeRect:Ae,dragOverlay:pt,draggableNodes:M,droppableContainers:L,droppableRects:_e,over:ms,measureDroppableContainers:Se,scrollableAncestors:F,scrollableAncestorRects:J,measuringConfiguration:G,measuringScheduled:Be,windowRect:j}),[K,Z,fe,R,ps,Ae,pt,M,L,_e,ms,Se,F,J,G,Be,j]),K3=g.useMemo(()=>({activatorEvent:R,activators:uE,active:K,activeNodeRect:fe,ariaDescribedById:{draggable:z},dispatch:b,draggableNodes:M,over:ms,measureDroppableContainers:Se}),[R,uE,K,fe,b,z,M,ms,Se]);return ke.createElement(YI.Provider,{value:S},ke.createElement(ly.Provider,{value:K3},ke.createElement(fA.Provider,{value:W3},ke.createElement(hA.Provider,{value:U3},c)),ke.createElement(_Y,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ke.createElement(Tq,{...a,hiddenTextDescribedById:z}));function G3(){const jn=(B==null?void 0:B.autoScrollEnabled)===!1,br=typeof l=="object"?l.enabled===!1:l===!1,wr=P&&!jn&&!br;return typeof l=="object"?{...l,enabled:wr}:{enabled:wr}}}),MY=g.createContext(null),F_="button",jY="Draggable";function RY(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=ip(jY),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:h}=g.useContext(ly),{role:p=F_,roleDescription:m="draggable",tabIndex:v=0}=o??{},x=(l==null?void 0:l.id)===t,b=g.useContext(x?hA:MY),[w,S]=Mg(),[C,_]=Mg(),P=gY(s,t),O=sh(n);mi(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:C,data:O}),()=>{const I=d.get(t);I&&I.key===i&&d.delete(t)}),[d,t]);const M=g.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&p===F_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,v,x,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:M,isDragging:x,listeners:r?void 0:P,node:w,over:h,setNodeRef:S,setActivatorNodeRef:_,transform:b}}function IY(){return g.useContext(fA)}const AY="Droppable",DY={timeout:25};function LY(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=ip(AY),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(ly),u=g.useRef({disabled:n}),d=g.useRef(!1),h=g.useRef(null),p=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:x}={...DY,...o},b=sh(v??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),p.current=null},x)},[x]),S=ay({callback:w,disabled:m||!s}),C=g.useCallback((M,I)=>{S&&(I&&(S.unobserve(I),d.current=!1),M&&S.observe(M))},[S]),[_,P]=Mg(C),O=sh(t);return g.useEffect(()=>{!S||!_.current||(S.disconnect(),d.current=!1,S.observe(_.current))},[_,S]),g.useEffect(()=>(a({type:en.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:h,data:O}}),()=>a({type:en.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:en.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:h,isOver:(l==null?void 0:l.id)===r,node:_,over:l,setNodeRef:P}}function ZS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function FY(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Yp(e){return e!==null&&e>=0}function zY(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function $Y(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const pA=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=ZS(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Jp={scaleX:1,scaleY:1},BY=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...Jp}:null}const l=VY(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...Jp}:o<n&&o>=s?{x:0,y:a.height+l,...Jp}:{x:0,y:0,...Jp}};function VY(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const mA="Sortable",gA=ke.createContext({activeIndex:-1,containerId:mA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pA,disabled:{draggable:!1,droppable:!1}});function UY(e){let{children:t,id:n,items:r,strategy:o=pA,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=IY(),d=ip(mA,n),h=a.rect!==null,p=g.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),m=s!=null,v=s?p.indexOf(s.id):-1,x=c?p.indexOf(c.id):-1,b=g.useRef(p),w=!zY(p,b.current),S=x!==-1&&v===-1||w,C=$Y(i);mi(()=>{w&&m&&u(p)},[w,p,m,u]),g.useEffect(()=>{b.current=p},[p]);const _=g.useMemo(()=>({activeIndex:v,containerId:d,disabled:C,disableTransforms:S,items:p,overIndex:x,useDragOverlay:h,sortedRects:FY(p,l),strategy:o}),[v,d,C.draggable,C.droppable,S,p,x,l,h,o]);return ke.createElement(gA.Provider,{value:_},t)}const HY=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return ZS(n,r,o).indexOf(t)},WY=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},KY={duration:200,easing:"ease"},vA="transform",GY=lh.Transition.toString({property:vA,duration:0,easing:"linear"}),qY={roleDescription:"sortable"};function YY(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return mi(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=Ku(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),g.useEffect(()=>{i&&s(null)},[i]),i}function JY(e){let{animateLayoutChanges:t=WY,attributes:n,disabled:r,data:o,getNewIndex:i=HY,id:s,strategy:a,resizeObserverConfig:l,transition:c=KY}=e;const{items:u,containerId:d,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:v,overIndex:x,useDragOverlay:b,strategy:w}=g.useContext(gA),S=XY(r,p),C=u.indexOf(s),_=g.useMemo(()=>({sortable:{containerId:d,index:C,items:u},...o}),[d,o,C,u]),P=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:O,node:M,isOver:I,setNodeRef:L}=LY({id:s,data:_,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:U,activatorEvent:$,activeNodeRect:K,attributes:W,setNodeRef:B,listeners:A,isDragging:R,over:N,setActivatorNodeRef:D,transform:z}=RY({id:s,data:_,attributes:{...qY,...n},disabled:S.draggable}),V=gq(L,B),G=!!U,_e=G&&!m&&Yp(h)&&Yp(x),Se=!b&&R,Be=Se&&_e?z:null,Y=_e?Be??(a??w)({rects:v,activeNodeRect:K,activeIndex:h,overIndex:x,index:C}):null,ce=Yp(h)&&Yp(x)?i({id:s,items:u,activeIndex:h,overIndex:x}):C,Ee=U==null?void 0:U.id,fe=g.useRef({activeId:Ee,items:u,newIndex:ce,containerId:d}),Ae=u!==fe.current.items,Ce=t({active:U,containerId:d,isDragging:R,isSorting:G,id:s,index:C,items:u,newIndex:fe.current.newIndex,previousItems:fe.current.items,previousContainerId:fe.current.containerId,transition:c,wasDragging:fe.current.activeId!=null}),Ye=YY({disabled:!Ce,index:C,node:M,rect:O});return g.useEffect(()=>{G&&fe.current.newIndex!==ce&&(fe.current.newIndex=ce),d!==fe.current.containerId&&(fe.current.containerId=d),u!==fe.current.items&&(fe.current.items=u)},[G,ce,d,u]),g.useEffect(()=>{if(Ee===fe.current.activeId)return;if(Ee&&!fe.current.activeId){fe.current.activeId=Ee;return}const Wt=setTimeout(()=>{fe.current.activeId=Ee},50);return()=>clearTimeout(Wt)},[Ee]),{active:U,activeIndex:h,attributes:W,data:_,rect:O,index:C,newIndex:ce,items:u,isOver:I,isSorting:G,isDragging:R,listeners:A,node:M,overIndex:x,over:N,setNodeRef:V,setActivatorNodeRef:D,setDroppableNodeRef:L,setDraggableNodeRef:B,transform:Ye??Y,transition:pt()};function pt(){if(Ye||Ae&&fe.current.newIndex===C)return GY;if(!(Se&&!qS($)||!c)&&(G||Ce))return lh.Transition.toString({...c,property:vA})}}function XY(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Ig(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ZY=[Ze.Down,Ze.Right,Ze.Up,Ze.Left],QY=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(ZY.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case Ze.Down:r.top<h.top&&l.push(d);break;case Ze.Up:r.top>h.top&&l.push(d);break;case Ze.Left:r.left>h.left&&l.push(d);break;case Ze.Right:r.left<h.left&&l.push(d);break}});const c=Rq({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=ZI(c,"id");if(u===(s==null?void 0:s.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),h=i.get(u),p=h?o.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&d&&h){const x=sy(m).some((P,O)=>a[O]!==P),b=yA(d,h),w=eJ(d,h),S=x||!b?{x:0,y:0}:{x:w?r.width-p.width:0,y:w?r.height-p.height:0},C={x:p.left,y:p.top};return S.x&&S.y?C:ah(C,S)}}}};function yA(e,t){return!Ig(e)||!Ig(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function eJ(e,t){return!Ig(e)||!Ig(t)||!yA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Gu=g.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:ze("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Gu.displayName="Input";function $r({path:e}){const t=Da()||{},n=Mn(),r=[];for(const o in t)o.startsWith(e)&&r.push(...t[o].map(i=>({...i,path:o})));if(r.length===0)return null;if(r.length===1){const o=r[0];return f.jsxs("div",{className:"p-4 font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx("div",{children:o.message}),e!==o.path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at"," ",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(o.path)},children:o.path})]})]})}return f.jsx(US,{type:"single",collapsible:!0,children:f.jsxs(Gi,{value:"validation-errors",className:"font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx(la,{className:"p-4",children:f.jsxs("div",{className:"flex justify-between w-full",children:[f.jsx("span",{className:"truncate",children:"Multiple validation errors"}),f.jsxs("span",{className:"pr-4",children:["(",r.length,")"]})]})}),f.jsx(qi,{children:r.map(o=>f.jsxs("div",{className:"px-4",children:[f.jsx("div",{children:o.message}),e!==o.path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(o.path)},children:o.path})]})]},o.path))})]})})}function xA({path:e,autoFocus:t}){const n="string",r=Dt(e),o=kS(e),{patchPath:i,addPatch:s}=On(e),[a,l]=g.useState(null),c="data"in o&&o.data,u="clientSideOnly"in o&&o.clientSideOnly;return g.useEffect(()=>{u===!1&&l(typeof c=="string"?c:null)},[c,u]),r.status==="error"?f.jsx(Jt,{path:e,error:r.error,type:n}):o.status==="error"?f.jsx(nt,{path:e,error:o.error,type:n}):o.status=="not-found"||r.status==="not-found"?f.jsx(Pn,{path:e,type:n}):r.status==="loading"?f.jsx(gt,{path:e,type:n}):!("data"in o)||o.data===void 0?f.jsx(gt,{path:e,type:n}):r.data.type!==n?f.jsx(vr,{path:e,expectedType:n,actualType:r.data.type}):f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsxs("div",{className:"relative w-full",children:[f.jsx(Gu,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,value:a||"",onChange:d=>{l(d.target.value),s([{op:"replace",path:i,value:d.target.value}],n)}}),f.jsx("span",{className:ve("absolute right-0 -translate-x-full top-4 duration-1000",{"opacity-0":o.data===a,"opacity-100":o.data!==a}),children:f.jsx(co,{className:"transition-opacity animate-spin",size:12})})]})]})}function tJ({path:e}){const t=at(e,"string");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"string"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function nJ({path:e}){const t="boolean",n=Dt(e),r=at(e,t),{patchPath:o,addPatch:i}=On(e);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(Uu,{checked:a,onCheckedChange:()=>{let l=!1;n.data.opt?a===!0?l=null:a===null?l=!1:a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1):a===!0?l=!1:a==="indeterminate"||a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1),i([{op:"replace",path:o,value:l}],n.data.type)}})]})}function rJ({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=On(e);return typeof t!="boolean"&&t!==null?f.jsx(nt,{path:e,error:"Expected boolean",type:"boolean"}):f.jsx(Uu,{id:e,disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:i,value:!0}]:t===!1&&n?[{op:"replace",path:i,value:null}]:t===!1?[{op:"replace",path:i,value:!0}]:[{op:"replace",path:i,value:!1}],"boolean")}})}function oJ({path:e}){const t=at(e,"boolean");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"boolean"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):t.data===!0?f.jsx("div",{className:"flex items-center justify-center w-4 h-4 border rounded border-text-primary",children:f.jsx(Bu,{className:"w-3 h-3"})}):t.data===!1?f.jsx("div",{className:"w-4 h-4 border rounded border-text-primary"}):(console.warn("Unexpected value for boolean field",t.data),f.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function iJ({path:e}){const t="number",n=Dt(e),r=at(e,t),{patchPath:o,addPatch:i}=On(e);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(Gu,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}],t)}})]})}function sJ({path:e}){const t=at(e,"number");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"number"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}var aJ=[" ","Enter","ArrowUp","ArrowDown"],lJ=[" ","Enter"],sp="Select",[cy,uy,cJ]=ty(sp),[qu,zme]=ho(sp,[cJ,wi]),dy=wi(),[uJ,Fa]=qu(sp),[dJ,fJ]=qu(sp),bA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:h,required:p,form:m}=e,v=dy(t),[x,b]=g.useState(null),[w,S]=g.useState(null),[C,_]=g.useState(!1),P=Qh(c),[O=!1,M]=zr({prop:r,defaultProp:o,onChange:i}),[I,L]=zr({prop:s,defaultProp:a,onChange:l}),U=g.useRef(null),$=x?m||!!x.closest("form"):!0,[K,W]=g.useState(new Set),B=Array.from(K).map(A=>A.props.value).join(";");return f.jsx(Wh,{...v,children:f.jsxs(uJ,{required:p,scope:t,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:_,contentId:Ar(),value:I,onValueChange:L,open:O,onOpenChange:M,dir:P,triggerPointerDownPosRef:U,disabled:h,children:[f.jsx(cy.Provider,{scope:t,children:f.jsx(dJ,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(A=>{W(R=>new Set(R).add(A))},[]),onNativeOptionRemove:g.useCallback(A=>{W(R=>{const N=new Set(R);return N.delete(A),N})},[]),children:n})}),$?f.jsxs(UA,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:I,onChange:A=>L(A.target.value),disabled:h,form:m,children:[I===void 0?f.jsx("option",{value:""}):null,Array.from(K)]},B):null]})})};bA.displayName=sp;var wA="SelectTrigger",SA=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=dy(n),s=Fa(wA,n),a=s.disabled||r,l=$e(t,s.onTriggerChange),c=uy(n),u=g.useRef("touch"),[d,h,p]=HA(v=>{const x=c().filter(S=>!S.disabled),b=x.find(S=>S.value===s.value),w=WA(x,v,b);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),p()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return f.jsx(Au,{asChild:!0,...i,children:f.jsx(Te.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":VA(s.value)?"":void 0,...o,ref:l,onClick:ne(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:ne(o.onPointerDown,v=>{u.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:ne(o.onKeyDown,v=>{const x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(x&&v.key===" ")&&aJ.includes(v.key)&&(m(),v.preventDefault())})})})});SA.displayName=wA;var kA="SelectValue",EA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Fa(kA,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=$e(t,l.onValueNodeChange);return _n(()=>{c(u)},[c,u]),f.jsx(Te.span,{...a,ref:d,style:{pointerEvents:"none"},children:VA(l.value)?f.jsx(f.Fragment,{children:s}):i})});EA.displayName=kA;var hJ="SelectIcon",CA=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(Te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});CA.displayName=hJ;var pJ="SelectPortal",_A=e=>f.jsx(Du,{asChild:!0,...e});_A.displayName=pJ;var Ml="SelectContent",PA=g.forwardRef((e,t)=>{const n=Fa(Ml,e.__scopeSelect),[r,o]=g.useState();if(_n(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?jr.createPortal(f.jsx(NA,{scope:e.__scopeSelect,children:f.jsx(cy.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),i):null}return f.jsx(TA,{...e,ref:t})});PA.displayName=Ml;var Eo=10,[NA,za]=qu(Ml),mJ="SelectContentImpl",TA=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x,...b}=e,w=Fa(Ml,n),[S,C]=g.useState(null),[_,P]=g.useState(null),O=$e(t,Y=>C(Y)),[M,I]=g.useState(null),[L,U]=g.useState(null),$=uy(n),[K,W]=g.useState(!1),B=g.useRef(!1);g.useEffect(()=>{if(S)return Xv(S)},[S]),Jv();const A=g.useCallback(Y=>{const[ce,...Ee]=$().map(Ce=>Ce.ref.current),[fe]=Ee.slice(-1),Ae=document.activeElement;for(const Ce of Y)if(Ce===Ae||(Ce==null||Ce.scrollIntoView({block:"nearest"}),Ce===ce&&_&&(_.scrollTop=0),Ce===fe&&_&&(_.scrollTop=_.scrollHeight),Ce==null||Ce.focus(),document.activeElement!==Ae))return},[$,_]),R=g.useCallback(()=>A([M,S]),[A,M,S]);g.useEffect(()=>{K&&R()},[K,R]);const{onOpenChange:N,triggerPointerDownPosRef:D}=w;g.useEffect(()=>{if(S){let Y={x:0,y:0};const ce=fe=>{var Ae,Ce;Y={x:Math.abs(Math.round(fe.pageX)-(((Ae=D.current)==null?void 0:Ae.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((Ce=D.current)==null?void 0:Ce.y)??0))}},Ee=fe=>{Y.x<=10&&Y.y<=10?fe.preventDefault():S.contains(fe.target)||N(!1),document.removeEventListener("pointermove",ce),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[S,N,D]),g.useEffect(()=>{const Y=()=>N(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[N]);const[z,V]=HA(Y=>{const ce=$().filter(Ae=>!Ae.disabled),Ee=ce.find(Ae=>Ae.ref.current===document.activeElement),fe=WA(ce,Y,Ee);fe&&setTimeout(()=>fe.ref.current.focus())}),G=g.useCallback((Y,ce,Ee)=>{const fe=!B.current&&!Ee;(w.value!==void 0&&w.value===ce||fe)&&(I(Y),fe&&(B.current=!0))},[w.value]),_e=g.useCallback(()=>S==null?void 0:S.focus(),[S]),Se=g.useCallback((Y,ce,Ee)=>{const fe=!B.current&&!Ee;(w.value!==void 0&&w.value===ce||fe)&&U(Y)},[w.value]),Be=r==="popper"?Vb:OA,Z=Be===Vb?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x}:{};return f.jsx(NA,{scope:n,content:S,viewport:_,onViewportChange:P,itemRefCallback:G,selectedItem:M,onItemLeave:_e,itemTextRefCallback:Se,focusSelectedItem:R,selectedItemText:L,position:r,isPositioned:K,searchRef:z,children:f.jsx(tp,{as:ns,allowPinchZoom:!0,children:f.jsx(ep,{asChild:!0,trapped:w.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:ne(o,Y=>{var ce;(ce=w.trigger)==null||ce.focus({preventScroll:!0}),Y.preventDefault()}),children:f.jsx(Hl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:f.jsx(Be,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:Y=>Y.preventDefault(),...b,...Z,onPlaced:()=>W(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ne(b.onKeyDown,Y=>{const ce=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!ce&&Y.key.length===1&&V(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let fe=$().filter(Ae=>!Ae.disabled).map(Ae=>Ae.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const Ae=Y.target,Ce=fe.indexOf(Ae);fe=fe.slice(Ce+1)}setTimeout(()=>A(fe)),Y.preventDefault()}})})})})})})});TA.displayName=mJ;var gJ="SelectItemAlignedPosition",OA=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Fa(Ml,n),s=za(Ml,n),[a,l]=g.useState(null),[c,u]=g.useState(null),d=$e(t,O=>u(O)),h=uy(n),p=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=s,S=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&x&&b){const O=i.trigger.getBoundingClientRect(),M=c.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),L=b.getBoundingClientRect();if(i.dir!=="rtl"){const Ae=L.left-M.left,Ce=I.left-Ae,Ye=O.left-Ce,pt=O.width+Ye,Wt=Math.max(pt,M.width),T=window.innerWidth-Eo,k=Mb(Ce,[Eo,Math.max(Eo,T-Wt)]);a.style.minWidth=pt+"px",a.style.left=k+"px"}else{const Ae=M.right-L.right,Ce=window.innerWidth-I.right-Ae,Ye=window.innerWidth-O.right-Ce,pt=O.width+Ye,Wt=Math.max(pt,M.width),T=window.innerWidth-Eo,k=Mb(Ce,[Eo,Math.max(Eo,T-Wt)]);a.style.minWidth=pt+"px",a.style.right=k+"px"}const U=h(),$=window.innerHeight-Eo*2,K=v.scrollHeight,W=window.getComputedStyle(c),B=parseInt(W.borderTopWidth,10),A=parseInt(W.paddingTop,10),R=parseInt(W.borderBottomWidth,10),N=parseInt(W.paddingBottom,10),D=B+A+K+N+R,z=Math.min(x.offsetHeight*5,D),V=window.getComputedStyle(v),G=parseInt(V.paddingTop,10),_e=parseInt(V.paddingBottom,10),Se=O.top+O.height/2-Eo,Be=$-Se,Z=x.offsetHeight/2,Y=x.offsetTop+Z,ce=B+A+Y,Ee=D-ce;if(ce<=Se){const Ae=U.length>0&&x===U[U.length-1].ref.current;a.style.bottom="0px";const Ce=c.clientHeight-v.offsetTop-v.offsetHeight,Ye=Math.max(Be,Z+(Ae?_e:0)+Ce+R),pt=ce+Ye;a.style.height=pt+"px"}else{const Ae=U.length>0&&x===U[0].ref.current;a.style.top="0px";const Ye=Math.max(Se,B+v.offsetTop+(Ae?G:0)+Z)+Ee;a.style.height=Ye+"px",v.scrollTop=ce-Se+v.offsetTop}a.style.margin=`${Eo}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,a,c,v,x,b,i.dir,r]);_n(()=>S(),[S]);const[C,_]=g.useState();_n(()=>{c&&_(window.getComputedStyle(c).zIndex)},[c]);const P=g.useCallback(O=>{O&&m.current===!0&&(S(),w==null||w(),m.current=!1)},[S,w]);return f.jsx(yJ,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:f.jsx(Te.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});OA.displayName=gJ;var vJ="SelectPopperPosition",Vb=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Eo,...i}=e,s=dy(n);return f.jsx(Kh,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Vb.displayName=vJ;var[yJ,QS]=qu(Ml,{}),Ub="SelectViewport",MA=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=za(Ub,n),s=QS(Ub,n),a=$e(t,i.onViewportChange),l=g.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(cy.Slot,{scope:n,children:f.jsx(Te.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ne(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&d){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-Eo*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),b=Math.max(v,x);if(b<m){const w=b+p,S=Math.min(m,w),C=w-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=C>0?C:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});MA.displayName=Ub;var jA="SelectGroup",[xJ,bJ]=qu(jA),wJ=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ar();return f.jsx(xJ,{scope:n,id:o,children:f.jsx(Te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});wJ.displayName=jA;var RA="SelectLabel",IA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=bJ(RA,n);return f.jsx(Te.div,{id:o.id,...r,ref:t})});IA.displayName=RA;var Ag="SelectItem",[SJ,AA]=qu(Ag),DA=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Fa(Ag,n),l=za(Ag,n),c=a.value===r,[u,d]=g.useState(i??""),[h,p]=g.useState(!1),m=$e(t,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,r,o)}),v=Ar(),x=g.useRef("touch"),b=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(SJ,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{d(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:f.jsx(cy.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(Te.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:ne(s.onFocus,()=>p(!0)),onBlur:ne(s.onBlur,()=>p(!1)),onClick:ne(s.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:ne(s.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:ne(s.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:ne(s.onPointerMove,w=>{var S;x.current=w.pointerType,o?(S=l.onItemLeave)==null||S.call(l):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ne(s.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ne(s.onKeyDown,w=>{var C;((C=l.searchRef)==null?void 0:C.current)!==""&&w.key===" "||(lJ.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});DA.displayName=Ag;var Md="SelectItemText",LA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Fa(Md,n),a=za(Md,n),l=AA(Md,n),c=fJ(Md,n),[u,d]=g.useState(null),h=$e(t,b=>d(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,b,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=g.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=c;return _n(()=>(v(m),()=>x(m)),[v,x,m]),f.jsxs(f.Fragment,{children:[f.jsx(Te.span,{id:l.textId,...i,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?jr.createPortal(i.children,s.valueNode):null]})});LA.displayName=Md;var FA="SelectItemIndicator",zA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return AA(FA,n).isSelected?f.jsx(Te.span,{"aria-hidden":!0,...r,ref:t}):null});zA.displayName=FA;var Hb="SelectScrollUpButton",kJ=g.forwardRef((e,t)=>{const n=za(Hb,e.__scopeSelect),r=QS(Hb,e.__scopeSelect),[o,i]=g.useState(!1),s=$e(t,r.onScrollButtonChange);return _n(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx($A,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});kJ.displayName=Hb;var Wb="SelectScrollDownButton",EJ=g.forwardRef((e,t)=>{const n=za(Wb,e.__scopeSelect),r=QS(Wb,e.__scopeSelect),[o,i]=g.useState(!1),s=$e(t,r.onScrollButtonChange);return _n(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx($A,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});EJ.displayName=Wb;var $A=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=za("SelectScrollButton",n),s=g.useRef(null),a=uy(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),_n(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),f.jsx(Te.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ne(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:ne(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:ne(o.onPointerLeave,()=>{l()})})}),CJ="SelectSeparator",BA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(Te.div,{"aria-hidden":!0,...r,ref:t})});BA.displayName=CJ;var Kb="SelectArrow",_J=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=dy(n),i=Fa(Kb,n),s=za(Kb,n);return i.open&&s.position==="popper"?f.jsx(Gh,{...o,...r,ref:t}):null});_J.displayName=Kb;function VA(e){return e===""||e===void 0}var UA=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=$e(t,o),s=MS(n);return g.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const d=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(d)}},[s,n]),f.jsx(dS,{asChild:!0,children:f.jsx("select",{...r,ref:i,defaultValue:n})})});UA.displayName="BubbleSelect";function HA(e){const t=tn(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function WA(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=PJ(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function PJ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var KA=bA,ek=SA,NJ=EA,TJ=CA,OJ=_A,tk=PA,GA=MA,qA=IA,nk=DA,YA=LA,MJ=zA,JA=BA;const rk=KA,ok=NJ,fy=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(ek,{ref:r,className:ze("flex h-10 m-1 w-[calc(100%-8px)] items-center justify-between rounded-md border border-input bg-bg-primary px-3 py-2 text-sm ring-offset-background placeholder:text-fg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,f.jsx(TJ,{asChild:!0,children:f.jsx(Zh,{className:"w-4 h-4 opacity-50"})})]}));fy.displayName=ek.displayName;const hy=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>f.jsx(OJ,{container:r,children:f.jsx(tk,{ref:i,className:ze("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-primary text-text-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:f.jsx(GA,{className:ze("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));hy.displayName=tk.displayName;const jJ=g.forwardRef(({className:e,...t},n)=>f.jsx(qA,{ref:n,className:ze("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));jJ.displayName=qA.displayName;const py=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(nk,{ref:r,className:ze("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-text-primary outline-none focus:bg-bg-brand-primary_alt focus:text-text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(MJ,{children:f.jsx(Bu,{className:"w-4 h-4"})})}),f.jsx(YA,{children:t})]}));py.displayName=nk.displayName;const RJ=g.forwardRef(({className:e,...t},n)=>f.jsx(JA,{ref:n,className:ze("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));RJ.displayName=JA.displayName;function vu(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,vu(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?vu(e.items[0]):e.key.value;if(e.type==="date")return us(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}function ca(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function IJ(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function AJ({children:e}){return f.jsx("div",{children:IJ(e)})}function XA(e){const[t,n]=X.splitModuleFilePathAndModulePath(e),r=X.joinModuleFilePathAndModulePath(t,X.splitModulePath(n).slice(0,-1).join(".")),o=Dt(r);return{path:r,schema:"data"in o?o.data:void 0}}const z_=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",DJ=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",LJ=e=>(e==null?void 0:e.type)==="record",FJ=e=>(e==null?void 0:e.type)==="array";function zJ(e,t,n,r){if(!t[n])return console.error(`Get keysOf Source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,d)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof d=="string"&&d===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(B_(d)||ZA(d))for(const p in d){const m=d==null?void 0:d[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l($_(c,p),v,m)}}else if(u.type==="array"){if($J(d)){let p=0;for(const m of d)l($_(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&B_(d)){const m=d[p];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[p];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,d)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function $_(e,t){return e.includes(va)?`${e}.${JSON.stringify(t)}`:`${e}${va}${JSON.stringify(t)}`}function B_(e){return ZA(e)}function ZA(e){return typeof e=="object"&&!!e&&!Ys(e)}function $J(e){return typeof e=="object"&&!!e&&Ys(e)}function BJ({path:e,disabled:t}){const[n,r]=X.splitModuleFilePathAndModulePath(e),o=X.splitModuleFilePath(n),i=X.splitModulePath(r),{navigate:s}=Mn();return f.jsxs("div",{className:"w-full",children:[f.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>f.jsxs(g.Fragment,{children:[l===0&&f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:ve({"text-muted":!(i.length===0&&l===o.length-1)}),children:pu(a)}),l>0&&l<o.length-1&&f.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),f.jsx("button",{type:"button",disabled:t,title:X.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(X.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:ve({"text-muted":l===i.length-2}),children:pu(a)})]},`${a}-${l}`))})]})}function QA({path:e,variant:t}){const n=Dt(e),{path:r,schema:o}=XA(e),i=e2(e),s=i[i.length-1],a=WJ(r,z_(e,r,o)?s==null?void 0:s.part:void 0);return f.jsxs("span",{className:"inline-flex items-center gap-2",children:[z_(e,r,o)&&f.jsxs(f.Fragment,{children:[f.jsx(V_,{refs:a,variant:t}),f.jsx(HJ,{defaultValue:s.text,path:e,parentPath:r,variant:t,refs:a}),f.jsx(UJ,{path:e,parentPath:r,variant:t,refs:a})]}),FJ("data"in n?n.data:void 0)&&f.jsx(VJ,{path:e,variant:t}),LJ("data"in n?n.data:void 0)&&f.jsxs(f.Fragment,{children:[f.jsx(V_,{refs:a,variant:t}),f.jsx(KJ,{path:e,variant:t})]})]})}function V_({refs:e,variant:t}){const n=Gr();return e.length===0?null:f.jsxs(ss,{children:[f.jsxs(fl,{children:[f.jsx(Hc,{children:f.jsx(_t,{asChild:!0,size:ap(t),variant:lp(t),children:f.jsx(Vu,{children:f.jsx(MR,{size:my(t)})})})}),f.jsx(hl,{side:"top",children:"References to this record"})]}),f.jsx(pi,{container:n,children:f.jsx("div",{className:"text-sm",children:f.jsx("ul",{children:e.map(r=>{const[o,i]=X.splitModuleFilePathAndModulePath(r),s=X.createPatchPath(i);return f.jsx("li",{children:f.jsx(oy,{moduleFilePath:o,patchPath:s})},r)})})})})]})}function my(e){return e==="module"?16:12}function ap(e){return"icon"}function lp(e){return e==="module"?"outline":"ghost"}function VJ({path:e,variant:t}){const{navigate:n}=Mn(),{addPatch:r,patchPath:o}=On(e),i=Dt(e),s=at(e,"array"),[a]=X.splitModuleFilePathAndModulePath(e);if(!("data"in s)||!s.data||!("data"in i))return null;const l=i.data;if(l.type!=="array")return console.error("Cannot add to non-array",s,{parentPath:e}),null;const c=s.data.length;return f.jsx(_t,{title:"Add",size:ap(t),variant:lp(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:vu(l.item)}],l.type),l.item.type!=="string"&&n(X.joinModuleFilePathAndModulePath(a,X.patchPathToModulePath(u)))},children:f.jsx(TR,{size:my(t)})})}function UJ({path:e,parentPath:t,variant:n,refs:r}){const{navigate:o}=Mn(),{addPatch:i,patchPath:s}=On(e),a=at(t,"record");return!("data"in a)||a.data===void 0||a.data===null?(console.error("Parent source not found",a,{path:e}),null):f.jsxs(fl,{children:[f.jsx(Hc,{children:f.jsx(_t,{size:ap(n),variant:lp(n),disabled:r.length>0,onClick:()=>{i([{op:"remove",path:s}],"record"),o(t)},children:f.jsx(q7,{size:my(n)})})}),f.jsx(hl,{side:"top",children:r.length>0?f.jsxs("div",{children:[f.jsx("p",{children:"Cannot delete record."}),f.jsxs("p",{children:["You must change the following references"," ",f.jsx(MR,{size:10,className:"inline"})," to be able to delete:"]}),f.jsx("ul",{children:r.map(l=>f.jsx("li",{children:f.jsx(BJ,{path:l})},l))})]}):f.jsx("p",{children:"Delete record"})})]})}function HJ({defaultValue:e,path:t,parentPath:n,variant:r,refs:o}){const[i,s]=X.splitModuleFilePathAndModulePath(n),{navigate:a}=Mn(),{addPatch:l,addModuleFilePatch:c}=On(t),u=at(n,"record"),[d,h]=g.useState(e),[p,m]=g.useState(!1),v=Gr();g.useEffect(()=>{const w=S=>{S.key==="Escape"&&m(!1)};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}},[]);const x=X.createPatchPath(s);if(!("data"in u)||u.data===void 0||u.data===null)return console.error("Parent source not found",u,{path:t}),null;const b=d===e||d===""||d in u.data;return f.jsxs(ss,{open:p,children:[f.jsxs(fl,{children:[f.jsx(Hc,{children:f.jsx(_t,{asChild:!0,size:ap(r),variant:lp(r),children:f.jsx(Vu,{onClick:()=>{m(!0)},children:f.jsx(V7,{size:16})})})}),f.jsx(hl,{side:"top",children:"Change name"})]}),f.jsx(pi,{container:v,className:"text-text-primary",children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:w=>{w.preventDefault();const S=[{op:"move",from:x.concat(e),path:x.concat(d)}];l(S,"record");for(const C of o){const[_,P]=X.splitModuleFilePathAndModulePath(C),O=X.createPatchPath(P);c(_,[{op:"replace",path:O,value:d}],"record")}a(X.joinModuleFilePathAndModulePath(i,X.patchPathToModulePath(x.concat(d))),{replace:!0}),m(!1)},children:[f.jsx(Gu,{type:"text",value:d,onChange:w=>{h(w.target.value)}}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(_t,{disabled:b,variant:"outline",type:"submit",children:"Update"}),f.jsx(_t,{variant:"ghost",type:"reset",onClick:()=>{m(!1),h(e)},children:"Cancel"})]})]})})]})}function WJ(e,t){const n=Xh(),r=Kv(),o=SS();return g.useMemo(()=>"data"in n&&n.data!==void 0&&n.data[e]!==void 0?zJ(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}function KJ({path:e,variant:t}){const n=at(e,"record"),r=Dt(e),o=Gr(),{addPatch:i}=On(e),[s,a]=g.useState(""),{navigate:l}=Mn(),[c,u]=g.useState(!1);if(g.useEffect(()=>{const v=x=>{x.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}},[]),!("data"in n)||n.data===void 0||n.data===null)return console.error("Source not found",n,{path:e}),null;if(!("data"in r)||r.data===void 0)return console.error("Schema not found",n,{path:e}),null;const d=r.data;if(d.type!=="record")return console.error("Schema is not a record",r,{path:e}),null;const h=s===""||s in n.data,[p,m]=X.splitModuleFilePathAndModulePath(e);return f.jsxs(ss,{open:c,children:[f.jsx(_t,{asChild:!0,size:ap(t),variant:lp(t),children:f.jsx(Vu,{onClick:()=>{u(!0)},title:"Add",children:f.jsx(TR,{size:my(t)})})}),f.jsx(pi,{container:o,children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{v.preventDefault();const x=X.createPatchPath(m).concat(s);i([{op:"add",path:x,value:vu(d.item)}],"record"),l(X.joinModuleFilePathAndModulePath(p,X.patchPathToModulePath(x))),u(!1)},children:[f.jsx(Gu,{autoFocus:!0,value:s,onChange:v=>{a(v.target.value)}}),f.jsx("div",{children:f.jsx(_t,{type:"submit",disabled:h,variant:"outline",children:"Add"})})]})})]})}function e2(e){const[t,n]=X.splitModuleFilePathAndModulePath(e),r=X.splitModuleFilePath(t).map(a=>({text:pu(a),part:a,sourcePath:t}));if(!n)return r;const o=X.splitModulePath(n),i=[];let s="";for(let a=0;a<o.length;a++){let l=(s?s+".":"")+JSON.stringify(o[a]);n.startsWith(l)||(l=(s?s+".":"")+o[a]),s=l,i.push({text:o[a],part:o[a],sourcePath:X.joinModuleFilePathAndModulePath(t,l)})}return r.concat(i)}function t2({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var S,C;const s=Kv(),a=s7(n),{patchPath:l,addPatch:c}=On(n),u=Dt(n),d=at(n,o),[h,p]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var _,P;"data"in d&&d.data===null&&"data"in u&&!u.data.opt&&(((_=u.data)==null?void 0:_.type)==="image"||((P=u.data)==null?void 0:P.type)==="file")&&v(!0)},[d,u]);const x="data"in d?d.data:void 0,b="data"in u&&((S=u.data)==null?void 0:S.type)==="boolean",w="data"in u&&((C=u.data)==null?void 0:C.opt)===!0;return f.jsxs("div",{className:ve("p-4 border rounded-lg",{"bg-bg-tertiary":!r,"border-border-error":a.length>0}),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[!b&&w&&f.jsx(Uu,{disabled:s==="loading",checked:x!==null||m,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&x===null?v(!0):c(x===null?[{op:"replace",path:l,value:vu({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}],u.data.type)}}),b&&f.jsx(rJ,{path:n,isNullable:w,loadingStatus:s,source:x}),typeof e=="string"&&f.jsx(AJ,{children:e}),e&&typeof e!="string"&&e]}),f.jsxs("div",{className:"flex items-center gap-2",children:[x!==null&&f.jsx(QA,{path:n,variant:"field"}),x!==null&&!b&&f.jsxs("button",{onClick:()=>p(_=>!_),className:ve("transform transition-transform",{"rotate-180":h}),children:[i==="1"&&f.jsx(Zh,{size:16}),i==="2"&&f.jsx(y7,{size:16})]})]})]}),!b&&f.jsx(pl,{type:"single",collapsible:!0,value:h&&(x!==null||m)?"open":"closed",children:f.jsx(Gi,{value:"open",className:"w-full border-b-0",children:f.jsx(qi,{children:t})})})]})}function GJ({path:e}){const t="object",n=Dt(e),r=at(e,t);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=ca(e,i);return f.jsx(t2,{label:i,path:a,type:s.type,children:f.jsx(zy,{path:a,schema:s},a)},a)})})]})}function qJ({path:e}){const t="object",n=Dt(e);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.data.type!=="object")return f.jsx(vr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return f.jsx(n2,{path:e,schema:r})}function n2({path:e,schema:t}){return f.jsx("div",{id:e,className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=ca(e,n);return f.jsx(YJ,{label:n,children:f.jsx(tE,{path:r})},n)})})}function YJ({label:e,children:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flex whitespace-nowrap text-fg-quinary",children:ff(e)}),t]})}function Gb(e){return typeof e.key!="string"}function JJ({path:e}){const t="union",n=Dt(e),r=at(e,t);if(n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(Gb(n.data))return typeof o!="string"&&o!==null?f.jsx(nt,{path:e,error:"Expected source to be a string, but found: "+typeof o,type:t}):f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(ZJ,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(i=>(i==null?void 0:i.type)==="literal"?[i.value]:(console.warn("Unexpected item in string union",i),[]))})]});if(!Gb(n.data))return typeof o!="object"?f.jsx(nt,{path:e,error:"Expected source to be an object, but found: "+typeof o,type:t}):Array.isArray(o)?f.jsx(nt,{path:e,error:"Expected source to be an object, but found an array",type:t}):f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(XJ,{path:e,schema:n.data})]})}function XJ({path:e,schema:t}){const n=kS(e),{addPatch:r,patchPath:o}=On(e),i=Gr(),s=ca(e,t.key),a=at(s,"literal");if(!("data"in a)||a.data===void 0)return f.jsx(gt,{path:e,type:"union"});const l=t.items.find(d=>{var p;const h=(p=d.items)==null?void 0:p[t.key];return h.type==="literal"?h.value===a.data:(console.error("Expected literal schema in object union",h),!1)});if((l==null?void 0:l.items)===void 0)return f.jsx(gt,{path:e,type:"union"});const c=t.items.flatMap(d=>{var p;const h=(p=d.items)==null?void 0:p[t.key];return h.type==="literal"?[h.value]:(console.error("Expected literal schema in object union",h),[])}),u=g.useRef({});return g.useEffect(()=>{n!==void 0&&a.data!==void 0&&typeof a.data=="string"&&n.status==="success"&&(u.current[e]||(u.current[e]={}),u.current[e][a.data]=n.data)},[n,a,e]),f.jsxs("div",{className:"grid gap-4",children:[f.jsxs(rk,{value:a.data??void 0,onValueChange:d=>{const h=t.items.find(m=>{var x;const v=(x=m.items)==null?void 0:x[t.key];return v.type==="literal"?v.value===d:(console.error("Expected literal schema in object union",v),!1)});if((h==null?void 0:h.items)===void 0){console.error(`Selected schema with ${t.key} = ${d} not found`);return}const p=u.current[e][d]||vu(h);p[t.key]=d,r([{op:"replace",path:o,value:p}],t.type)},children:[f.jsx(fy,{children:f.jsx(ok,{children:a.data})}),f.jsx(hy,{container:i,className:"w-32",children:c==null?f.jsx(r2,{}):c.map(d=>f.jsx(py,{value:d,children:d},d))})]}),Object.keys(l==null?void 0:l.items).filter(d=>d!==(t==null?void 0:t.key)).map(d=>{var p,m,v;const h=ca(e,d);return f.jsx(t2,{path:h,foldLevel:"1",transparent:!0,label:d,type:(m=(p=l==null?void 0:l.items)==null?void 0:p[d])==null?void 0:m.type,children:f.jsx(zy,{path:h,schema:(v=l==null?void 0:l.items)==null?void 0:v[d]},d)},h)})]})}function ZJ({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=On(e),i=Gr();return f.jsxs(rk,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}],"union")},children:[f.jsx(fy,{children:f.jsx(ok,{children:t})}),f.jsx(hy,{className:"w-32",container:i,children:n==null?f.jsx(r2,{}):n.map(s=>f.jsx(py,{value:s,children:s},s))})]})}function r2(){return f.jsx("div",{children:"Loading..."})}function QJ({path:e}){const t="union",n=kS(e),r=Dt(e);if(n.status==="error")return f.jsx(nt,{path:e,error:n.error,type:"union"});if(!("data"in n)||n.data===void 0)return f.jsx(mr,{path:e});if(!("data"in r)||r.data===void 0)return f.jsx(mr,{path:e});if(n.data===null)return f.jsx(gr,{path:e});if(r.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(Gb(o))return typeof n.data!="string"?f.jsx(nt,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,type:t}):f.jsx("div",{className:"truncate",children:n.data});{const i=n.data;if(!i)return f.jsx(gr,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return f.jsx(nt,{path:e,error:"Expected source to be an object, but found: "+typeof i,type:t});const s=o.items.find(a=>{var c;const l=(c=a.items)==null?void 0:c[o.key];if((l==null?void 0:l.type)==="literal"&&i!==null&&typeof i=="object"&&o.key in i&&!Ys(i))return l.value===i[o.key]});return s?f.jsx(n2,{path:e,schema:s}):f.jsx(nt,{path:e,error:"Expected source to have key "+o.key+" but it was not found",type:t})}}function o2(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=new Image;a.addEventListener("load",()=>{const l=Iv.Buffer.from(s.split(",")[1],"base64"),c=X.getSHA256Hash(l);if(a.naturalWidth&&a.naturalHeight){const u=X.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,fileHash:c,mimeType:u,fileExt:u&&X.mimeTypeToFileExt(u)})}else t({src:s,filename:r==null?void 0:r.name,fileHash:c})}),a.src=s}else n(s?{message:"Unexpected image result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function eX(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=Iv.Buffer.from(s.split(",")[1],"base64"),l=X.getSHA256Hash(a),c=X.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,fileHash:l,mimeType:c,fileExt:c&&X.mimeTypeToFileExt(c)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function tX(e){return e.split(".").pop()||""}const nX=new TextEncoder;async function i2(e,t,n,r,o,i,s,a="/public/val"){const l=X.createFilename(t,n,o,r);if(!l||!o)return[];const c=`${a}/${l}`,u=X.remote.hashToRemoteFileHash(r),d=s?X.remote.createRemoteRef(s.remoteHost,{publicProjectId:s.publicProjectId,coreVersion:s.coreVersion,bucket:s.bucket,validationHash:X.remote.getValidationHash(s.coreVersion,s.schema,tX(l),o,u,nX),fileHash:u,filePath:`${a.slice(1)}/${l}`}):c;return[{value:{[vt]:d,[Ie]:s?"remote":"file",...i!=="file"?{[fb]:i}:{},metadata:o},op:"replace",path:e},{value:t,metadata:o,op:"file",path:e,filePath:d,remote:s!==null}]}function rX({path:e}){var U;const t="file",n=Fu(),r=yS(),o=vS(),i=Dt(e),s=at(e,t),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,h]=g.useState(null),[p,m]=g.useState(!1),{patchPath:v,addAndUploadPatchWithFileOps:x}=On(e),[b,w]=g.useState(null),S="data"in s&&s.data,C=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{if(S&&S.metadata&&!C){const $=Ie in S&&S[Ie]==="remote"?X.convertRemoteSource({...S,[Ie]:"remote"}).url:X.convertFileSource({...S,[Ie]:"file"}).url;h($),m(!1)}},[s]),g.useEffect(()=>{var $,K,W;i.status==="success"&&i.data.type==="file"&&((K=($=i.data.options)==null?void 0:$.accept)!=null&&K.startsWith("video/"))&&l(!0),S&&typeof((W=S.metadata)==null?void 0:W.mimeType)=="string"&&(S.metadata.mimeType.startsWith("video/")?l(!0):l(!1))},[i,S]),i.status==="error")return f.jsx(Jt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(i.status==="loading")return f.jsx(gt,{path:e,type:t});if(n===void 0)return f.jsx(gt,{path:e,type:t});if(i.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:i.data.type});const _=s.data;if(_===void 0)return f.jsx(Pn,{path:e,type:t});const O=i.data.type==="file"&&i.data.remote&&o.status!=="ready",M=i.data.remote&&o.status==="ready"&&r?{publicProjectId:o.publicProjectId,coreVersion:o.coreVersion,bucket:r,schema:i.data,remoteHost:n.remoteHost}:null;let I=null;if(_!=null&&_._ref)if(i.data.remote){const $=X.remote.splitRemoteRef(_==null?void 0:_._ref);$.status==="success"&&(I=$.filePath)}else I=_==null?void 0:_._ref;let L=null;return I&&(L=I.split("/").slice(-1)[0]),f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),c&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:c}),f.jsxs("div",{className:"grid gap-2",children:[L&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"text-sm text-text-secondary",children:L}),p&&f.jsx(co,{className:`animate-spin text-text-secondary ${p?"block":"hidden"}`,size:16}),b!==null&&f.jsxs("div",{className:"text-sm text-text-secondary",children:[b,"%"]})]}),f.jsxs("div",{className:"flex items-center gap-4",children:[_&&(a?f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("video",{className:"w-full h-auto rounded-lg",controls:!0,src:Ie in _&&_[Ie]==="remote"?X.convertRemoteSource({..._,[Ie]:"remote"}).url:X.convertFileSource({..._,[Ie]:"file"}).url}),f.jsx(_t,{asChild:!0,variant:"ghost",className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})})]}):f.jsxs(f.Fragment,{children:[f.jsx(_t,{asChild:!0,variant:"ghost",className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})}),f.jsxs("a",{className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",download:L,href:Ie in _&&_[Ie]==="remote"?X.convertRemoteSource({..._,[Ie]:"remote"}).url:X.convertFileSource({..._,[Ie]:"file"}).url,children:[f.jsx("span",{children:" Open file"}),f.jsx($7,{})]})]})),f.jsx("input",{disabled:O,hidden:!0,id:`file_input:${e}`,type:"file",accept:(U=i.data.options)==null?void 0:U.accept,onChange:$=>{eX($).then(K=>{var N;const W="file",B=d;h(K.src),m(!0);const A={src:K.src,filename:K.filename};let R;K.mimeType&&(R={mimeType:K.mimeType}),u(null),i2(v,A.src,A.filename??null,K.fileHash,R,W,M,(N=n.files)==null?void 0:N.directory).then(D=>{m(!0),w(0),x(D,W,z=>{h(B),u(z)},(z,V,G,_e)=>{const Se=z*(G+1)/(V*_e);w(Math.round(Se*100))}).finally(()=>{w(null),m(!1)})}).catch(D=>{console.error("Failed to create file patch",D),m(!1),h(B),u("Could not upload file. Please try again later")}),$.target.value=""})}})]})]})]})}function oX({path:e}){const t=at(e,"image");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"image"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx(_R,{size:12})}function iX({path:e}){var K,W,B,A;const t="image",n=Fu(),r=vS(),o=yS(),i=Dt(e),s=at(e,t),[a,l]=g.useState(void 0),[c,u]=g.useState(null),[d,h]=g.useState(null),[p,m]=g.useState(!1),{addPatch:v,patchPath:x,addAndUploadPatchWithFileOps:b}=On(e),[w,S]=g.useState(null),C="data"in s&&s.data,_=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{if(C)if(C.metadata){if(!_){const N=Ie in C&&C[Ie]==="remote"?X.convertRemoteSource({...C,[Ie]:"remote"}).url:X.convertFileSource({...C,[Ie]:"file"}).url;h(N),m(!1)}const R=C.metadata;if(typeof R.width!="number"||typeof R.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof R.width} and height was: ${typeof R.height}`);return}if("hotspot"in R){if(typeof R.hotspot=="object"&&R.hotspot&&"x"in R.hotspot&&"y"in R.hotspot){const{x:N,y:D}=R.hotspot;typeof N=="number"&&typeof D=="number"?l({x:N,y:D}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof N} and y: ${typeof D}`)}}else l(void 0)}else l(void 0)},[s]),i.status==="error")return f.jsx(Jt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(i.status==="loading")return f.jsx(gt,{path:e,type:t});if(n===void 0)return f.jsx(gt,{path:e,type:t});if(i.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:i.data.type});const P=s.data;if(P===void 0)return f.jsx(Pn,{path:e,type:t});const M=i.data.type==="image"&&i.data.remote&&r.status!=="ready",I=i.data.remote&&r.status==="ready"&&o?{publicProjectId:r.publicProjectId,bucket:o,coreVersion:r.coreVersion,schema:i.data,remoteHost:n.remoteHost}:null,L=X.createValPathOfItem(e,"metadata"),U=X.createValPathOfItem(L,"alt"),$=X.createValPathOfItem(L,"hotspot");return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),c&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:c}),i.data.type==="image"&&i.data.remote&&r.status==="inactive"&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:sX(r.reason)}),f.jsxs("div",{className:"flex flex-col gap-2",children:[P&&f.jsxs("div",{className:"p-4 rounded-lg bg-bg-secondary",children:[f.jsx("span",{id:U,children:"Alt text"}),f.jsx(Gu,{value:(K=P.metadata)!=null&&K.alt&&typeof((W=P.metadata)==null?void 0:W.alt)=="string"?(B=P.metadata)==null?void 0:B.alt:"",disabled:M,onChange:R=>{const N=R.target.value;P.metadata&&"alt"in P.metadata?v([{op:"replace",value:N,path:x.concat(["metadata","alt"])}],"string"):P.metadata&&!("alt"in P.metadata)?v([{op:"add",value:N,path:x.concat(["metadata","alt"])}],"string"):P.metadata===void 0?v([{op:"add",value:{...a?{hotspot:a}:{},alt:N},path:x.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof P.metadata}`)}})]}),P&&d&&f.jsxs("div",{className:"relative rounded-lg bg-bg-secondary",children:[p&&f.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[f.jsx("div",{className:"absolute inset-0 w-full h-full opacity-50 bg-bg-secondary"}),f.jsx(co,{size:24,className:"animate-spin"}),f.jsx("div",{className:"mt-2 text-xs font-thin text-white z-5",children:w!==null?`${w}%`:""})]}),f.jsx("img",{src:d,draggable:!1,className:"object-contain max-h-[500px] w-full",style:{cursor:"crosshair"},id:$,onClick:R=>{const{width:N,height:D,left:z,top:V}=R.currentTarget.getBoundingClientRect(),G={x:Math.max((R.clientX-6-z)/N,0),y:Math.max((R.clientY-6-V)/D,0)};P.metadata&&"hotspot"in P.metadata?v([{op:"replace",path:x.concat(["metadata","hotspot"]),value:G}],"object"):P.metadata?v([{op:"add",path:x.concat(["metadata","hotspot"]),value:G}],"object"):P.metadata===void 0?v([{op:"add",value:{...G?{hotspot:G}:{}},path:x.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof P.metadata}`)}}),a&&f.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-solid border-2 absolute pointer-events-none",style:{top:`${a.y*100}%`,left:`${a.x*100}%`}})]}),f.jsx(_t,{asChild:!0,className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`img_input:${e}`,children:"Upload"})}),f.jsx("input",{disabled:s.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((A=i.data.options)==null?void 0:A.accept)||"image/*",onChange:R=>{o2(R).then(N=>{var _e,Se;const D="image",z=d;h(N.src),m(!0);const V={src:N.src,filename:N.filename};let G;N.width&&N.height&&N.mimeType&&(G={width:N.width,height:N.height,mimeType:N.mimeType,alt:C&&typeof((_e=C==null?void 0:C.metadata)==null?void 0:_e.alt)=="string"?C.metadata.alt:void 0}),u(null),i2(x,V.src,V.filename??null,N.fileHash,G,D,I,(Se=n.files)==null?void 0:Se.directory).then(Be=>{m(!0),S(0),b(Be,D,Z=>{h(z),u(Z)},(Z,Y,ce,Ee)=>{const fe=Z*(ce+1)/(Y*Ee);S(Math.round(fe*100))}).finally(()=>{S(null),m(!1)})}).catch(Be=>{console.error("Failed to create file patch",Be),m(!1),h(z),u("Could not upload file. Please try again later")}),R.target.value=""})}})]})]})}function sX(e){switch(e){case"api-key-missing":return"Val is running in production mode. To upload remote files and images, the VAL_API_KEY env must be set. Contact a developer to fix this issue.";case"error-could-not-get-settings":return`Could not get settings from the Val remote server. This means that updating or changing certain types of files and images might not work. Check your internet connection and try again. (Error code: ${e})`;case"no-internet-connection":return"Cannot upload remote files and images, since this requires an internet connection";case"pat-error":return"Val is running in development mode. To upload remote files and images, you must either login (by running `npx -p @valbuild/cli val login`) or set the VAL_API_KEY env";case"project-not-configured":return"Project is not configured. To upload remote files and images, the val.config must contain a project id that is obtained from https://app.val.build. Contact a developer to fix this issue.";case"unauthorized":return"Cannot upload remote files and images since you are unauthorized";case"unauthorized-personal-access-token-error":return"Cannot upload remote files and images since the personal access token is unauthorized. Try to login again by running `npx -p @valbuild/cli val login`";case"unknown-error":return"Unknown error";default:return e}}function aX({path:e}){const t=at(e,"image");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"image"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=t.data;return f.jsx("img",{src:Ie in n&&n[Ie]==="remote"?X.convertRemoteSource({...n,[Ie]:"remote"}).url:X.convertFileSource({...n,[Ie]:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function lX({path:e}){const t="keyOf",{navigate:n}=Mn(),r=Dt(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:r.data.schema.type,path:r.data.path}:void 0,i=at(o==null?void 0:o.path,o==null?void 0:o.type),s=at(e,t),{patchPath:a,addPatch:l}=On(e),c=Gr();if(r.status==="error")return f.jsx(Jt,{path:e,error:r.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:o==null?void 0:o.type});if(s.status=="not-found"||r.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return f.jsx(Jt,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&i.status==="not-found")return f.jsx(Jt,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in s)||s.data===void 0)return f.jsx(gt,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:r.data.type});if(!i)return f.jsx(Jt,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in i&&i.data===null)return f.jsx(Jt,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in i&&i.data?Object.keys(i.data):void 0,d=s.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),u&&u.length>0&&d!==null&&!u.includes(d)&&f.jsx("div",{className:"flex flex-col gap-2 p-4 rounded bg-bg-error-primary text-text-error-primary",children:f.jsxs("span",{children:["Value must be one of: ",u.join(", ")]})}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs(rk,{value:d??"",onValueChange:h=>{l([{op:"replace",path:a,value:h}],t)},children:[f.jsx(fy,{children:f.jsx(ok,{children:d})}),f.jsx(hy,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?f.jsx(cX,{}):u.map(h=>f.jsx(py,{value:h,children:h},h))})]}),d&&(o==null?void 0:o.path)&&f.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(X.createValPathOfItem(o.path,d))},children:f.jsx(m7,{size:16})})]})]})}function cX(){return f.jsx("span",{children:"Loading..."})}function uX({path:e}){const t=at(e,"keyOf");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"keyOf"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function s2({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return f.jsx(H8,{showOutsideDays:r,captionLayout:n,className:ze("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex flex-row justify-center pt-1 relative items-center",caption_dropdowns:"flex flex-row space-x-2",caption_label:`text-sm font-medium ${i?"hidden":""}`,nav:"space-x-1 flex items-center",dropdown_month:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown_year:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown:"bg-transparent border-solid rounded-md border-2 border-secondary",nav_button:ze(Rb({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:ze(Rb({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",...t},components:{IconLeft:()=>f.jsx(v7,{className:"w-4 h-4"}),IconRight:()=>f.jsx(Gv,{className:"w-4 h-4"}),Dropdown:({caption:s,children:a,value:l,onChange:c})=>{const u=d=>{c&&c({target:{value:d}})};return f.jsx("div",{className:"flex flex-row space-x-2",children:f.jsxs(KA,{onValueChange:u,value:String(l),children:[f.jsx(ek,{asChild:!0,children:f.jsxs(_t,{variant:"ghost",size:"sm",children:[s,f.jsx(Zh,{className:"w-4 h-4"})]})}),f.jsx(tk,{className:"z-50 p-1 rounded-md bg-bg-secondary_alt text-text-secondary",children:f.jsx(GA,{className:"pb-4 pr-4 overflow-y-auto rounded-md shadow-lg max-h-48 bg-bg-tertiary text-text-tertiary",children:g.Children.map(a,d=>{if(g.isValidElement(d)){const{value:h,children:p}=d.props;return f.jsx(nk,{value:String(h),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary_hover hover:text-text-secondary_hover",children:f.jsx(YA,{children:p})},h)}return null})})})]})})}},...o})}s2.displayName="Calendar";function dX({path:e}){var h,p;const t="date",n=Dt(e),r=at(e,t),{patchPath:o,addPatch:i}=On(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=Gr();if(g.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const m=new Date(r.data);a(m)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return f.jsx(Jt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const d=n.data;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsxs(ss,{open:l,onOpenChange:m=>{c(m)},children:[f.jsx(Vu,{asChild:!0,onClick:()=>{c(!0)},children:f.jsxs(_t,{variant:"outline",className:ve("w-[280px] justify-start text-left font-normal bg-bg-primary",!s&&"text-muted-foreground"),children:[f.jsx(kR,{className:"w-4 h-4 mr-2"}),s?us(s,"PPP"):f.jsx("span",{children:"Pick a date"})]})}),f.jsx(pi,{className:"w-auto p-0",container:u,children:f.jsx(s2,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(h=d.options)!=null&&h.from?new Date(d.options.from):void 0,toDate:(p=d.options)!=null&&p.to?new Date(d.options.to):void 0,selected:s||void 0,onSelect:m=>{m&&(a(m),i([{op:"replace",value:m.toISOString().slice(0,10),path:o}],d.type),c(!1))}})})]})]})}function fX({path:e}){const t=at(e,"date");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"date"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function hX({path:e}){const t=at(e,"literal");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"literal"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{id:e,className:"truncate",children:t.data})}function a2(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function l2(){return f.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-primary"})}function c2({error:e}){return f.jsx("div",{className:"p-4 text-white bg-bg-error-primary",children:f.jsxs("div",{children:["Preview error: ",e]})})}function pX({path:e}){const t="record",n=Da()||{},{navigate:r}=Mn(),o=Dt(e),i=xR(e),s=at(e,t);if(o.status==="error")return f.jsx(Jt,{path:e,error:o.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||o.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(o.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in s)||s.data===void 0)return f.jsx(gt,{path:e,type:t});if(o.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:o.data.type});const a=s.data,l=i&&"data"in i&&i.data&&i.data.layout==="list"&&i.data.parent==="record"?i.data:void 0;return f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),(i==null?void 0:i.status)==="error"&&f.jsx(c2,{error:i.message,path:e}),l&&f.jsx(gX,{path:e,...l}),!l&&f.jsx("div",{className:"grid grid-cols-1 gap-4",children:a&&Object.entries(a).map(([c])=>f.jsxs("div",{onClick:()=>r(ca(e,c)),className:ve("bg-primary-foreground cursor-pointer min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4","hover:bg-bg-secondary_subtle"),children:[f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsx("div",{className:"pb-4 font-semibold text-md",children:c}),a2(ca(e,c),n)&&f.jsx(l2,{})]}),f.jsx("div",{children:f.jsx(tE,{path:ca(e,c)})})]},c))})]})}function mX({title:e,image:t,subtitle:n}){return f.jsxs("div",{className:ve("flex w-full items-start justify-between pl-4 flex-grow text-left"),children:[f.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[f.jsx("div",{className:"text-lg font-medium",children:e}),n&&f.jsx("div",{className:"flex-shrink block overflow-hidden text-sm text-gray-500 text-ellipsis max-h-5",children:n})]}),t&&f.jsx(vX,{src:t,alt:e})]})}function gX({path:e,items:t}){const{navigate:n}=Mn();return f.jsx("div",{className:"flex flex-col w-full space-y-4",children:t.map(([r,{title:o,subtitle:i,image:s}])=>f.jsx("button",{onClick:()=>n(ca(e,r)),className:ve("hover:bg-bg-secondary_subtle","border rounded-lg cursor-pointer border-border-primary"),children:f.jsx(mX,{title:o,subtitle:i,image:s})},r))})}function vX({src:e,alt:t}){var i;const[n,r]=g.useState(!1);if(e==null)return f.jsx("div",{className:"flex-shrink-0 w-20 h-20 ml-4 opacity-25 bg-bg-brand-secondary"});const o=e[Ie]==="file"?X.convertFileSource(e).url:X.convertRemoteSource(e).url;return f.jsxs("div",{className:"relative flex-shrink-0 w-20 h-20 ml-4",children:[!n&&f.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),f.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(i=e.metadata)!=null&&i.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function yX({path:e}){const t=at(e,"record");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"record"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=Object.keys(t.data);return f.jsxs("div",{className:"text-left",children:[f.jsx("span",{className:"text-fg-brand-primary",children:n.length}),f.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let gy=()=>({events:{},emit(e,...t){(this.events[e]||[]).forEach(n=>n(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(n=>n!==t)}});var qb={exports:{}};(function(e,t){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;o===void 0&&(o=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var h=u.stack;return r(this,"stack",{configurable:!0,value:h,writable:!0}),h},set:function(h){r(c,"stack",{configurable:!0,value:h,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),o(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var s=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},s!==void 0&&(s(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}t=e.exports=a,t.BaseError=i})(qb,qb.exports);var u2=qb.exports,U_="ProseMirror-selectednode",d2="",Js="\0",H_="__state_override__",xX={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},He=xX,as=Symbol.for("__remirror__"),mn=(e=>(e.PlainExtension="RemirrorPlainExtension",e.NodeExtension="RemirrorNodeExtension",e.MarkExtension="RemirrorMarkExtension",e.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",e.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",e.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",e.Manager="RemirrorManager",e.Preset="RemirrorPreset",e.PresetConstructor="RemirrorPresetConstructor",e))(mn||{}),ht=(e=>(e[e.Critical=1e6]="Critical",e[e.Highest=1e5]="Highest",e[e.High=1e4]="High",e[e.Medium=1e3]="Medium",e[e.Default=100]="Default",e[e.Low=10]="Low",e[e.Lowest=0]="Lowest",e))(ht||{}),ir=(e=>(e[e.None=0]="None",e[e.Create=1]="Create",e[e.EditorView=2]="EditorView",e[e.Runtime=3]="Runtime",e[e.Destroy=4]="Destroy",e))(ir||{}),oe=(e=>(e.Undo="_|undo|_",e.Redo="_|redo|_",e.Bold="_|bold|_",e.Italic="_|italic|_",e.Underline="_|underline|_",e.Strike="_|strike|_",e.Code="_|code|_",e.Paragraph="_|paragraph|_",e.H1="_|h1|_",e.H2="_|h2|_",e.H3="_|h3|_",e.H4="_|h4|_",e.H5="_|h5|_",e.H6="_|h6|_",e.TaskList="_|task|_",e.BulletList="_|bullet|_",e.OrderedList="_|number|_",e.Quote="_|quote|_",e.Divider="_|divider|_",e.Codeblock="_|codeblock|_",e.ClearFormatting="_|clear|_",e.Superscript="_|sup|_",e.Subscript="_|sub|_",e.LeftAlignment="_|left-align|_",e.CenterAlignment="_|center-align|_",e.RightAlignment="_|right-align|_",e.JustifyAlignment="_|justify-align|_",e.InsertLink="_|link|_",e.Find="_|find|_",e.FindBackwards="_|find-backwards|_",e.FindReplace="_|find-replace|_",e.AddFootnote="_|footnote|_",e.AddComment="_|comment|_",e.ContextMenu="_|context-menu|_",e.IncreaseFontSize="_|inc-font-size|_",e.DecreaseFontSize="_|dec-font-size|_",e.IncreaseIndent="_|indent|_",e.DecreaseIndent="_|dedent|_",e.Shortcuts="_|shortcuts|_",e.Copy="_|copy|_",e.Cut="_|cut|_",e.Paste="_|paste|_",e.PastePlain="_|paste-plain|_",e.SelectAll="_|select-all|_",e.Format="_|format|_",e))(oe||{}),re=(e=>(e.PROD="RMR0000",e.UNKNOWN="RMR0001",e.INVALID_COMMAND_ARGUMENTS="RMR0002",e.CUSTOM="RMR0003",e.CORE_HELPERS="RMR0004",e.MUTATION="RMR0005",e.INTERNAL="RMR0006",e.MISSING_REQUIRED_EXTENSION="RMR0007",e.MANAGER_PHASE_ERROR="RMR0008",e.INVALID_GET_EXTENSION="RMR0010",e.INVALID_MANAGER_ARGUMENTS="RMR0011",e.SCHEMA="RMR0012",e.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",e.INVALID_MANAGER_EXTENSION="RMR0014",e.DUPLICATE_COMMAND_NAMES="RMR0016",e.DUPLICATE_HELPER_NAMES="RMR0017",e.NON_CHAINABLE_COMMAND="RMR0018",e.INVALID_EXTENSION="RMR0019",e.INVALID_CONTENT="RMR0021",e.INVALID_NAME="RMR0050",e.EXTENSION="RMR0100",e.EXTENSION_SPEC="RMR0101",e.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",e.INVALID_SET_EXTENSION_OPTIONS="RMR0103",e.REACT_PROVIDER_CONTEXT="RMR0200",e.REACT_GET_ROOT_PROPS="RMR0201",e.REACT_EDITOR_VIEW="RMR0202",e.REACT_CONTROLLED="RMR0203",e.REACT_NODE_VIEW="RMR0204",e.REACT_GET_CONTEXT="RMR0205",e.REACT_COMPONENTS="RMR0206",e.REACT_HOOKS="RMR0207",e.I18N_CONTEXT="RMR0300",e))(re||{}),bX=function(t){return wX(t)&&!SX(t)};function wX(e){return!!e&&typeof e=="object"}function SX(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||CX(e)}var kX=typeof Symbol=="function"&&Symbol.for,EX=kX?Symbol.for("react.element"):60103;function CX(e){return e.$$typeof===EX}function _X(e){return Array.isArray(e)?[]:{}}function uh(e,t){return t.clone!==!1&&t.isMergeableObject(e)?yu(_X(e),e,t):e}function PX(e,t,n){return e.concat(t).map(function(r){return uh(r,n)})}function NX(e,t){if(!t.customMerge)return yu;var n=t.customMerge(e);return typeof n=="function"?n:yu}function TX(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function W_(e){return Object.keys(e).concat(TX(e))}function f2(e,t){try{return t in e}catch{return!1}}function OX(e,t){return f2(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function MX(e,t,n){var r={};return n.isMergeableObject(e)&&W_(e).forEach(function(o){r[o]=uh(e[o],n)}),W_(t).forEach(function(o){OX(e,o)||(f2(e,o)&&n.isMergeableObject(t[o])?r[o]=NX(o,n)(e[o],t[o],n):r[o]=uh(t[o],n))}),r}function yu(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||PX,n.isMergeableObject=n.isMergeableObject||bX,n.cloneUnlessOtherwiseSpecified=uh;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):MX(e,t,n):uh(t,n)}yu.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return yu(r,o,n)},{})};var jX=yu,RX=jX;const IX=Ma(RX);/*!
|
|
430
430
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
431
431
|
*
|
|
432
432
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
@@ -451,7 +451,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
451
451
|
*
|
|
452
452
|
* Copyright (c) 2014-2015 Jon Schlinkert, contributors.
|
|
453
453
|
* Licensed under the MIT License
|
|
454
|
-
*/var BX=h2,VX=function(t,n){if(!BX(t)&&typeof t!="function")return{};var r={};if(typeof n=="string")return n in t&&(r[n]=t[n]),r;for(var o=n.length,i=-1;++i<o;){var s=n[i];s in t&&(r[s]=t[s])}return r};const Yb=Ma(VX),p2=/^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g,UX=/\S+/g;function HX(e,t){const n={parts:[],prefixes:[]},r=e.matchAll(t);let o=0;for(const s of r){if(typeof s.index!="number")continue;const a=s[0];n.parts.push(a);const l=e.slice(o,s.index).trim();n.prefixes.push(l),o=s.index+a.length}const i=e.slice(o).trim();return i&&(n.parts.push(""),n.prefixes.push(i)),n}function m2(e,t){const{keepSpecialCharacters:n=!1,keep:r,prefix:o=""}=t||{},i=e.trim().normalize("NFC"),s=i.includes(" "),l=HX(i,s?UX:p2);return l.parts.map((c,u)=>{let d=l.prefixes[u]||"",h=c;return n===!1&&(r&&(h=h.normalize("NFD").replace(new RegExp(`[^a-zA-ZØßø0-9${r.join("")}]`,"g"),"")),r||(h=h.normalize("NFD").replace(/[^a-zA-ZØßø0-9]/g,""),d="")),r&&(d=d.replace(new RegExp(`[^${r.join("")}]`,"g"),"")),u===0?d+h:!d&&!h?"":s&&!d&&o.match(/\s/)?" "+h:(d||o)+h}).filter(Boolean)}function WX(e){const t=e.matchAll(p2).next().value,n=t?t.index:0;return e.slice(0,n+1).toUpperCase()+e.slice(n+1).toLowerCase()}function g2(e,t){return m2(e,t).reduce((n,r)=>n+WX(r),"")}function G_(e,t){return m2(e,{...t,prefix:"-"}).join("").toLowerCase()}function Jb(e,t,n,r){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function l(){a(),i=!0}typeof t!="boolean"&&(r=n,n=t,t=void 0);function c(){for(var u=arguments.length,d=new Array(u),h=0;h<u;h++)d[h]=arguments[h];var p=this,m=Date.now()-s;if(i)return;function v(){s=Date.now(),n.apply(p,d)}function x(){o=void 0}r&&!o&&v(),a(),r===void 0&&m>e?v():t!==!0&&(o=setTimeout(r?x:v,r===void 0?e-m:e))}return c.cancel=l,c}function KX(e,t,n){return n===void 0?Jb(e,t,!1):Jb(e,n,t!==!1)}function Rt(e,t,n){const r=e[t];return v2(!yy(r),n),r}function v2(e,t){if(!e)throw new GX(t)}var GX=class extends u2.BaseError{constructor(){super(...arguments),this.name="AssertionError"}};function rn(e){return Object.entries(e)}function dh(e){return Object.keys(e)}function vy(e){return Object.values(e)}function Go(e,t,n){return e.includes(t,n)}function we(e){return Object.assign(Object.create(null),e)}function y2(e){return Object.prototype.toString.call(e)}function x2(e){return y2(e).slice(8,-1)}function cp(e,t){return n=>typeof n!==e?!1:t?t(n):!0}function sk(e){return t=>x2(t)===e}var yy=cp("undefined"),
|
|
454
|
+
*/var BX=h2,VX=function(t,n){if(!BX(t)&&typeof t!="function")return{};var r={};if(typeof n=="string")return n in t&&(r[n]=t[n]),r;for(var o=n.length,i=-1;++i<o;){var s=n[i];s in t&&(r[s]=t[s])}return r};const Yb=Ma(VX),p2=/^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g,UX=/\S+/g;function HX(e,t){const n={parts:[],prefixes:[]},r=e.matchAll(t);let o=0;for(const s of r){if(typeof s.index!="number")continue;const a=s[0];n.parts.push(a);const l=e.slice(o,s.index).trim();n.prefixes.push(l),o=s.index+a.length}const i=e.slice(o).trim();return i&&(n.parts.push(""),n.prefixes.push(i)),n}function m2(e,t){const{keepSpecialCharacters:n=!1,keep:r,prefix:o=""}=t||{},i=e.trim().normalize("NFC"),s=i.includes(" "),l=HX(i,s?UX:p2);return l.parts.map((c,u)=>{let d=l.prefixes[u]||"",h=c;return n===!1&&(r&&(h=h.normalize("NFD").replace(new RegExp(`[^a-zA-ZØßø0-9${r.join("")}]`,"g"),"")),r||(h=h.normalize("NFD").replace(/[^a-zA-ZØßø0-9]/g,""),d="")),r&&(d=d.replace(new RegExp(`[^${r.join("")}]`,"g"),"")),u===0?d+h:!d&&!h?"":s&&!d&&o.match(/\s/)?" "+h:(d||o)+h}).filter(Boolean)}function WX(e){const t=e.matchAll(p2).next().value,n=t?t.index:0;return e.slice(0,n+1).toUpperCase()+e.slice(n+1).toLowerCase()}function g2(e,t){return m2(e,t).reduce((n,r)=>n+WX(r),"")}function G_(e,t){return m2(e,{...t,prefix:"-"}).join("").toLowerCase()}function Jb(e,t,n,r){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function l(){a(),i=!0}typeof t!="boolean"&&(r=n,n=t,t=void 0);function c(){for(var u=arguments.length,d=new Array(u),h=0;h<u;h++)d[h]=arguments[h];var p=this,m=Date.now()-s;if(i)return;function v(){s=Date.now(),n.apply(p,d)}function x(){o=void 0}r&&!o&&v(),a(),r===void 0&&m>e?v():t!==!0&&(o=setTimeout(r?x:v,r===void 0?e-m:e))}return c.cancel=l,c}function KX(e,t,n){return n===void 0?Jb(e,t,!1):Jb(e,n,t!==!1)}function Rt(e,t,n){const r=e[t];return v2(!yy(r),n),r}function v2(e,t){if(!e)throw new GX(t)}var GX=class extends u2.BaseError{constructor(){super(...arguments),this.name="AssertionError"}};function rn(e){return Object.entries(e)}function dh(e){return Object.keys(e)}function vy(e){return Object.values(e)}function Go(e,t,n){return e.includes(t,n)}function we(e){return Object.assign(Object.create(null),e)}function y2(e){return Object.prototype.toString.call(e)}function x2(e){return y2(e).slice(8,-1)}function cp(e,t){return n=>typeof n!==e?!1:t?t(n):!0}function sk(e){return t=>x2(t)===e}var yy=cp("undefined"),De=cp("string"),Br=cp("number",e=>!Number.isNaN(e)),Pt=cp("function");function qX(e){return e===null}function YX(e){return e===!0||e===!1}function Wl(e){if(x2(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})}function JX(e){return e==null||/^[bns]/.test(typeof e)}function Ca(e){return qX(e)||yy(e)}function Wn(e){return!Ca(e)&&(Pt(e)||cp("object")(e))}var XX=sk("RegExp");function ZX(e){return sk("Map")(e)}function QX(e){return sk("Set")(e)}function Dg(e){return Wn(e)&&!ZX(e)&&!QX(e)&&Object.keys(e).length===0}var on=Array.isArray;function _a(e){return on(e)&&e.length===0}function q_(e){return on(e)&&e.length>0}function xy(e,t,n=r=>!!r){t.lastIndex=0;const r=[],o=t.flags;let i;o.includes("g")||(t=new RegExp(t.source,`g${o}`));do i=t.exec(e),i&&r.push(i);while(n(i));return t.lastIndex=0,r}function Lg(){const e=Date.now(),t=Lg.last||e;return Lg.last=e>t?e:t+1}Lg.last=0;function Fg(e=""){return`${e}${Lg().toString(36)}`}function eZ(e){return ik(e,t=>!yy(t))}function tZ(e){if(!Wl(e))throw new Error("An invalid value was passed into this clone utility. Expected a plain object");return{...e}}function fh(e,t=!1){const n=t?[...e].reverse():e,r=new Set(n);return t?[...r].reverse():[...r]}function b2(){}function nZ(...e){return IX.all(e,{isMergeableObject:Wl})}function rZ({min:e,max:t,value:n}){return n<e?e:n>t?t:n}function oZ(e){return e[e.length-1]}function jl(e,t){return[...e].map((n,r)=>({value:n,index:r})).sort((n,r)=>t(n.value,r.value)||n.index-r.index).map(({value:n})=>n)}function iZ(e,t,n){try{if(De(t)&&t in e)return e[t];on(t)&&(t=`['${t.join("']['")}']`);let r=e;return t.replace(/\[\s*(["'])(.*?)\1\s*]|^\s*(\w+)\s*(?=\.|\[|$)|\.\s*(\w*)\s*(?=\.|\[|$)|\[\s*(-?\d+)\s*]/g,(o,i,s,a,l,c)=>(r=r[s||a||l||c],"")),r===void 0?n:r}catch{return n}}function sZ(e,t){const n=tZ(t);let r=n;for(const[o,i]of e.entries()){const s=o>=e.length-1;let a=r[i];if(s){if(on(r)){const l=Number.parseInt(i.toString(),10);Br(l)&&r.splice(l,1)}else Reflect.deleteProperty(r,i);return n}if(JX(a))return n;a=on(a)?[...a]:{...a},r[i]=a,r=a}return n}function aZ(e){return t=>iZ(t,e)}function w2(e,t,n=!1){const r=[],o=new Set,i=Pt(t)?t:aZ(t),s=n?[...e].reverse():e;for(const a of s){const l=i(a);o.has(l)||(o.add(l),r.push(a))}return n?r.reverse():r}function S2(e,t){const n=on(e)?e[0]:e;return Br(t)?n<=t?Array.from({length:t+1-n},(r,o)=>o+n):Array.from({length:n+1-t},(r,o)=>-1*o+n):Array.from({length:Math.abs(n)},(r,o)=>(n<0?-1:1)*o)}function Y_(e,...t){const n=t.filter(Br);return e>=Math.min(...n)&&e<=Math.max(...n)}function k2(e){return Pt(e)?e():e}var E2="https://remirror.io/docs/errors",lZ={[re.UNKNOWN]:"An error occurred but we're not quite sure why. 🧐",[re.INVALID_COMMAND_ARGUMENTS]:"The arguments passed to the command method were invalid.",[re.CUSTOM]:"This is a custom error, possibly thrown by an external library.",[re.CORE_HELPERS]:"An error occurred in a function called from the `@remirror/core-helpers` library.",[re.MUTATION]:"Mutation of immutable value detected.",[re.INTERNAL]:"This is an error which should not occur and is internal to the remirror codebase.",[re.MISSING_REQUIRED_EXTENSION]:"Your editor is missing a required extension.",[re.MANAGER_PHASE_ERROR]:"This occurs when accessing a method or property before it is available.",[re.INVALID_GET_EXTENSION]:"The user requested an invalid extension from the getExtensions method. Please check the `createExtensions` return method is returning an extension with the defined constructor.",[re.INVALID_MANAGER_ARGUMENTS]:"Invalid value(s) passed into `Manager` constructor. Only `Presets` and `Extensions` are supported.",[re.SCHEMA]:"There is a problem with the schema or you are trying to access a node / mark that doesn't exists.",[re.HELPERS_CALLED_IN_OUTER_SCOPE]:"The `helpers` method which is passed into the ``create*` method should only be called within returned method since it relies on an active view (not present in the outer scope).",[re.INVALID_MANAGER_EXTENSION]:"You requested an invalid extension from the manager.",[re.DUPLICATE_COMMAND_NAMES]:"Command method names must be unique within the editor.",[re.DUPLICATE_HELPER_NAMES]:"Helper method names must be unique within the editor.",[re.NON_CHAINABLE_COMMAND]:"Attempted to chain a non chainable command.",[re.INVALID_EXTENSION]:"The provided extension is invalid.",[re.INVALID_CONTENT]:"The content provided to the editor is not supported.",[re.INVALID_NAME]:"An invalid name was used for the extension.",[re.EXTENSION]:"An error occurred within an extension. More details should be made available.",[re.EXTENSION_SPEC]:"The spec was defined without calling the `defaults`, `parse` or `dom` methods.",[re.EXTENSION_EXTRA_ATTRIBUTES]:"Extra attributes must either be a string or an object.",[re.INVALID_SET_EXTENSION_OPTIONS]:"A call to `extension.setOptions` was made with invalid keys.",[re.REACT_PROVIDER_CONTEXT]:"`useRemirrorContext` was called outside of the `remirror` context. It can only be used within an active remirror context created by the `<Remirror />`.",[re.REACT_GET_ROOT_PROPS]:"`getRootProps` has been attached to the DOM more than once. It should only be attached to the dom once per editor.",[re.REACT_EDITOR_VIEW]:"A problem occurred adding the editor view to the dom.",[re.REACT_CONTROLLED]:"There is a problem with your controlled editor setup.",[re.REACT_NODE_VIEW]:"Something went wrong with your custom ReactNodeView Component.",[re.REACT_GET_CONTEXT]:"You attempted to call `getContext` provided by the `useRemirror` prop during the first render of the editor. This is not possible and should only be after the editor first mounts.",[re.REACT_COMPONENTS]:"An error occurred within a remirror component.",[re.REACT_HOOKS]:"An error occurred within a remirror hook.",[re.I18N_CONTEXT]:"You called `useI18n()` outside of an `I18nProvider` context."};function cZ(e){return De(e)&&Go(vy(re),e)}function uZ(e,t){const n=lZ[e],r=n?`${n}
|
|
455
455
|
|
|
456
456
|
`:"",o=t?`${t}
|
|
457
457
|
|
|
@@ -469,24 +469,24 @@ other {Heading}}`,comment:"Label for heading command with support for levels."};
|
|
|
469
469
|
`),d&&m==p.nodeValue.length)for(let v=p,x;v;v=v.parentNode){if(x=v.nextSibling){x.nodeName=="BR"&&(a=l={node:x.parentNode,offset:wn(x)+1});break}let b=v.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let v=p.childNodes[m-1];d=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(qo&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&Qn)&&Al(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Al(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||t==n)&&!d){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(t>n){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?t<=s&&n>=r:t<s&&n>r){let a=r+i.border,l=s-i.border;if(t>=a&&n<=l){this.dirty=t==r||n==s?il:CP,t==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=vi:i.markDirty(t-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?il:vi}r=s}this.dirty=il}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?il:CP;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(t){return!1}}class gD extends pp{constructor(t,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==io&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class uee extends pp{constructor(t,n,r,o){super(t,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Dl extends pp{constructor(t,n,r,o,i){super(t,[],r,o),this.mark=n,this.spec=i}static create(t,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=$a.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Dl(t,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&vi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=vi&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=io){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=io}}slice(t,n,r){let o=Dl.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=aw(i,n,s,r)),t>0&&(i=aw(i,0,t,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class fa extends pp{constructor(t,n,r,o,i,s,a,l,c){super(t,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(t,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=$a.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=bD(u,r,n),c?l=new dee(t,n,r,o,u,d||null,h,c,i,s+1):n.isText?new Sy(t,n,r,o,u,h,i):new fa(t,n,r,o,u,d||null,h,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>q.empty)}return t}matchesNode(t,n,r){return this.dirty==io&&t.eq(this.node)&&Gg(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,o=n,i=t.composing?this.localCompositionInfo(t,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new hee(this,s&&s.node,t);gee(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?tt.none:this.node.child(u).marks,r,t),l.placeWidget(c,t,o)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,t);let p;l.findNodeMatch(c,u,d,h)||a&&t.state.selection.from>o&&t.state.selection.to<o+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,p,t)||l.updateNextNode(c,u,d,t,h,o)||l.addNode(c,u,d,t,o),o+=c.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==il)&&(s&&this.protectLocalComposition(t,s),yD(this.contentDOM,this.children,t),ku&&vee(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof Le)||r<n||o>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=yee(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new uee(this,i,n,o);t.input.compositionNodes.push(s),this.children=aw(this.children,r,r+o.length,t,s)}update(t,n,r,o){return this.dirty==vi||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,o),!0)}updateInner(t,n,r,o){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=io}updateOuterDeco(t){if(Gg(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=xD(this.dom,this.nodeDOM,sw(this.outerDeco,this.node,n),sw(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function _P(e,t,n,r,o){bD(r,t,e);let i=new fa(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Sy extends fa{constructor(t,n,r,o,i,s,a){super(t,n,r,o,i,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,o){return this.dirty==vi||this.dirty!=io&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=io||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=io,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let o=this.node.cut(t,n),i=document.createTextNode(o.text);return new Sy(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=vi)}get domAtom(){return!1}isText(t){return this.node.text==t}}class vD extends pp{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==io&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class dee extends fa{constructor(t,n,r,o,i,s,a,l,c,u){super(t,n,r,o,i,s,a,c,u),this.spec=l}update(t,n,r,o){if(this.dirty==vi)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,o),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,o){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function yD(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=PP(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Dl){let l=r?r.previousSibling:e.lastChild;yD(s.contentDOM,s.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=PP(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const yf=function(e){e&&(this.nodeName=e)};yf.prototype=Object.create(null);const sl=[new yf];function sw(e,t,n){if(e.length==0)return sl;let r=n?sl[0]:new yf,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new yf(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new yf(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function xD(e,t,n,r){if(n==sl&&r==sl)return t;let o=t;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=sl[0]),o=l}fee(o,a||sl[0],s)}return o}function fee(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&e.classList.add(o[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(t.style);)e.style.removeProperty(o[1])}n.style&&(e.style.cssText+=n.style)}}function bD(e,t,n){return xD(e,e,sl,sw(t,n,e.nodeType!=1))}function Gg(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function PP(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class hee{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=pee(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,t.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=io,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(t[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Dl.create(this.top,t[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(t,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(t,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,o,i){let s=this.top.children[o];return s.dirty==vi&&s.dom==s.contentDOM&&(s.dirty=il),s.update(t,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}t=n}}updateNextNode(t,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof fa){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=vi&&Gg(n,l.outerDeco));if(!h&&l.update(t,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,t,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=il,d.updateChildren(o,s+1),d.dirty=io),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,o,i,s){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!Gg(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let a=fa.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,n,r,o,i){let s=fa.create(this.top,t,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(t)&&(t==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new gD(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof Dl;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof Sy)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Qn||$n)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new vD(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function pee(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Dl)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function mee(e,t){return e.type.side-t.type.side}function gee(e,t,n,r){let o=t.locals(e),i=0;if(o.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,o,t.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let x=o[s++];x.widget&&(u?(d||(d=[u])).push(x):u=x)}if(u)if(d){d.sort(mee);for(let x=0;x<d.length;x++)n(d[x],c,!!l)}else n(u,c,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let x=0;x<a.length;x++)a[x].to<=i&&a.splice(x--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let m=i+h.nodeSize;if(h.isText){let x=m;s<o.length&&o[s].from<x&&(x=o[s].from);for(let b=0;b<a.length;b++)a[b].to<x&&(x=a[b].to);x<m&&(l=h.cut(x-i),h=h.cut(0,x-i),m=x,p=-1)}else for(;s<o.length&&o[s].to<m;)s++;let v=h.isInline&&!h.isLeaf?a.filter(x=>!x.inline):a.slice();r(h,v,t.forChild(i,h),p),i=m}}function vee(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function yee(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let c=a<r?l.lastIndexOf(t,r-a-1):-1;if(c>=0&&c+t.length+a>=n)return a+c;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}function aw(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function mk(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(wy(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&Oe.isSelectable(d)&&o.parent&&!(d.isInline&&HQ(n.focusNode,n.focusOffset,o.dom))){let h=o.posBefore;c=new Oe(s==h?a:r.resolve(h))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,h=s;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);d=Math.min(d,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,s]=h==e.state.selection.anchor?[h,d]:[d,h],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=t=="pointer"||e.state.selection.head<a.pos&&!i?1:-1;c=gk(e,u,a,d)}return c}function wD(e){return e.editable?e.hasFocus():kD(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Yi(e,t=!1){let n=e.state.selection;if(SD(e,n),!!wD(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&$n){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Al(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)bee(e);else{let{anchor:r,head:o}=n,i,s;NP&&!(n instanceof Le)&&(n.$from.parent.inlineContent||(i=TP(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=TP(e,n.to))),e.docView.setSelection(r,o,e,t),NP&&(i&&OP(i),s&&OP(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&xee(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const NP=Qn||$n&&cD<63;function TP(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Qn&&o&&o.contentEditable=="false")return o0(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return o0(o);if(i)return o0(i)}}function o0(e){return e.contentEditable="true",Qn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function OP(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function xee(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!wD(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function bee(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,wn(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&pr&&da<=11&&(r.disabled=!0,r.disabled=!1)}function SD(e,t){if(t instanceof Oe){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(MP(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else MP(e)}function MP(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function gk(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||Le.between(t,n,r)}function jP(e){return e.editable&&!e.hasFocus()?!1:kD(e)}function kD(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function wee(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Al(t.node,t.offset,n.anchorNode,n.anchorOffset)}function lw(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Ke.findFrom(i,t)}function Ls(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function RP(e,t,n){let r=e.state.selection;if(r instanceof Le)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(o.pos+i.nodeSize*(t<0?-1:1));return Ls(e,new Le(r.$anchor,s))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=lw(e.state,t);return o&&o instanceof Oe?Ls(e,o):!1}else if(!(Zr&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=t<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=e.docView.descAt(a))&&!s.contentDOM?Oe.isSelectable(i)?Ls(e,new Oe(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):hp?Ls(e,new Le(e.state.doc.resolve(t<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Oe&&r.node.isInline)return Ls(e,new Le(t>0?r.$to:r.$from));{let o=lw(e.state,t);return o?Ls(e,o):!1}}}function qg(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function xf(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function sc(e,t){return t<0?See(e):kee(e)}function See(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(qo&&n.nodeType==1&&r<qg(n)&&xf(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(xf(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(ED(n))break;{let a=n.previousSibling;for(;a&&xf(a,-1);)o=n.parentNode,i=wn(a),a=a.previousSibling;if(a)n=a,r=qg(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?cw(e,n,r):o&&cw(e,o,i)}function kee(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=qg(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(xf(a,1))i=n,s=++r;else break}else{if(ED(n))break;{let a=n.nextSibling;for(;a&&xf(a,1);)i=a.parentNode,s=wn(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=qg(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&cw(e,i,s)}function ED(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Eee(e,t){for(;e&&t==e.childNodes.length&&!fp(e);)t=wn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function Cee(e,t){for(;e&&!t&&!fp(e);)t=wn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function cw(e,t,n){if(t.nodeType!=3){let i,s;(s=Eee(t,n))?(t=s,n=0):(i=Cee(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(wy(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&Yi(e)},50)}function IP(e,t){let n=e.state.doc.resolve(t);if(!($n||GQ)&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(t<n.end()){let i=e.coordsAtPos(t+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function AP(e,t,n){let r=e.state.selection;if(r instanceof Le&&!r.empty||n.indexOf("s")>-1||Zr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=lw(e.state,t);if(s&&s instanceof Oe)return Ls(e,s)}if(!o.parent.inlineContent){let s=t<0?o:i,a=r instanceof Xn?Ke.near(s,t):Ke.findFrom(s,t);return a?Ls(e,a):!1}return!1}function DP(e,t){if(!(e.state.selection instanceof Le))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=e.state.tr;return t<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),e.dispatch(s),!0}return!1}function LP(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function _ee(e){if(!Qn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;LP(e,r,"true"),setTimeout(()=>LP(e,r,"false"),20)}return!1}function Pee(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function Nee(e,t){let n=t.keyCode,r=Pee(t);if(n==8||Zr&&n==72&&r=="c")return DP(e,-1)||sc(e,-1);if(n==46&&!t.shiftKey||Zr&&n==68&&r=="c")return DP(e,1)||sc(e,1);if(n==13||n==27)return!0;if(n==37||Zr&&n==66&&r=="c"){let o=n==37?IP(e,e.state.selection.from)=="ltr"?-1:1:-1;return RP(e,o,r)||sc(e,o)}else if(n==39||Zr&&n==70&&r=="c"){let o=n==39?IP(e,e.state.selection.from)=="ltr"?1:-1:1;return RP(e,o,r)||sc(e,o)}else{if(n==38||Zr&&n==80&&r=="c")return AP(e,-1,r)||sc(e,-1);if(n==40||Zr&&n==78&&r=="c")return _ee(e)||AP(e,1,r)||sc(e,1);if(r==(Zr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function CD(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=e.someProp("clipboardSerializer")||$a.fromSchema(e.state.schema),a=MD(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=OD[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
|
|
470
470
|
|
|
471
471
|
`);return{dom:l,text:h,slice:t}}function _D(e,t,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!t)return null;let l=t&&(r||i||!n);if(l){if(e.someProp("transformPastedText",h=>{t=h(t,i||r,e)}),i)return t?new se(q.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
472
|
-
`))),0,0):se.empty;let d=e.someProp("clipboardTextParser",h=>h(t,o,r,e));if(d)a=d;else{let h=o.marks(),{schema:p}=e.state,m=$a.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(v=>{let x=s.appendChild(document.createElement("p"));v&&x.appendChild(m.serializeNode(p.text(v,h)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),s=jee(n),hp&&Ree(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||bu.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Tee.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Iee(FP(a,+u[1],+u[2]),u[4]);else if(a=se.maxOpen(Oee(a.content,o),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=FP(a,d,h)}return e.someProp("transformPasted",d=>{a=d(a,e)}),a}const Tee=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Oee(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&ND(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=TD(s[s.length-1],i.length));let u=PD(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return q.from(s)}return e}function PD(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,q.from(e));return e}function ND(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=ND(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(q.from(PD(n,e,o+1))))}}function TD(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,TD(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(q.empty,!0);return e.copy(n.append(r))}function uw(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=uw(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function FP(e,t,n){return t<e.openStart&&(e=new se(uw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new se(uw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const OD={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let zP=null;function MD(){return zP||(zP=document.implementation.createHTMLDocument("title"))}let i0=null;function Mee(e){let t=window.trustedTypes;return t?(i0||(i0=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),i0.createHTML(e)):e}function jee(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=MD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&OD[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Mee(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function Ree(e){let t=e.querySelectorAll($n?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function Iee(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:o,openStart:i,openEnd:s}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=q.from(l.create(r[a+1],o)),i++,s++}return new se(o,i,s)}const er={},tr={},Aee={touchstart:!0,touchmove:!0};class Dee{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Lee(e){for(let t in er){let n=er[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{zee(e,r)&&!vk(e,r)&&(e.editable||!(r.type in tr))&&n(e,r)},Aee[t]?{passive:!0}:void 0)}Qn&&e.dom.addEventListener("input",()=>null),dw(e)}function Zs(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Fee(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function dw(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>vk(e,r))})}function vk(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function zee(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function $ee(e,t){!vk(e,t)&&er[t.type]&&(e.editable||!(t.type in tr))&&er[t.type](e,t)}tr.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!RD(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(To&&$n&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),ku&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",o=>o(e,Qa(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||Nee(e,n)?n.preventDefault():Zs(e,"key")};tr.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};tr.keypress=(e,t)=>{let n=t;if(RD(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Zr&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Le)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",i=>i(e,r.$from.pos,r.$to.pos,o))&&e.dispatch(e.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function ky(e){return{left:e.clientX,top:e.clientY}}function Bee(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function yk(e,t,n,r,o){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,a=>s>i.depth?a(e,n,i.nodeAfter,i.before(s),o,!0):a(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Yc(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function Vee(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Oe.isSelectable(r)?(Yc(e,new Oe(n)),!0):!1}function Uee(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof Oe&&(r=n.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(Oe.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Yc(e,Oe.create(e.state.doc,o)),!0):!1}function Hee(e,t,n,r,o){return yk(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?Uee(e,n):Vee(e,n))}function Wee(e,t,n,r){return yk(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function Kee(e,t,n,r){return yk(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||Gee(e,n,r)}function Gee(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Yc(e,Le.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Yc(e,Le.create(r,a+1,a+1+s.content.size));else if(Oe.isSelectable(s))Yc(e,Oe.create(r,a));else continue;return!0}}function xk(e){return Yg(e)}const jD=Zr?"metaKey":"ctrlKey";er.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=xk(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&Bee(n,e.input.lastClick)&&!n[jD]&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(ky(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new qee(e,s,n,!!r)):(i=="doubleClick"?Wee:Kee)(e,s.pos,s.inside,n)?n.preventDefault():Zs(e,"pointer"))};class qee{constructor(t,n,r,o){this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[jD],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{let u=t.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Oe&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qo&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Zs(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Yi(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ky(t))),this.updateAllowDefault(t),this.allowDefault||!n?Zs(this.view,"pointer"):Hee(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Qn&&this.mightDrag&&!this.mightDrag.node.isAtom||$n&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yc(this.view,Ke.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Zs(this.view,"pointer")}move(t){this.updateAllowDefault(t),Zs(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}er.touchstart=e=>{e.input.lastTouch=Date.now(),xk(e),Zs(e,"pointer")};er.touchmove=e=>{e.input.lastTouch=Date.now(),Zs(e,"pointer")};er.contextmenu=e=>xk(e);function RD(e,t){return e.composing?!0:Qn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const Yee=To?5e3:-1;tr.compositionstart=tr.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Le&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Yg(e,!0),e.markCursor=null;else if(Yg(e,!t.selection.empty),qo&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}e.input.composing=!0}ID(e,Yee)};tr.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,ID(e,20))};function ID(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Yg(e),t))}function AD(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Xee());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Jee(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=VQ(t.focusNode,t.focusOffset),r=UQ(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Xee(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Yg(e,t=!1){if(!(To&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),AD(e),t||e.docView&&e.docView.dirty){let n=mk(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Zee(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const mh=pr&&da<15||ku&&qQ<604;er.copy=tr.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=mh?null:n.clipboardData,s=r.content(),{dom:a,text:l}=CD(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Zee(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Qee(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function ete(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?gh(e,r.value,null,o,t):gh(e,r.textContent,r.innerHTML,o,t)},50)}function gh(e,t,n,r,o){let i=_D(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,i||se.empty)))return!0;if(!i)return!1;let s=Qee(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function DD(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}tr.paste=(e,t)=>{let n=t;if(e.composing&&!To)return;let r=mh?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&gh(e,DD(r),r.getData("text/html"),o,n)?n.preventDefault():ete(e,n)};class LD{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const FD=Zr?"altKey":"ctrlKey";er.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,i=o.empty?null:e.posAtCoords(ky(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Oe?o.to-1:o.to))){if(r&&r.mightDrag)s=Oe.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(s=Oe.create(e.state.doc,d.posBefore))}}let a=(s||e.state.selection).content(),{dom:l,text:c,slice:u}=CD(e,a);(!n.dataTransfer.files.length||!$n||cD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(mh?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",mh||n.dataTransfer.setData("text/plain",c),e.dragging=new LD(u,!n[FD],s)};er.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};tr.dragover=tr.dragenter=(e,t)=>t.preventDefault();tr.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(ky(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",m=>{s=m(s,e)}):s=_D(e,DD(n.dataTransfer),mh?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[FD]);if(e.someProp("handleDrop",m=>m(e,n,s||se.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?X2(e.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=e.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(h))return;let p=c.doc.resolve(u);if(d&&Oe.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Oe(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,x,b,w)=>m=w),c.setSelection(gk(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))};er.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Yi(e)},20))};er.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};er.beforeinput=(e,t)=>{if($n&&To&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,Qa(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let e in tr)er[e]=tr[e];function vh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Jg{constructor(t,n){this.toDOM=t,this.spec=n||vl,this.side=this.spec.side||0}map(t,n,r,o){let{pos:i,deleted:s}=t.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ct(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Jg&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&vh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ha{constructor(t,n){this.attrs=t,this.spec=n||vl}map(t,n,r,o){let i=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ct(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof ha&&vh(this.attrs,t.attrs)&&vh(this.spec,t.spec)}static is(t){return t.type instanceof ha}destroy(){}}class bk{constructor(t,n){this.attrs=t,this.spec=n||vl}map(t,n,r,o){let i=t.mapResult(n.from+o,1);if(i.deleted)return null;let s=t.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ct(i.pos-r,s.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),i;return o==n.from&&!(i=t.child(r)).isText&&o+i.nodeSize==n.to}eq(t){return this==t||t instanceof bk&&vh(this.attrs,t.attrs)&&vh(this.spec,t.spec)}destroy(){}}class Ct{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Ct(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new Ct(t,t,new Jg(n,r))}static inline(t,n,r,o){return new Ct(t,n,new ha(r,o))}static node(t,n,r,o){return new Ct(t,n,new bk(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ha}get widget(){return this.type instanceof Jg}}const pc=[],vl={};class it{constructor(t,n){this.local=t.length?t:pc,this.children=n.length?n:pc}static create(t,n){return n.length?Xg(n,t,0,vl):Fn}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,n-a,r,o+a,i)}}map(t,n,r){return this==Fn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||vl)}mapInner(t,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?tte(this.children,s||[],t,n,r,o,i):s?new it(s.sort(yl),pc):Fn}add(t,n){return n.length?this==Fn?it.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,i=0;t.forEach((a,l)=>{let c=l+r,u;if(u=$D(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,Xg(u,a,c+1,vl)),i+=3}});let s=zD(i?BD(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new it(s.length?this.local.concat(s).sort(yl):this.local,o||this.children)}remove(t){return t.length==0||this==Fn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<t.length;u++)(d=t[u])&&d.from>a&&d.to<l&&(t[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Fn?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<t.length;i++)if(s=t[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new it(o,r):Fn}forChild(t,n){if(this==Fn)return this;if(n.isLeaf)return it.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let i=t+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof ha){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new it(o.sort(yl),pc);return r?new Vs([a,r]):a}return r||Fn}eq(t){if(this==t)return!0;if(!(t instanceof it)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return wk(this.localsInner(t))}localsInner(t){if(this==Fn)return pc;if(t.inlineContent||!this.local.some(ha.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ha||n.push(this.local[r]);return n}forEachSet(t){t(this)}}it.empty=new it([],[]);it.removeOverlap=wk;const Fn=it.empty;class Vs{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,vl));return Vs.from(r)}forChild(t,n){if(n.isLeaf)return it.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=Fn&&(i instanceof Vs?r=r.concat(i.members):r.push(i))}return Vs.from(r)}eq(t){if(!(t instanceof Vs)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?wk(r?n:n.sort(yl)):pc}static from(t){switch(t.length){case 0:return Fn;case 1:return t[0];default:return new Vs(t.every(n=>n instanceof it)?t:t.reduce((n,r)=>n.concat(r instanceof it?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function tte(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,p,m,v)=>{let x=v-m-(p-h);for(let b=0;b<a.length;b+=3){let w=a[b+1];if(w<0||h>w+u-d)continue;let S=a[b]+u-d;p>=S?a[b+1]=h<=S?-2:-1:h>=u&&x&&(a[b]+=x,a[b+1]+=x)}d+=x}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(e[c]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(e[c+1]+i,-1),p=h-o,{index:m,offset:v}=r.content.findIndex(d),x=r.maybeChild(m);if(x&&v==d&&v+x.nodeSize==p){let b=a[c+2].mapInner(n,x,u+1,e[c]+i+1,s);b!=Fn?(a[c]=d,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=nte(a,e,t,n,o,i,s),u=Xg(c,r,0,s);t=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let p=u.children[d];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new it(t.sort(yl),a)}function zD(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Ct(o.from+t,o.to+t,o.type))}return n}function nte(e,t,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&a(e[l+2],t[l]+i+1);return n}function $D(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i=0,s;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function BD(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Xg(e,t,n,r){let o=[],i=!1;t.forEach((a,l)=>{let c=$D(e,a,l+n);if(c){i=!0;let u=Xg(c,a,n+l+1,r);u!=Fn&&o.push(l,l+a.nodeSize,u)}});let s=zD(i?BD(e):e,-n).sort(yl);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new it(s,o):Fn}function yl(e,t){return e.from-t.from||e.to-t.to}function wk(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),$P(t,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),$P(t,o,r.copy(i.from,r.to)));break}}}return t}function $P(e,t,n){for(;t<e.length&&yl(n,e[t])>0;)t++;e.splice(t,0,n)}function s0(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Fn&&t.push(r)}),e.cursorWrapper&&t.push(it.create(e.state.doc,[e.cursorWrapper.deco])),Vs.from(t)}const rte={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ote=pr&&da<=11;class ite{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class ste{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ite,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);pr&&da<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),ote&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rte)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(jP(this.view)){if(this.suppressingSelectionUpdates)return Yi(this.view);if(pr&&da<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Al(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=ph(i))n.add(i);for(let i=t.anchorNode;i;i=ph(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&jP(t)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(qo&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!d||cte(t,d)!=p)&&h.remove()}}}let c=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&wy(r)&&(c=mk(t))&&c.eq(Ke.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Yi(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),ate(t)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Yi(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let d=t.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,i=t.nextSibling;if(pr&&da<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=t.addedNodes[u];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(i=h)}let s=o&&o.parentNode==t.target?wn(o)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?wn(i):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let BP=new WeakMap,VP=!1;function ate(e){if(!BP.has(e)&&(BP.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=qo,VP)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),VP=!0}}function UP(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Al(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function lte(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return UP(e,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?UP(e,n):null}function cte(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function ute(e,t,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c,u=l.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],wy(l)||c.push({node:l.focusNode,offset:l.focusOffset})),$n&&e.input.lastKeyCode===8)for(let x=i;x>o;x--){let b=r.childNodes[x-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){i=x;break}if(!w||w.size)break}let d=e.state.doc,h=e.someProp("domParser")||bu.fromSchema(e.state.schema),p=d.resolve(s),m=null,v=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:dte,context:p});if(c&&c[0].pos!=null){let x=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=x),m={anchor:x+s,head:b+s}}return{doc:v,sel:m,from:s,to:a}}function dte(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Qn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Qn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const fte=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function hte(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let I=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,L=mk(e,I);if(L&&!e.state.selection.eq(L)){if($n&&To&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",$=>$(e,Qa(13,"Enter"))))return;let U=e.state.tr.setSelection(L);I=="pointer"?U.setMeta("pointer",!0):I=="key"&&U.scrollIntoView(),i&&U.setMeta("composition",i),e.dispatch(U)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=ute(e,t,n),u=e.state.doc,d=u.slice(c.from,c.to),h,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(h=e.state.selection.to,p="end"):(h=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let m=gte(d.content,c.doc.content,c.from,h,p);if(m&&e.input.domChangeCount++,(ku&&e.input.lastIOSEnter>Date.now()-225||To)&&o.some(I=>I.nodeType==1&&!fte.test(I.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",I=>I(e,Qa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Le&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let I=HP(e,e.state.doc,c.sel);if(I&&!I.eq(e.state.selection)){let L=e.state.tr.setSelection(I);i&&L.setMeta("composition",i),e.dispatch(L)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Le&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),pr&&da<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" "&&(m.start--,m.endA--,m.endB--);let v=c.doc.resolveNoCache(m.start-c.from),x=c.doc.resolveNoCache(m.endB-c.from),b=u.resolve(m.start),w=v.sameParent(x)&&v.parent.inlineContent&&b.end()>=m.endA,S;if((ku&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!w&&v.pos<c.doc.content.size&&!v.sameParent(x)&&(S=Ke.findFrom(c.doc.resolve(v.pos+1),1,!0))&&S.head==x.pos)&&e.someProp("handleKeyDown",I=>I(e,Qa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&mte(u,m.start,m.endA,v,x)&&e.someProp("handleKeyDown",I=>I(e,Qa(8,"Backspace")))){To&&$n&&e.domObserver.suppressSelectionUpdates();return}$n&&To&&m.endB==m.start&&(e.input.lastAndroidDelete=Date.now()),To&&!w&&v.start()!=x.start()&&x.parentOffset==0&&v.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,x=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(I){return I(e,Qa(13,"Enter"))})},20));let C=m.start,_=m.endA,P,O,M;if(w){if(v.pos==x.pos)pr&&da<=11&&v.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Yi(e),20)),P=e.state.tr.delete(C,_),O=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(M=pte(v.parent.content.cut(v.parentOffset,x.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start()))))P=e.state.tr,M.type=="add"?P.addMark(C,_,M.mark):P.removeMark(C,_,M.mark);else if(v.parent.child(v.index()).isText&&v.index()==x.index()-(x.textOffset?0:1)){let I=v.parent.textBetween(v.parentOffset,x.parentOffset);if(e.someProp("handleTextInput",L=>L(e,C,_,I)))return;P=e.state.tr.insertText(I,C,_)}}if(P||(P=e.state.tr.replace(C,_,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let I=HP(e,P.doc,c.sel);I&&!($n&&To&&e.composing&&I.empty&&(m.start!=m.endB||e.input.lastAndroidDelete<Date.now()-100)&&(I.head==C||I.head==P.mapping.map(_)-1)||pr&&I.empty&&I.head==C)&&P.setSelection(I)}O&&P.ensureMarks(O),i&&P.setMeta("composition",i),e.dispatch(P.scrollIntoView())}function HP(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:gk(e,t.resolve(n.anchor),t.resolve(n.head))}function pte(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(q.from(c).eq(e))return{mark:a,type:s}}function mte(e,t,n,r,o){if(n-t<=o.pos-r.pos||a0(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(a0(i,!0,!0));return!s.parent.isTextblock||s.pos>n||a0(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function a0(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function gte(e,t,n,r,o){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&e.size<t.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<t.size&&WP(t.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&WP(e.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function WP(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class vte{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Dee,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(JP),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=qP(this),GP(this),this.nodeViews=YP(this),this.docView=_P(this.state.doc,KP(this),s0(this),this.dom,this),this.domObserver=new ste(this,(r,o,i,s)=>hte(this,r,o,i,s)),this.domObserver.start(),Lee(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&dw(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(JP),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let o=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(AD(this),s=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=YP(this);xte(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&dw(this),this.editable=qP(this),GP(this);let l=s0(this),c=KP(this),u=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,c,l);(d||!t.selection.eq(o.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&XQ(this);if(s){this.domObserver.stop();let p=d&&(pr||$n)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&yte(o.selection,t.selection);if(d){let m=$n?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Jee(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=_P(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wee(this))?Yi(this,p):(SD(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&ZQ(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Oe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&bP(this,n.getBoundingClientRect(),t)}else bP(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new LD(t.slice,t.move,o<0?void 0:Oe.create(this.state.doc,o))}someProp(t,n){let r=this._props&&this._props[t],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[t];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(pr){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&QQ(this.dom),Yi(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return oee(this,t)}coordsAtPos(t,n=1){return pD(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let o=this.docView.posFromDOM(t,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,n){return cee(this,n||this.state,t)}pasteHTML(t,n){return gh(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return gh(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Fee(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],s0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,$Q())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return $ee(this,t)}dispatch(t){let n=this._props.dispatchTransaction;n?n.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?Qn&&this.root.nodeType===11&&WQ(this.dom.ownerDocument)==this.dom&<e(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function KP(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Ct.node(0,e.state.doc.content.size,t)]}function GP(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Ct.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function qP(e){return!e.someProp("editable",t=>t(e.state)===!1)}function yte(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function YP(e){let t=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=r[o])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function xte(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function JP(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var bte=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const wte=Ma(bte);function Ste(e){return!!(e.prev&&e.next&&e.prev.text.full!==e.next.text.full)}function kte(e){return!!(e.prev&&e.next&&e.prev.range.cursor!==e.next.range.cursor)}function Ete(e){return!!(!e.prev&&e.next)}function Cte(e){return!!(e.prev&&!e.next)}function _te(e){return!!(e.prev&&e.next&&e.prev.range.from!==e.next.range.from)}function Pte(e){return e==="invalid-exit-split"}var Nte=["jump-backward-exit","jump-forward-exit"],Tte=["jump-backward-change","jump-forward-change"];function Ote(e){var t,n;return Go(Nte,(t=e.exit)==null?void 0:t.exitReason)||Go(Tte,(n=e.change)==null?void 0:n.changeReason)}function XP(e){return!!(e&&e.query.full.length>=e.suggester.matchOffset)}function ZP(e){return Wn(e)&&e instanceof Le}function cr(e){const{match:t,changeReason:n,exitReason:r}=e;return{...t,changeReason:n,exitReason:r}}function Mte(e,t){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=t;return n?!new RegExp(hw(n)).test(e):new RegExp(hw(r)).test(e)}function jte(e){const{text:t,regexp:n,$pos:r,suggester:o}=e,i=r.start();let s;return xy(t,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(Mte(l,o)){const c=a.index+i,u=a[0],d=a[1];if(!Ae(u)||!Ae(d))return;const h=c+u.length,p=Math.min(h,r.pos),m=p-c;c<r.pos&&h>=r.pos&&(s={range:{from:c,to:h,cursor:p},match:a,query:{partial:u.slice(d.length,m),full:u.slice(d.length)},text:{partial:u.slice(0,m),full:u},textAfter:r.doc.textBetween(h,r.end(),Js,Js),textBefore:r.doc.textBetween(i,c,Js,Js),suggester:o})}}),s}function VD(e){const{$pos:t,suggester:n}=e,{char:r,name:o,startOfLine:i,supportedCharacters:s,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,d=Bte({char:r,matchOffset:a,startOfLine:i,supportedCharacters:s,multiline:l,caseInsensitive:c,unicode:u}),h=t.doc.textBetween(t.before(),t.end(),Js,Js);return jte({suggester:n,text:h,regexp:d,$pos:t,char:r,name:o})}function UD(e){const{state:t,match:n}=e;try{return VD({$pos:t.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function HD(e){const{prev:t,next:n,state:r}=e;return!n&&t.range.from>=r.doc.nodeSize?{exit:cr({match:t,exitReason:"delete"})}:!n||!t.query.partial?{exit:cr({match:t,exitReason:"invalid-exit-split"})}:t.range.to===n.range.cursor?{exit:cr({match:n,exitReason:"exit-end"})}:t.query.partial?{exit:cr({match:n,exitReason:"exit-split"})}:{}}function Rte(e){const{prev:t,next:n,state:r}=e,o=we(),i=UD({state:r,match:t}),{exit:s}=i&&i.query.full!==t.query.full?HD({prev:t,next:i,state:r}):o;return t.range.from<n.range.from?{exit:s??cr({match:t,exitReason:"jump-forward-exit"}),change:cr({match:n,changeReason:"jump-forward-change"})}:{exit:s??cr({match:t,exitReason:"jump-backward-exit"}),change:cr({match:n,changeReason:"jump-backward-change"})}}function Ite(e){const{match:t,state:n,$pos:r}=e,{selection:o}=n,i=UD({match:t,state:n});return!i||i.text.full!==t.text.full?HD({prev:t,next:i,state:n}):!o.empty&&(o.from<=t.range.from||o.to>=t.range.to)?{exit:cr({match:t,exitReason:"selection-outside"})}:r.pos>t.range.to?{exit:cr({match:t,exitReason:"move-end"})}:r.pos<=t.range.from?{exit:cr({match:t,exitReason:"move-start"})}:{}}function Ate(e){const{prev:t,next:n,state:r,$pos:o}=e,i=we();if(!t&&!n)return i;const s={prev:t,next:n};return _te(s)?Rte({prev:s.prev,next:s.next,state:r}):Ete(s)?{change:cr({match:s.next,changeReason:"start"})}:Cte(s)?Ite({$pos:o,match:s.prev,state:r}):Ste(s)?{change:cr({match:s.next,changeReason:"change-character"})}:kte(s)?{change:cr({match:s.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function QP(e,t){for(let n=e.depth;n>0;n--){const r=e.node(n);if(t.includes(r.type.name))return!0}return!1}function fw(e,t){const{$from:n,$to:r}=e;return WD(e,t)?!0:S2(n.pos,r.pos).some(o=>Dte(n.doc.resolve(o),t))}function WD(e,t){const{$from:n,$to:r}=e,o=new Set((n.marksAcross(r)??[]).map(i=>i.type.name));return t.some(i=>o.has(i))}function Dte(e,t){const n=new Set(e.marks().map(r=>r.type.name));return t.some(r=>n.has(r))}function Lte(e,t){const{$cursor:n}=t,{validMarks:r,validNodes:o,invalidMarks:i,invalidNodes:s}=e;return!r&&!o&&_a(i)&&_a(s)?!0:!(r&&!WD(t,r)||o&&!QP(n,o)||!r&&fw(t,i)||!o&&QP(n,s))}function eN(e){const{suggesters:t,$pos:n,selectionEmpty:r}=e;for(const o of t)if(!(o.emptySelectionsOnly&&!r))try{const i=VD({suggester:o,$pos:n});if(!i)continue;const s={$from:n.doc.resolve(i.range.from),$to:n.doc.resolve(i.range.to),$cursor:n};if(Lte(o,s)&&o.isValidPosition(s,i))return i}catch{}}function hw(e){return XX(e)?e.source:e}function Fte(e){return e?"^":""}function zte(e,t){return`(?:${hw(e)}){${t},}`}function $te(e){return Ae(e)?new RegExp(wte(e)):e}function Bte(e){const{char:t,matchOffset:n,startOfLine:r,supportedCharacters:o,captureChar:i=!0,caseInsensitive:s=!1,multiline:a=!1,unicode:l=!1}=e,c=`g${a?"m":""}${s?"i":""}${l?"u":""}`;let u=$te(t).source;return i&&(u=`(${u})`),new RegExp(`${Fte(r)}${u}${zte(o,n)}`,c)}var Vte={appendTransaction:!1,priority:50,ignoredTag:"span",matchOffset:0,disableDecorations:!1,startOfLine:!1,suggestClassName:"suggest",suggestTag:"span",supportedCharacters:/\w+/,validPrefixCharacters:/^[\s\0]?$/,invalidPrefixCharacters:null,ignoredClassName:null,invalidMarks:[],invalidNodes:[],validMarks:null,validNodes:null,isValidPosition:()=>!0,checkNextValidSelection:null,emptySelectionsOnly:!1,caseInsensitive:!1,multiline:!1,unicode:!1,captureChar:!0},KD="__ignore_prosemirror_suggest_update__",jh,Xc,Zt,Li,al,_o,Gt,Fi,ll,Zc,Ute=(Zc=class{constructor(t){Rn(this,jh,!1);Rn(this,Xc,!1);Rn(this,Zt);Rn(this,Li);Rn(this,al);Rn(this,_o,we());$t(this,"view");Rn(this,Gt,it.empty);Rn(this,Fi,!1);Rn(this,ll,!1);$t(this,"setMarkRemoved",()=>{Xe(this,Fi,!0)});$t(this,"findNextTextSelection",t=>{const n=t.$from.doc,r=Math.min(n.nodeSize-2,t.to+1),o=n.resolve(r),i=Ke.findFrom(o,1,!0);if(ZP(i))return i});$t(this,"ignoreNextExit",()=>{Xe(this,Xc,!0)});$t(this,"addIgnored",({from:t,name:n,specific:r=!1})=>{const o=ue(this,Zt).find(c=>c.name===n);if(!o)throw new Error(`No suggester exists for the name provided: ${n}`);const i=Ae(o.char)?o.char.length:1,s=t+i,a=o.ignoredClassName?{class:o.ignoredClassName}:{},l=Ct.inline(t,s,{nodeName:o.ignoredTag,...a},{name:n,specific:r,char:o.char});Xe(this,Gt,ue(this,Gt).add(this.view.state.doc,[l]))});$t(this,"removeIgnored",({from:t,name:n})=>{const r=ue(this,Zt).find(s=>s.name===n);if(!r)throw new Error(`No suggester exists for the name provided: ${n}`);const o=Ae(r.char)?r.char.length:1,i=ue(this,Gt).find(t,t+o)[0];!i||i.spec.name!==n||Xe(this,Gt,ue(this,Gt).remove([i]))});$t(this,"clearIgnored",t=>{if(!t){Xe(this,Gt,it.empty);return}const r=ue(this,Gt).find().filter(({spec:o})=>o.name===t);Xe(this,Gt,ue(this,Gt).remove(r))});$t(this,"findMatchAtPosition",(t,n)=>{const r=n?ue(this,Zt).filter(o=>o.name===n):ue(this,Zt);return eN({suggesters:r,$pos:t,docChanged:!1,selectionEmpty:!0})});$t(this,"setLastChangeFromAppend",()=>{Xe(this,ll,!0)});const n=tN();Xe(this,Zt,t.map(n)),Xe(this,Zt,jl(ue(this,Zt),(r,o)=>o.priority-r.priority))}static create(t){return new Zc(t)}get decorationSet(){return ue(this,Gt)}get removed(){return ue(this,Fi)}get match(){return ue(this,Li)?ue(this,Li):ue(this,al)&&ue(this,_o).exit?ue(this,al):void 0}init(t){return this.view=t,this}createProps(t){const{name:n,char:r}=t.suggester;return{view:this.view,addIgnored:this.addIgnored,clearIgnored:this.clearIgnored,ignoreNextExit:this.ignoreNextExit,setMarkRemoved:this.setMarkRemoved,name:n,char:r,...t}}shouldRunExit(){return ue(this,Xc)?(Xe(this,Xc,!1),!1):!0}updateWithNextSelection(t){var r,o,i;const n=this.findNextTextSelection(t.selection);if(n)for(const s of ue(this,Zt)){const a=(r=ue(this,_o).change)==null?void 0:r.suggester.name,l=(o=ue(this,_o).exit)==null?void 0:o.suggester.name;(i=s.checkNextValidSelection)==null||i.call(s,n.$from,t,{change:a,exit:l})}}changeHandler(t,n){const{change:r,exit:o}=ue(this,_o),i=this.match;if(!r&&!o||!XP(i))return;const s=n===(o==null?void 0:o.suggester.appendTransaction)&&this.shouldRunExit(),a=n===(r==null?void 0:r.suggester.appendTransaction);if(!(!s&&!a)){if(r&&o&&Ote({change:r,exit:o})){const l=this.createProps(o),c=this.createProps(r),u=o.range.from<r.range.from;s&&o.suggester.onChange(l,t),a&&r.suggester.onChange(c,t),s&&Xe(this,Fi,!1);return}r&&a&&r.suggester.onChange(this.createProps(r),t),o&&s&&(o.suggester.onChange(this.createProps(o),t),Xe(this,Fi,!1),Pte(o.exitReason)&&Xe(this,_o,we()))}}mapIgnoredDecorations(t){const n=ue(this,Gt).map(t.mapping,t.doc),o=n.find().filter(({from:i,to:s,spec:a})=>{const l=Ae(a.char)?a.char.length:1;return s-i!==l});Xe(this,Gt,n.remove(o))}shouldIgnoreMatch({range:t,suggester:{name:n}}){return ue(this,Gt).find().some(({spec:i,from:s})=>s!==t.from?!1:i.specific?i.name===n:!0)}resetState(){Xe(this,_o,we()),Xe(this,Li,void 0),Xe(this,Fi,!1),Xe(this,ll,!1)}updateReasons(t){const{$pos:n,state:r}=t,o=ue(this,jh),i=ue(this,Zt),s=r.selection.empty,a=ZP(r.selection)?eN({suggesters:i,$pos:n,docChanged:o,selectionEmpty:s}):void 0;Xe(this,Li,a&&this.shouldIgnoreMatch(a)?void 0:a),Xe(this,_o,Ate({next:ue(this,Li),prev:ue(this,al),state:r,$pos:n}))}addSuggester(t){const n=ue(this,Zt).find(o=>o.name===t.name),r=tN();if(n)Xe(this,Zt,ue(this,Zt).map(o=>o===n?r(t):o));else{const o=[...ue(this,Zt),r(t)];Xe(this,Zt,jl(o,(i,s)=>s.priority-i.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const n=Ae(t)?t:t.name;Xe(this,Zt,ue(this,Zt).filter(r=>r.name!==n)),this.clearIgnored(n)}toJSON(){return this.match}apply(t){const{exit:n,change:r}=ue(this,_o);if(ue(this,ll)&&(Xe(this,ll,!1),!(n!=null&&n.suggester.appendTransaction)&&!(r!=null&&r.suggester.appendTransaction)))return this;const{tr:o,state:i}=t,s=o.docChanged||o.selectionSet;return o.getMeta(KD)||!s&&!ue(this,Fi)?this:(Xe(this,jh,o.docChanged),this.mapIgnoredDecorations(o),n&&this.resetState(),Xe(this,al,ue(this,Li)),this.updateReasons({$pos:o.selection.$from,state:i}),this)}createDecorations(t){const n=this.match;if(!XP(n))return ue(this,Gt);const{disableDecorations:r}=n.suggester;if(Pt(r)?r(t,n):r)return ue(this,Gt);const{range:i,suggester:s}=n,{name:a,suggestTag:l,suggestClassName:c}=s,{from:u,to:d}=i;return this.shouldIgnoreMatch(n)?ue(this,Gt):ue(this,Gt).add(t.doc,[Ct.inline(u,d,{nodeName:l,class:a?`${c} suggest-${a}`:c},{name:a})])}},jh=new WeakMap,Xc=new WeakMap,Zt=new WeakMap,Li=new WeakMap,al=new WeakMap,_o=new WeakMap,Gt=new WeakMap,Fi=new WeakMap,ll=new WeakMap,Zc);function tN(){const e=new Set;return t=>{if(e.has(t.name))throw new Error(`A suggester already exists with the name '${t.name}'. The name provided must be unique.`);const n={...Vte,...t};return e.add(t.name),n}}var GD=new Ju("suggest");function Sk(e){return GD.getState(e)}function nN(e,t){return Sk(e).addSuggester(t)}function rN(e){e.setMeta(KD,!0)}function Hte(e,t){return Sk(e).removeSuggester(t)}function Wte(...e){const t=Ute.create(e);return new fs({key:GD,view:n=>(t.init(n),{update:r=>t.changeHandler(r.state.tr,!1)}),state:{init:()=>t,apply:(n,r,o,i)=>t.apply({tr:n,state:i})},appendTransaction:(n,r,o)=>{const i=o.tr;return t.updateWithNextSelection(i),t.changeHandler(i,!0),i.docChanged||i.steps.length>0||i.selectionSet||i.storedMarksSet?(t.setLastChangeFromAppend(),i):null},props:{decorations:n=>t.createDecorations(n)}})}function kk(e,t){const n=Object.getPrototypeOf(t);let r=e.selection,o=e.doc,i=e.storedMarks;const s=we();for(const[a,l]of Object.entries(t))s[a]={value:l};return Object.create(n,{...s,storedMarks:{get(){return i}},selection:{get(){return r}},doc:{get(){return o}},tr:{get(){return r=e.selection,o=e.doc,i=e.storedMarks,e}}})}function bf(e){return({state:t,dispatch:n,view:r,tr:o})=>e(kk(o,t),n,r)}function oN(e){return t=>{var n;return Pe(t.dispatch===void 0||t.dispatch===((n=t.view)==null?void 0:n.dispatch),{code:re.NON_CHAINABLE_COMMAND}),e(t)}}function Kte(...e){return({state:t,dispatch:n,view:r,tr:o,...i})=>{for(const s of e)if(s({state:t,dispatch:n,view:r,tr:o,...i}))return!0;return!1}}var Oo={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return Oo.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return Oo.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return Oo.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return Oo.isNode?process.platform==="darwin":Oo.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function Cs(e,t){var n;const r=yne(e);return((n=r==null?void 0:r.getComputedStyle(e))==null?void 0:n.getPropertyValue(t))??""}function Ln(e,t){return Object.assign(e.style,t)}function pw(e){return Wn(e)&&Br(e.nodeType)&&Ae(e.nodeName)}function yi(e){return pw(e)&&e.nodeType===1}function Ek(e){const{types:t,node:n}=e;if(!n)return!1;const r=o=>o===n.type||o===n.type.name;return on(t)?t.some(r):r(t)}function Gte(e,t){const{tr:n}=t;return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Ey(e){const{predicate:t,selection:n}=e,r=YD(n)?n.selection.$from:Pk(n)?n.$from:n;for(let o=r.depth;o>0;o--){const i=r.node(o),s=o>0?r.before(o):0,a=r.start(o),l=s+i.nodeSize;if(t(i,s))return{pos:s,depth:o,node:i,start:a,end:l}}}function qte(e){const{depth:t}=e,n=t>0?e.before(t):0,r=e.node(t),o=e.start(t),i=n+r.nodeSize;return{pos:n,start:o,node:r,end:i,depth:t}}function yh(e){const{types:t,selection:n}=e;return Ey({predicate:r=>Ek({types:t,node:r}),selection:n})}function Yte(e){const{types:t,selection:n}=e;if(!(!_y(n)||!Ek({types:t,node:n.node})))return{pos:n.$from.pos,depth:n.$from.depth,start:n.$from.start(),end:n.$from.pos+n.node.nodeSize,node:n.node}}function Ck(e){return Pk(e)?e.empty:e.selection.empty}function Jte(e){return e.docChanged||e.selectionSet}function Xte(e){return!!xh(e)}function xh(e){const{state:t,type:n,attrs:r}=e,{selection:o,doc:i}=t,s=Ae(n)?i.type.schema.nodes[n]:n;Pe(s,{code:re.SCHEMA,message:`No node exists for ${n}`});const a=Yte({selection:o,types:n})??Ey({predicate:l=>l.type===s,selection:o});return!r||Dg(r)||!a||a.node.hasMarkup(s,{...a.node.attrs,...r})?a:void 0}function Zg(...e){return t=>{if(!q_(e))return!1;const[n,...r]=e;let o=!1;const i=(...l)=>()=>{if(!q_(l))return!1;o=!0;const[,...c]=l;return Zg(...l)({...t,next:i(...c)})},s=i(...r),a=n({...t,next:s});return o||a?a:s()}}function Zte(e,t){const n=new Map,r=we();for(const o of e)for(const[i,s]of rn(o)){const l=[...n.get(i)??[],s],c=Zg(...l);n.set(i,l),r[i]=t(c)}return r}function Qte(e){return Zte(e,t=>(n,r,o)=>t({state:n,dispatch:r,view:o,tr:n.tr,next:()=>!1}))}function _k(e,t){const n=e.attrs??{};return Object.entries(t).every(([r,o])=>n[r]===o)}function ene(e){return XD(e,[Vi,Ht,hn,Ao])}function Xu(e){return Wn(e)}function Zu(e,t){return on(t)?Go(t,e[as]):t===e[as]}function tne(e){return Wn(e)&&e instanceof Qb}function nne(e,t){return Ae(e)?Rt(t.nodes,e):e}function qD(e){return Wn(e)&&e instanceof up}function rne(e,t){return Ae(e)?Rt(t.marks,e):e}function Cy(e){return Wn(e)&&e instanceof ua}function one(e){return Wn(e)&&e instanceof q}function ine(e){return Wn(e)&&e instanceof tt}function YD(e){return Wn(e)&&e instanceof ol}function Kl(e){return Wn(e)&&e instanceof Le}function sne(e){return Wn(e)&&e instanceof Xn}function Pk(e){return Wn(e)&&e instanceof Ke}function ane(e){return Wn(e)&&e instanceof xu}function iN(e){const{trState:t,from:n,to:r,type:o,attrs:i={}}=e,{doc:s}=t,a=rne(o,s.type.schema);if(Object.keys(i).length===0)return s.rangeHasMark(n,r,a);let l=!1;return r>n&&s.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(d=>d.type!==a?!1:_k(d,i)),!l)),l}function _y(e){return Wn(e)&&e instanceof Oe}function Qg(e){const{trState:t,type:n,attrs:r={},from:o,to:i}=e,{selection:s,doc:a,storedMarks:l}=t,c=Ae(n)?a.type.schema.marks[n]:n;if(Pe(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),o&&i)try{return Math.max(o,i)<a.nodeSize&&iN({...e,from:o,to:i})}catch{return!1}return s.empty?(l??s.$from.marks()).some(d=>d.type!==n?!1:_k(d,r??{})):iN({...e,from:s.from,to:s.to})}function Nk(e,t={}){const n=lne(e.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:o}=t;return r?JD(n,e):o?n.content.eq(e.content):n.eq(e)}function JD(e,t){if(e===t)return!0;const n=e.type===t.type&&tt.sameSet(e.marks,t.marks);function r(){if(e.content===t.content)return!0;if(e.content.size!==t.content.size)return!1;const o=[],i=[];e.content.forEach(s=>o.push(s)),t.content.forEach(s=>i.push(s));for(const[s,a]of o.entries()){const l=i[s];if(!l||!JD(a,l))return!1}return!0}return n&&r()}function lne(e){var t;return((t=e.nodes.doc)==null?void 0:t.createAndFill())??void 0}function Py(e){for(const t of Object.values(e.nodes))if(t.name!=="doc"&&(t.isBlock||t.isTextblock))return t;Pe(!1,{code:re.SCHEMA,message:"No default block node found for the provided schema."})}function cne(e){return e.type===Py(e.type.schema)}function Tk(e){return!!e&&e.type.isBlock&&!e.textContent&&!e.childCount}function ls(e,t,n){const r=e.parent.childAfter(e.parentOffset);if(!r.node)return;const o=Ae(t)?t:t.name,i=r.node.marks.find(({type:d})=>d.name===o);let s=e.index(),a=e.start()+r.offset,l=s+1,c=a+r.node.nodeSize;if(!i)return n&&c<n.pos?ls(e.doc.resolve(c+1),t,n):void 0;for(;s>0&&i.isInSet(e.parent.child(s-1).marks);)s-=1,a-=e.parent.child(s).nodeSize;for(;l<e.parent.childCount&&i.isInSet(e.parent.child(l).marks);)c+=e.parent.child(l).nodeSize,l+=1;const u=e.doc.textBetween(a,c,d2,`
|
|
472
|
+
`))),0,0):se.empty;let d=e.someProp("clipboardTextParser",h=>h(t,o,r,e));if(d)a=d;else{let h=o.marks(),{schema:p}=e.state,m=$a.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(v=>{let x=s.appendChild(document.createElement("p"));v&&x.appendChild(m.serializeNode(p.text(v,h)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),s=jee(n),hp&&Ree(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||bu.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Tee.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Iee(FP(a,+u[1],+u[2]),u[4]);else if(a=se.maxOpen(Oee(a.content,o),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=FP(a,d,h)}return e.someProp("transformPasted",d=>{a=d(a,e)}),a}const Tee=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Oee(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&ND(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=TD(s[s.length-1],i.length));let u=PD(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return q.from(s)}return e}function PD(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,q.from(e));return e}function ND(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=ND(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(q.from(PD(n,e,o+1))))}}function TD(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,TD(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(q.empty,!0);return e.copy(n.append(r))}function uw(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=uw(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function FP(e,t,n){return t<e.openStart&&(e=new se(uw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new se(uw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const OD={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let zP=null;function MD(){return zP||(zP=document.implementation.createHTMLDocument("title"))}let i0=null;function Mee(e){let t=window.trustedTypes;return t?(i0||(i0=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),i0.createHTML(e)):e}function jee(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=MD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&OD[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Mee(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function Ree(e){let t=e.querySelectorAll($n?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function Iee(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:o,openStart:i,openEnd:s}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=q.from(l.create(r[a+1],o)),i++,s++}return new se(o,i,s)}const er={},tr={},Aee={touchstart:!0,touchmove:!0};class Dee{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Lee(e){for(let t in er){let n=er[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{zee(e,r)&&!vk(e,r)&&(e.editable||!(r.type in tr))&&n(e,r)},Aee[t]?{passive:!0}:void 0)}Qn&&e.dom.addEventListener("input",()=>null),dw(e)}function Zs(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Fee(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function dw(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>vk(e,r))})}function vk(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function zee(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function $ee(e,t){!vk(e,t)&&er[t.type]&&(e.editable||!(t.type in tr))&&er[t.type](e,t)}tr.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!RD(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(To&&$n&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),ku&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",o=>o(e,Qa(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||Nee(e,n)?n.preventDefault():Zs(e,"key")};tr.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};tr.keypress=(e,t)=>{let n=t;if(RD(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Zr&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Le)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",i=>i(e,r.$from.pos,r.$to.pos,o))&&e.dispatch(e.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function ky(e){return{left:e.clientX,top:e.clientY}}function Bee(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function yk(e,t,n,r,o){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,a=>s>i.depth?a(e,n,i.nodeAfter,i.before(s),o,!0):a(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Yc(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function Vee(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Oe.isSelectable(r)?(Yc(e,new Oe(n)),!0):!1}function Uee(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof Oe&&(r=n.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(Oe.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Yc(e,Oe.create(e.state.doc,o)),!0):!1}function Hee(e,t,n,r,o){return yk(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?Uee(e,n):Vee(e,n))}function Wee(e,t,n,r){return yk(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function Kee(e,t,n,r){return yk(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||Gee(e,n,r)}function Gee(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Yc(e,Le.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Yc(e,Le.create(r,a+1,a+1+s.content.size));else if(Oe.isSelectable(s))Yc(e,Oe.create(r,a));else continue;return!0}}function xk(e){return Yg(e)}const jD=Zr?"metaKey":"ctrlKey";er.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=xk(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&Bee(n,e.input.lastClick)&&!n[jD]&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(ky(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new qee(e,s,n,!!r)):(i=="doubleClick"?Wee:Kee)(e,s.pos,s.inside,n)?n.preventDefault():Zs(e,"pointer"))};class qee{constructor(t,n,r,o){this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[jD],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{let u=t.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Oe&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qo&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Zs(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Yi(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ky(t))),this.updateAllowDefault(t),this.allowDefault||!n?Zs(this.view,"pointer"):Hee(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Qn&&this.mightDrag&&!this.mightDrag.node.isAtom||$n&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yc(this.view,Ke.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Zs(this.view,"pointer")}move(t){this.updateAllowDefault(t),Zs(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}er.touchstart=e=>{e.input.lastTouch=Date.now(),xk(e),Zs(e,"pointer")};er.touchmove=e=>{e.input.lastTouch=Date.now(),Zs(e,"pointer")};er.contextmenu=e=>xk(e);function RD(e,t){return e.composing?!0:Qn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const Yee=To?5e3:-1;tr.compositionstart=tr.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Le&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Yg(e,!0),e.markCursor=null;else if(Yg(e,!t.selection.empty),qo&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}e.input.composing=!0}ID(e,Yee)};tr.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,ID(e,20))};function ID(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Yg(e),t))}function AD(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Xee());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Jee(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=VQ(t.focusNode,t.focusOffset),r=UQ(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Xee(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Yg(e,t=!1){if(!(To&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),AD(e),t||e.docView&&e.docView.dirty){let n=mk(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Zee(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const mh=pr&&da<15||ku&&qQ<604;er.copy=tr.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=mh?null:n.clipboardData,s=r.content(),{dom:a,text:l}=CD(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Zee(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Qee(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function ete(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?gh(e,r.value,null,o,t):gh(e,r.textContent,r.innerHTML,o,t)},50)}function gh(e,t,n,r,o){let i=_D(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,i||se.empty)))return!0;if(!i)return!1;let s=Qee(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function DD(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}tr.paste=(e,t)=>{let n=t;if(e.composing&&!To)return;let r=mh?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&gh(e,DD(r),r.getData("text/html"),o,n)?n.preventDefault():ete(e,n)};class LD{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const FD=Zr?"altKey":"ctrlKey";er.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,i=o.empty?null:e.posAtCoords(ky(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Oe?o.to-1:o.to))){if(r&&r.mightDrag)s=Oe.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(s=Oe.create(e.state.doc,d.posBefore))}}let a=(s||e.state.selection).content(),{dom:l,text:c,slice:u}=CD(e,a);(!n.dataTransfer.files.length||!$n||cD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(mh?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",mh||n.dataTransfer.setData("text/plain",c),e.dragging=new LD(u,!n[FD],s)};er.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};tr.dragover=tr.dragenter=(e,t)=>t.preventDefault();tr.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(ky(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",m=>{s=m(s,e)}):s=_D(e,DD(n.dataTransfer),mh?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[FD]);if(e.someProp("handleDrop",m=>m(e,n,s||se.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?X2(e.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=e.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(h))return;let p=c.doc.resolve(u);if(d&&Oe.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Oe(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,x,b,w)=>m=w),c.setSelection(gk(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))};er.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Yi(e)},20))};er.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};er.beforeinput=(e,t)=>{if($n&&To&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,Qa(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let e in tr)er[e]=tr[e];function vh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Jg{constructor(t,n){this.toDOM=t,this.spec=n||vl,this.side=this.spec.side||0}map(t,n,r,o){let{pos:i,deleted:s}=t.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ct(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Jg&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&vh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ha{constructor(t,n){this.attrs=t,this.spec=n||vl}map(t,n,r,o){let i=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ct(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof ha&&vh(this.attrs,t.attrs)&&vh(this.spec,t.spec)}static is(t){return t.type instanceof ha}destroy(){}}class bk{constructor(t,n){this.attrs=t,this.spec=n||vl}map(t,n,r,o){let i=t.mapResult(n.from+o,1);if(i.deleted)return null;let s=t.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ct(i.pos-r,s.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),i;return o==n.from&&!(i=t.child(r)).isText&&o+i.nodeSize==n.to}eq(t){return this==t||t instanceof bk&&vh(this.attrs,t.attrs)&&vh(this.spec,t.spec)}destroy(){}}class Ct{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Ct(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new Ct(t,t,new Jg(n,r))}static inline(t,n,r,o){return new Ct(t,n,new ha(r,o))}static node(t,n,r,o){return new Ct(t,n,new bk(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ha}get widget(){return this.type instanceof Jg}}const pc=[],vl={};class it{constructor(t,n){this.local=t.length?t:pc,this.children=n.length?n:pc}static create(t,n){return n.length?Xg(n,t,0,vl):Fn}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,n-a,r,o+a,i)}}map(t,n,r){return this==Fn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||vl)}mapInner(t,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?tte(this.children,s||[],t,n,r,o,i):s?new it(s.sort(yl),pc):Fn}add(t,n){return n.length?this==Fn?it.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,i=0;t.forEach((a,l)=>{let c=l+r,u;if(u=$D(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,Xg(u,a,c+1,vl)),i+=3}});let s=zD(i?BD(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new it(s.length?this.local.concat(s).sort(yl):this.local,o||this.children)}remove(t){return t.length==0||this==Fn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<t.length;u++)(d=t[u])&&d.from>a&&d.to<l&&(t[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Fn?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<t.length;i++)if(s=t[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new it(o,r):Fn}forChild(t,n){if(this==Fn)return this;if(n.isLeaf)return it.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let i=t+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof ha){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new it(o.sort(yl),pc);return r?new Vs([a,r]):a}return r||Fn}eq(t){if(this==t)return!0;if(!(t instanceof it)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return wk(this.localsInner(t))}localsInner(t){if(this==Fn)return pc;if(t.inlineContent||!this.local.some(ha.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ha||n.push(this.local[r]);return n}forEachSet(t){t(this)}}it.empty=new it([],[]);it.removeOverlap=wk;const Fn=it.empty;class Vs{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,vl));return Vs.from(r)}forChild(t,n){if(n.isLeaf)return it.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=Fn&&(i instanceof Vs?r=r.concat(i.members):r.push(i))}return Vs.from(r)}eq(t){if(!(t instanceof Vs)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?wk(r?n:n.sort(yl)):pc}static from(t){switch(t.length){case 0:return Fn;case 1:return t[0];default:return new Vs(t.every(n=>n instanceof it)?t:t.reduce((n,r)=>n.concat(r instanceof it?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function tte(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,p,m,v)=>{let x=v-m-(p-h);for(let b=0;b<a.length;b+=3){let w=a[b+1];if(w<0||h>w+u-d)continue;let S=a[b]+u-d;p>=S?a[b+1]=h<=S?-2:-1:h>=u&&x&&(a[b]+=x,a[b+1]+=x)}d+=x}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(e[c]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(e[c+1]+i,-1),p=h-o,{index:m,offset:v}=r.content.findIndex(d),x=r.maybeChild(m);if(x&&v==d&&v+x.nodeSize==p){let b=a[c+2].mapInner(n,x,u+1,e[c]+i+1,s);b!=Fn?(a[c]=d,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=nte(a,e,t,n,o,i,s),u=Xg(c,r,0,s);t=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let p=u.children[d];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new it(t.sort(yl),a)}function zD(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Ct(o.from+t,o.to+t,o.type))}return n}function nte(e,t,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&a(e[l+2],t[l]+i+1);return n}function $D(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i=0,s;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function BD(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Xg(e,t,n,r){let o=[],i=!1;t.forEach((a,l)=>{let c=$D(e,a,l+n);if(c){i=!0;let u=Xg(c,a,n+l+1,r);u!=Fn&&o.push(l,l+a.nodeSize,u)}});let s=zD(i?BD(e):e,-n).sort(yl);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new it(s,o):Fn}function yl(e,t){return e.from-t.from||e.to-t.to}function wk(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),$P(t,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),$P(t,o,r.copy(i.from,r.to)));break}}}return t}function $P(e,t,n){for(;t<e.length&&yl(n,e[t])>0;)t++;e.splice(t,0,n)}function s0(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Fn&&t.push(r)}),e.cursorWrapper&&t.push(it.create(e.state.doc,[e.cursorWrapper.deco])),Vs.from(t)}const rte={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ote=pr&&da<=11;class ite{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class ste{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ite,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);pr&&da<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),ote&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rte)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(jP(this.view)){if(this.suppressingSelectionUpdates)return Yi(this.view);if(pr&&da<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Al(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=ph(i))n.add(i);for(let i=t.anchorNode;i;i=ph(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&jP(t)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(qo&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!d||cte(t,d)!=p)&&h.remove()}}}let c=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&wy(r)&&(c=mk(t))&&c.eq(Ke.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Yi(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),ate(t)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Yi(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let d=t.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,i=t.nextSibling;if(pr&&da<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=t.addedNodes[u];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(i=h)}let s=o&&o.parentNode==t.target?wn(o)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?wn(i):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let BP=new WeakMap,VP=!1;function ate(e){if(!BP.has(e)&&(BP.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=qo,VP)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),VP=!0}}function UP(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Al(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function lte(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return UP(e,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?UP(e,n):null}function cte(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function ute(e,t,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c,u=l.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],wy(l)||c.push({node:l.focusNode,offset:l.focusOffset})),$n&&e.input.lastKeyCode===8)for(let x=i;x>o;x--){let b=r.childNodes[x-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){i=x;break}if(!w||w.size)break}let d=e.state.doc,h=e.someProp("domParser")||bu.fromSchema(e.state.schema),p=d.resolve(s),m=null,v=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:dte,context:p});if(c&&c[0].pos!=null){let x=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=x),m={anchor:x+s,head:b+s}}return{doc:v,sel:m,from:s,to:a}}function dte(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Qn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Qn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const fte=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function hte(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let I=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,L=mk(e,I);if(L&&!e.state.selection.eq(L)){if($n&&To&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",$=>$(e,Qa(13,"Enter"))))return;let U=e.state.tr.setSelection(L);I=="pointer"?U.setMeta("pointer",!0):I=="key"&&U.scrollIntoView(),i&&U.setMeta("composition",i),e.dispatch(U)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=ute(e,t,n),u=e.state.doc,d=u.slice(c.from,c.to),h,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(h=e.state.selection.to,p="end"):(h=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let m=gte(d.content,c.doc.content,c.from,h,p);if(m&&e.input.domChangeCount++,(ku&&e.input.lastIOSEnter>Date.now()-225||To)&&o.some(I=>I.nodeType==1&&!fte.test(I.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",I=>I(e,Qa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Le&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let I=HP(e,e.state.doc,c.sel);if(I&&!I.eq(e.state.selection)){let L=e.state.tr.setSelection(I);i&&L.setMeta("composition",i),e.dispatch(L)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Le&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),pr&&da<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" "&&(m.start--,m.endA--,m.endB--);let v=c.doc.resolveNoCache(m.start-c.from),x=c.doc.resolveNoCache(m.endB-c.from),b=u.resolve(m.start),w=v.sameParent(x)&&v.parent.inlineContent&&b.end()>=m.endA,S;if((ku&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!w&&v.pos<c.doc.content.size&&!v.sameParent(x)&&(S=Ke.findFrom(c.doc.resolve(v.pos+1),1,!0))&&S.head==x.pos)&&e.someProp("handleKeyDown",I=>I(e,Qa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&mte(u,m.start,m.endA,v,x)&&e.someProp("handleKeyDown",I=>I(e,Qa(8,"Backspace")))){To&&$n&&e.domObserver.suppressSelectionUpdates();return}$n&&To&&m.endB==m.start&&(e.input.lastAndroidDelete=Date.now()),To&&!w&&v.start()!=x.start()&&x.parentOffset==0&&v.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,x=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(I){return I(e,Qa(13,"Enter"))})},20));let C=m.start,_=m.endA,P,O,M;if(w){if(v.pos==x.pos)pr&&da<=11&&v.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Yi(e),20)),P=e.state.tr.delete(C,_),O=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(M=pte(v.parent.content.cut(v.parentOffset,x.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start()))))P=e.state.tr,M.type=="add"?P.addMark(C,_,M.mark):P.removeMark(C,_,M.mark);else if(v.parent.child(v.index()).isText&&v.index()==x.index()-(x.textOffset?0:1)){let I=v.parent.textBetween(v.parentOffset,x.parentOffset);if(e.someProp("handleTextInput",L=>L(e,C,_,I)))return;P=e.state.tr.insertText(I,C,_)}}if(P||(P=e.state.tr.replace(C,_,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let I=HP(e,P.doc,c.sel);I&&!($n&&To&&e.composing&&I.empty&&(m.start!=m.endB||e.input.lastAndroidDelete<Date.now()-100)&&(I.head==C||I.head==P.mapping.map(_)-1)||pr&&I.empty&&I.head==C)&&P.setSelection(I)}O&&P.ensureMarks(O),i&&P.setMeta("composition",i),e.dispatch(P.scrollIntoView())}function HP(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:gk(e,t.resolve(n.anchor),t.resolve(n.head))}function pte(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(q.from(c).eq(e))return{mark:a,type:s}}function mte(e,t,n,r,o){if(n-t<=o.pos-r.pos||a0(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(a0(i,!0,!0));return!s.parent.isTextblock||s.pos>n||a0(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function a0(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function gte(e,t,n,r,o){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&e.size<t.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<t.size&&WP(t.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&WP(e.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function WP(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class vte{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Dee,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(JP),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=qP(this),GP(this),this.nodeViews=YP(this),this.docView=_P(this.state.doc,KP(this),s0(this),this.dom,this),this.domObserver=new ste(this,(r,o,i,s)=>hte(this,r,o,i,s)),this.domObserver.start(),Lee(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&dw(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(JP),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let o=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(AD(this),s=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=YP(this);xte(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&dw(this),this.editable=qP(this),GP(this);let l=s0(this),c=KP(this),u=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,c,l);(d||!t.selection.eq(o.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&XQ(this);if(s){this.domObserver.stop();let p=d&&(pr||$n)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&yte(o.selection,t.selection);if(d){let m=$n?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Jee(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=_P(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wee(this))?Yi(this,p):(SD(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&ZQ(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Oe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&bP(this,n.getBoundingClientRect(),t)}else bP(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new LD(t.slice,t.move,o<0?void 0:Oe.create(this.state.doc,o))}someProp(t,n){let r=this._props&&this._props[t],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[t];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(pr){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&QQ(this.dom),Yi(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return oee(this,t)}coordsAtPos(t,n=1){return pD(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let o=this.docView.posFromDOM(t,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,n){return cee(this,n||this.state,t)}pasteHTML(t,n){return gh(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return gh(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Fee(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],s0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,$Q())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return $ee(this,t)}dispatch(t){let n=this._props.dispatchTransaction;n?n.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?Qn&&this.root.nodeType===11&&WQ(this.dom.ownerDocument)==this.dom&<e(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function KP(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Ct.node(0,e.state.doc.content.size,t)]}function GP(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Ct.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function qP(e){return!e.someProp("editable",t=>t(e.state)===!1)}function yte(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function YP(e){let t=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=r[o])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function xte(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function JP(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var bte=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const wte=Ma(bte);function Ste(e){return!!(e.prev&&e.next&&e.prev.text.full!==e.next.text.full)}function kte(e){return!!(e.prev&&e.next&&e.prev.range.cursor!==e.next.range.cursor)}function Ete(e){return!!(!e.prev&&e.next)}function Cte(e){return!!(e.prev&&!e.next)}function _te(e){return!!(e.prev&&e.next&&e.prev.range.from!==e.next.range.from)}function Pte(e){return e==="invalid-exit-split"}var Nte=["jump-backward-exit","jump-forward-exit"],Tte=["jump-backward-change","jump-forward-change"];function Ote(e){var t,n;return Go(Nte,(t=e.exit)==null?void 0:t.exitReason)||Go(Tte,(n=e.change)==null?void 0:n.changeReason)}function XP(e){return!!(e&&e.query.full.length>=e.suggester.matchOffset)}function ZP(e){return Wn(e)&&e instanceof Le}function cr(e){const{match:t,changeReason:n,exitReason:r}=e;return{...t,changeReason:n,exitReason:r}}function Mte(e,t){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=t;return n?!new RegExp(hw(n)).test(e):new RegExp(hw(r)).test(e)}function jte(e){const{text:t,regexp:n,$pos:r,suggester:o}=e,i=r.start();let s;return xy(t,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(Mte(l,o)){const c=a.index+i,u=a[0],d=a[1];if(!De(u)||!De(d))return;const h=c+u.length,p=Math.min(h,r.pos),m=p-c;c<r.pos&&h>=r.pos&&(s={range:{from:c,to:h,cursor:p},match:a,query:{partial:u.slice(d.length,m),full:u.slice(d.length)},text:{partial:u.slice(0,m),full:u},textAfter:r.doc.textBetween(h,r.end(),Js,Js),textBefore:r.doc.textBetween(i,c,Js,Js),suggester:o})}}),s}function VD(e){const{$pos:t,suggester:n}=e,{char:r,name:o,startOfLine:i,supportedCharacters:s,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,d=Bte({char:r,matchOffset:a,startOfLine:i,supportedCharacters:s,multiline:l,caseInsensitive:c,unicode:u}),h=t.doc.textBetween(t.before(),t.end(),Js,Js);return jte({suggester:n,text:h,regexp:d,$pos:t,char:r,name:o})}function UD(e){const{state:t,match:n}=e;try{return VD({$pos:t.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function HD(e){const{prev:t,next:n,state:r}=e;return!n&&t.range.from>=r.doc.nodeSize?{exit:cr({match:t,exitReason:"delete"})}:!n||!t.query.partial?{exit:cr({match:t,exitReason:"invalid-exit-split"})}:t.range.to===n.range.cursor?{exit:cr({match:n,exitReason:"exit-end"})}:t.query.partial?{exit:cr({match:n,exitReason:"exit-split"})}:{}}function Rte(e){const{prev:t,next:n,state:r}=e,o=we(),i=UD({state:r,match:t}),{exit:s}=i&&i.query.full!==t.query.full?HD({prev:t,next:i,state:r}):o;return t.range.from<n.range.from?{exit:s??cr({match:t,exitReason:"jump-forward-exit"}),change:cr({match:n,changeReason:"jump-forward-change"})}:{exit:s??cr({match:t,exitReason:"jump-backward-exit"}),change:cr({match:n,changeReason:"jump-backward-change"})}}function Ite(e){const{match:t,state:n,$pos:r}=e,{selection:o}=n,i=UD({match:t,state:n});return!i||i.text.full!==t.text.full?HD({prev:t,next:i,state:n}):!o.empty&&(o.from<=t.range.from||o.to>=t.range.to)?{exit:cr({match:t,exitReason:"selection-outside"})}:r.pos>t.range.to?{exit:cr({match:t,exitReason:"move-end"})}:r.pos<=t.range.from?{exit:cr({match:t,exitReason:"move-start"})}:{}}function Ate(e){const{prev:t,next:n,state:r,$pos:o}=e,i=we();if(!t&&!n)return i;const s={prev:t,next:n};return _te(s)?Rte({prev:s.prev,next:s.next,state:r}):Ete(s)?{change:cr({match:s.next,changeReason:"start"})}:Cte(s)?Ite({$pos:o,match:s.prev,state:r}):Ste(s)?{change:cr({match:s.next,changeReason:"change-character"})}:kte(s)?{change:cr({match:s.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function QP(e,t){for(let n=e.depth;n>0;n--){const r=e.node(n);if(t.includes(r.type.name))return!0}return!1}function fw(e,t){const{$from:n,$to:r}=e;return WD(e,t)?!0:S2(n.pos,r.pos).some(o=>Dte(n.doc.resolve(o),t))}function WD(e,t){const{$from:n,$to:r}=e,o=new Set((n.marksAcross(r)??[]).map(i=>i.type.name));return t.some(i=>o.has(i))}function Dte(e,t){const n=new Set(e.marks().map(r=>r.type.name));return t.some(r=>n.has(r))}function Lte(e,t){const{$cursor:n}=t,{validMarks:r,validNodes:o,invalidMarks:i,invalidNodes:s}=e;return!r&&!o&&_a(i)&&_a(s)?!0:!(r&&!WD(t,r)||o&&!QP(n,o)||!r&&fw(t,i)||!o&&QP(n,s))}function eN(e){const{suggesters:t,$pos:n,selectionEmpty:r}=e;for(const o of t)if(!(o.emptySelectionsOnly&&!r))try{const i=VD({suggester:o,$pos:n});if(!i)continue;const s={$from:n.doc.resolve(i.range.from),$to:n.doc.resolve(i.range.to),$cursor:n};if(Lte(o,s)&&o.isValidPosition(s,i))return i}catch{}}function hw(e){return XX(e)?e.source:e}function Fte(e){return e?"^":""}function zte(e,t){return`(?:${hw(e)}){${t},}`}function $te(e){return De(e)?new RegExp(wte(e)):e}function Bte(e){const{char:t,matchOffset:n,startOfLine:r,supportedCharacters:o,captureChar:i=!0,caseInsensitive:s=!1,multiline:a=!1,unicode:l=!1}=e,c=`g${a?"m":""}${s?"i":""}${l?"u":""}`;let u=$te(t).source;return i&&(u=`(${u})`),new RegExp(`${Fte(r)}${u}${zte(o,n)}`,c)}var Vte={appendTransaction:!1,priority:50,ignoredTag:"span",matchOffset:0,disableDecorations:!1,startOfLine:!1,suggestClassName:"suggest",suggestTag:"span",supportedCharacters:/\w+/,validPrefixCharacters:/^[\s\0]?$/,invalidPrefixCharacters:null,ignoredClassName:null,invalidMarks:[],invalidNodes:[],validMarks:null,validNodes:null,isValidPosition:()=>!0,checkNextValidSelection:null,emptySelectionsOnly:!1,caseInsensitive:!1,multiline:!1,unicode:!1,captureChar:!0},KD="__ignore_prosemirror_suggest_update__",jh,Xc,Zt,Li,al,_o,Gt,Fi,ll,Zc,Ute=(Zc=class{constructor(t){Rn(this,jh,!1);Rn(this,Xc,!1);Rn(this,Zt);Rn(this,Li);Rn(this,al);Rn(this,_o,we());$t(this,"view");Rn(this,Gt,it.empty);Rn(this,Fi,!1);Rn(this,ll,!1);$t(this,"setMarkRemoved",()=>{Xe(this,Fi,!0)});$t(this,"findNextTextSelection",t=>{const n=t.$from.doc,r=Math.min(n.nodeSize-2,t.to+1),o=n.resolve(r),i=Ke.findFrom(o,1,!0);if(ZP(i))return i});$t(this,"ignoreNextExit",()=>{Xe(this,Xc,!0)});$t(this,"addIgnored",({from:t,name:n,specific:r=!1})=>{const o=ue(this,Zt).find(c=>c.name===n);if(!o)throw new Error(`No suggester exists for the name provided: ${n}`);const i=De(o.char)?o.char.length:1,s=t+i,a=o.ignoredClassName?{class:o.ignoredClassName}:{},l=Ct.inline(t,s,{nodeName:o.ignoredTag,...a},{name:n,specific:r,char:o.char});Xe(this,Gt,ue(this,Gt).add(this.view.state.doc,[l]))});$t(this,"removeIgnored",({from:t,name:n})=>{const r=ue(this,Zt).find(s=>s.name===n);if(!r)throw new Error(`No suggester exists for the name provided: ${n}`);const o=De(r.char)?r.char.length:1,i=ue(this,Gt).find(t,t+o)[0];!i||i.spec.name!==n||Xe(this,Gt,ue(this,Gt).remove([i]))});$t(this,"clearIgnored",t=>{if(!t){Xe(this,Gt,it.empty);return}const r=ue(this,Gt).find().filter(({spec:o})=>o.name===t);Xe(this,Gt,ue(this,Gt).remove(r))});$t(this,"findMatchAtPosition",(t,n)=>{const r=n?ue(this,Zt).filter(o=>o.name===n):ue(this,Zt);return eN({suggesters:r,$pos:t,docChanged:!1,selectionEmpty:!0})});$t(this,"setLastChangeFromAppend",()=>{Xe(this,ll,!0)});const n=tN();Xe(this,Zt,t.map(n)),Xe(this,Zt,jl(ue(this,Zt),(r,o)=>o.priority-r.priority))}static create(t){return new Zc(t)}get decorationSet(){return ue(this,Gt)}get removed(){return ue(this,Fi)}get match(){return ue(this,Li)?ue(this,Li):ue(this,al)&&ue(this,_o).exit?ue(this,al):void 0}init(t){return this.view=t,this}createProps(t){const{name:n,char:r}=t.suggester;return{view:this.view,addIgnored:this.addIgnored,clearIgnored:this.clearIgnored,ignoreNextExit:this.ignoreNextExit,setMarkRemoved:this.setMarkRemoved,name:n,char:r,...t}}shouldRunExit(){return ue(this,Xc)?(Xe(this,Xc,!1),!1):!0}updateWithNextSelection(t){var r,o,i;const n=this.findNextTextSelection(t.selection);if(n)for(const s of ue(this,Zt)){const a=(r=ue(this,_o).change)==null?void 0:r.suggester.name,l=(o=ue(this,_o).exit)==null?void 0:o.suggester.name;(i=s.checkNextValidSelection)==null||i.call(s,n.$from,t,{change:a,exit:l})}}changeHandler(t,n){const{change:r,exit:o}=ue(this,_o),i=this.match;if(!r&&!o||!XP(i))return;const s=n===(o==null?void 0:o.suggester.appendTransaction)&&this.shouldRunExit(),a=n===(r==null?void 0:r.suggester.appendTransaction);if(!(!s&&!a)){if(r&&o&&Ote({change:r,exit:o})){const l=this.createProps(o),c=this.createProps(r),u=o.range.from<r.range.from;s&&o.suggester.onChange(l,t),a&&r.suggester.onChange(c,t),s&&Xe(this,Fi,!1);return}r&&a&&r.suggester.onChange(this.createProps(r),t),o&&s&&(o.suggester.onChange(this.createProps(o),t),Xe(this,Fi,!1),Pte(o.exitReason)&&Xe(this,_o,we()))}}mapIgnoredDecorations(t){const n=ue(this,Gt).map(t.mapping,t.doc),o=n.find().filter(({from:i,to:s,spec:a})=>{const l=De(a.char)?a.char.length:1;return s-i!==l});Xe(this,Gt,n.remove(o))}shouldIgnoreMatch({range:t,suggester:{name:n}}){return ue(this,Gt).find().some(({spec:i,from:s})=>s!==t.from?!1:i.specific?i.name===n:!0)}resetState(){Xe(this,_o,we()),Xe(this,Li,void 0),Xe(this,Fi,!1),Xe(this,ll,!1)}updateReasons(t){const{$pos:n,state:r}=t,o=ue(this,jh),i=ue(this,Zt),s=r.selection.empty,a=ZP(r.selection)?eN({suggesters:i,$pos:n,docChanged:o,selectionEmpty:s}):void 0;Xe(this,Li,a&&this.shouldIgnoreMatch(a)?void 0:a),Xe(this,_o,Ate({next:ue(this,Li),prev:ue(this,al),state:r,$pos:n}))}addSuggester(t){const n=ue(this,Zt).find(o=>o.name===t.name),r=tN();if(n)Xe(this,Zt,ue(this,Zt).map(o=>o===n?r(t):o));else{const o=[...ue(this,Zt),r(t)];Xe(this,Zt,jl(o,(i,s)=>s.priority-i.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const n=De(t)?t:t.name;Xe(this,Zt,ue(this,Zt).filter(r=>r.name!==n)),this.clearIgnored(n)}toJSON(){return this.match}apply(t){const{exit:n,change:r}=ue(this,_o);if(ue(this,ll)&&(Xe(this,ll,!1),!(n!=null&&n.suggester.appendTransaction)&&!(r!=null&&r.suggester.appendTransaction)))return this;const{tr:o,state:i}=t,s=o.docChanged||o.selectionSet;return o.getMeta(KD)||!s&&!ue(this,Fi)?this:(Xe(this,jh,o.docChanged),this.mapIgnoredDecorations(o),n&&this.resetState(),Xe(this,al,ue(this,Li)),this.updateReasons({$pos:o.selection.$from,state:i}),this)}createDecorations(t){const n=this.match;if(!XP(n))return ue(this,Gt);const{disableDecorations:r}=n.suggester;if(Pt(r)?r(t,n):r)return ue(this,Gt);const{range:i,suggester:s}=n,{name:a,suggestTag:l,suggestClassName:c}=s,{from:u,to:d}=i;return this.shouldIgnoreMatch(n)?ue(this,Gt):ue(this,Gt).add(t.doc,[Ct.inline(u,d,{nodeName:l,class:a?`${c} suggest-${a}`:c},{name:a})])}},jh=new WeakMap,Xc=new WeakMap,Zt=new WeakMap,Li=new WeakMap,al=new WeakMap,_o=new WeakMap,Gt=new WeakMap,Fi=new WeakMap,ll=new WeakMap,Zc);function tN(){const e=new Set;return t=>{if(e.has(t.name))throw new Error(`A suggester already exists with the name '${t.name}'. The name provided must be unique.`);const n={...Vte,...t};return e.add(t.name),n}}var GD=new Ju("suggest");function Sk(e){return GD.getState(e)}function nN(e,t){return Sk(e).addSuggester(t)}function rN(e){e.setMeta(KD,!0)}function Hte(e,t){return Sk(e).removeSuggester(t)}function Wte(...e){const t=Ute.create(e);return new fs({key:GD,view:n=>(t.init(n),{update:r=>t.changeHandler(r.state.tr,!1)}),state:{init:()=>t,apply:(n,r,o,i)=>t.apply({tr:n,state:i})},appendTransaction:(n,r,o)=>{const i=o.tr;return t.updateWithNextSelection(i),t.changeHandler(i,!0),i.docChanged||i.steps.length>0||i.selectionSet||i.storedMarksSet?(t.setLastChangeFromAppend(),i):null},props:{decorations:n=>t.createDecorations(n)}})}function kk(e,t){const n=Object.getPrototypeOf(t);let r=e.selection,o=e.doc,i=e.storedMarks;const s=we();for(const[a,l]of Object.entries(t))s[a]={value:l};return Object.create(n,{...s,storedMarks:{get(){return i}},selection:{get(){return r}},doc:{get(){return o}},tr:{get(){return r=e.selection,o=e.doc,i=e.storedMarks,e}}})}function bf(e){return({state:t,dispatch:n,view:r,tr:o})=>e(kk(o,t),n,r)}function oN(e){return t=>{var n;return Pe(t.dispatch===void 0||t.dispatch===((n=t.view)==null?void 0:n.dispatch),{code:re.NON_CHAINABLE_COMMAND}),e(t)}}function Kte(...e){return({state:t,dispatch:n,view:r,tr:o,...i})=>{for(const s of e)if(s({state:t,dispatch:n,view:r,tr:o,...i}))return!0;return!1}}var Oo={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return Oo.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return Oo.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return Oo.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return Oo.isNode?process.platform==="darwin":Oo.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function Cs(e,t){var n;const r=yne(e);return((n=r==null?void 0:r.getComputedStyle(e))==null?void 0:n.getPropertyValue(t))??""}function Ln(e,t){return Object.assign(e.style,t)}function pw(e){return Wn(e)&&Br(e.nodeType)&&De(e.nodeName)}function yi(e){return pw(e)&&e.nodeType===1}function Ek(e){const{types:t,node:n}=e;if(!n)return!1;const r=o=>o===n.type||o===n.type.name;return on(t)?t.some(r):r(t)}function Gte(e,t){const{tr:n}=t;return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Ey(e){const{predicate:t,selection:n}=e,r=YD(n)?n.selection.$from:Pk(n)?n.$from:n;for(let o=r.depth;o>0;o--){const i=r.node(o),s=o>0?r.before(o):0,a=r.start(o),l=s+i.nodeSize;if(t(i,s))return{pos:s,depth:o,node:i,start:a,end:l}}}function qte(e){const{depth:t}=e,n=t>0?e.before(t):0,r=e.node(t),o=e.start(t),i=n+r.nodeSize;return{pos:n,start:o,node:r,end:i,depth:t}}function yh(e){const{types:t,selection:n}=e;return Ey({predicate:r=>Ek({types:t,node:r}),selection:n})}function Yte(e){const{types:t,selection:n}=e;if(!(!_y(n)||!Ek({types:t,node:n.node})))return{pos:n.$from.pos,depth:n.$from.depth,start:n.$from.start(),end:n.$from.pos+n.node.nodeSize,node:n.node}}function Ck(e){return Pk(e)?e.empty:e.selection.empty}function Jte(e){return e.docChanged||e.selectionSet}function Xte(e){return!!xh(e)}function xh(e){const{state:t,type:n,attrs:r}=e,{selection:o,doc:i}=t,s=De(n)?i.type.schema.nodes[n]:n;Pe(s,{code:re.SCHEMA,message:`No node exists for ${n}`});const a=Yte({selection:o,types:n})??Ey({predicate:l=>l.type===s,selection:o});return!r||Dg(r)||!a||a.node.hasMarkup(s,{...a.node.attrs,...r})?a:void 0}function Zg(...e){return t=>{if(!q_(e))return!1;const[n,...r]=e;let o=!1;const i=(...l)=>()=>{if(!q_(l))return!1;o=!0;const[,...c]=l;return Zg(...l)({...t,next:i(...c)})},s=i(...r),a=n({...t,next:s});return o||a?a:s()}}function Zte(e,t){const n=new Map,r=we();for(const o of e)for(const[i,s]of rn(o)){const l=[...n.get(i)??[],s],c=Zg(...l);n.set(i,l),r[i]=t(c)}return r}function Qte(e){return Zte(e,t=>(n,r,o)=>t({state:n,dispatch:r,view:o,tr:n.tr,next:()=>!1}))}function _k(e,t){const n=e.attrs??{};return Object.entries(t).every(([r,o])=>n[r]===o)}function ene(e){return XD(e,[Vi,Ht,hn,Ao])}function Xu(e){return Wn(e)}function Zu(e,t){return on(t)?Go(t,e[as]):t===e[as]}function tne(e){return Wn(e)&&e instanceof Qb}function nne(e,t){return De(e)?Rt(t.nodes,e):e}function qD(e){return Wn(e)&&e instanceof up}function rne(e,t){return De(e)?Rt(t.marks,e):e}function Cy(e){return Wn(e)&&e instanceof ua}function one(e){return Wn(e)&&e instanceof q}function ine(e){return Wn(e)&&e instanceof tt}function YD(e){return Wn(e)&&e instanceof ol}function Kl(e){return Wn(e)&&e instanceof Le}function sne(e){return Wn(e)&&e instanceof Xn}function Pk(e){return Wn(e)&&e instanceof Ke}function ane(e){return Wn(e)&&e instanceof xu}function iN(e){const{trState:t,from:n,to:r,type:o,attrs:i={}}=e,{doc:s}=t,a=rne(o,s.type.schema);if(Object.keys(i).length===0)return s.rangeHasMark(n,r,a);let l=!1;return r>n&&s.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(d=>d.type!==a?!1:_k(d,i)),!l)),l}function _y(e){return Wn(e)&&e instanceof Oe}function Qg(e){const{trState:t,type:n,attrs:r={},from:o,to:i}=e,{selection:s,doc:a,storedMarks:l}=t,c=De(n)?a.type.schema.marks[n]:n;if(Pe(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),o&&i)try{return Math.max(o,i)<a.nodeSize&&iN({...e,from:o,to:i})}catch{return!1}return s.empty?(l??s.$from.marks()).some(d=>d.type!==n?!1:_k(d,r??{})):iN({...e,from:s.from,to:s.to})}function Nk(e,t={}){const n=lne(e.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:o}=t;return r?JD(n,e):o?n.content.eq(e.content):n.eq(e)}function JD(e,t){if(e===t)return!0;const n=e.type===t.type&&tt.sameSet(e.marks,t.marks);function r(){if(e.content===t.content)return!0;if(e.content.size!==t.content.size)return!1;const o=[],i=[];e.content.forEach(s=>o.push(s)),t.content.forEach(s=>i.push(s));for(const[s,a]of o.entries()){const l=i[s];if(!l||!JD(a,l))return!1}return!0}return n&&r()}function lne(e){var t;return((t=e.nodes.doc)==null?void 0:t.createAndFill())??void 0}function Py(e){for(const t of Object.values(e.nodes))if(t.name!=="doc"&&(t.isBlock||t.isTextblock))return t;Pe(!1,{code:re.SCHEMA,message:"No default block node found for the provided schema."})}function cne(e){return e.type===Py(e.type.schema)}function Tk(e){return!!e&&e.type.isBlock&&!e.textContent&&!e.childCount}function ls(e,t,n){const r=e.parent.childAfter(e.parentOffset);if(!r.node)return;const o=De(t)?t:t.name,i=r.node.marks.find(({type:d})=>d.name===o);let s=e.index(),a=e.start()+r.offset,l=s+1,c=a+r.node.nodeSize;if(!i)return n&&c<n.pos?ls(e.doc.resolve(c+1),t,n):void 0;for(;s>0&&i.isInSet(e.parent.child(s-1).marks);)s-=1,a-=e.parent.child(s).nodeSize;for(;l<e.parent.childCount&&i.isInSet(e.parent.child(l).marks);)c+=e.parent.child(l).nodeSize,l+=1;const u=e.doc.textBetween(a,c,d2,`
|
|
473
473
|
|
|
474
474
|
`);return{from:a,to:c,text:u,mark:i}}function XD(e,t){return t.length===0||t.some(n=>e instanceof n)}function une(e){return w2(e,({from:n,to:r,prevFrom:o,prevTo:i})=>`${n}_${r}_${o}_${i}`).filter((n,r,o)=>!o.some((i,s)=>r===s?!1:n.prevFrom>=i.prevFrom&&n.prevTo<=i.prevTo&&n.from>=i.from&&n.to<=i.to))}function dne(e,t=[]){const n=[],{steps:r,mapping:o}=e,i=o.invert();r.forEach((a,l)=>{if(!XD(a,t))return;const c=[],u=a.getMap(),d=o.slice(l);if(u.ranges.length===0&&ene(a)){const{from:h,to:p}=a;c.push({from:h,to:p})}else u.forEach((h,p)=>{c.push({from:h,to:p})});c.forEach(h=>{const p=d.map(h.from,-1),m=d.map(h.to);n.push({from:p,to:m,prevFrom:i.map(p,-1),prevTo:i.map(m)})})});const s=jl(n,(a,l)=>a.from-l.from);return une(s)}function fne(e){var t;return((t=e.content.firstChild)==null?void 0:t.textContent)??""}function hne(e,t){if(!Kl(e.selection))return;let{from:n,to:r}=e.selection;const o=(s,a)=>fne(Le.between(e.doc.resolve(s),e.doc.resolve(a)).content());for(let s=o(n-1,n);s&&!t.test(s);n--,s=o(n-1,n));for(let s=o(r,r+1);s&&!t.test(s);r++,s=o(r,r+1));if(n===r)return;const i=e.doc.textBetween(n,r,d2,`
|
|
475
475
|
|
|
476
|
-
`);return{from:n,to:r,text:i}}function ZD(e){return hne(e,/\W/)}function wf(e,t=0){const n=on(e)?e[t]:e;return v2(
|
|
476
|
+
`);return{from:n,to:r,text:i}}function ZD(e){return hne(e,/\W/)}function wf(e,t=0){const n=on(e)?e[t]:e;return v2(De(n),`No match string found for match ${e}`),n??""}function pne(e){return Kl(e)?e.$cursor:void 0}function mne(e,t){return Cy(e)?t?e.type===t.nodes.doc:e.type.name==="doc":!1}function gne(e){return Wn(e)&&Br(e.anchor)&&Br(e.head)}function uo(e,t){const n=t.nodeSize-2,r=0;let o;const i=l=>rZ({min:r,max:n,value:l});if(Pk(e))return e;if(e==="all")return new Xn(t);if(e==="start"?o=r:e==="end"?o=n:ane(e)?o=e.pos:o=e,Br(o))return o=i(o),Le.near(t.resolve(o));if(gne(o)){const l=i(o.anchor),c=i(o.head);return Le.between(t.resolve(l),t.resolve(c))}const s=i(o.from),a=i(o.to);return Le.between(t.resolve(s),t.resolve(a))}var vne=3;function QD(e){const{content:t,schema:n,document:r,stringHandler:o,onError:i,attempts:s=0}=e,a=i&&s<=vne||s===0;if(Pe(a,{code:re.INVALID_CONTENT,message:"The invalid content has been called recursively more than ${MAX_ATTEMPTS} times. The content is invalid and the error handler has not been able to recover properly."}),De(t))return Pe(o,{code:re.INVALID_CONTENT,message:`The string '${t}' was added to the editor, but no \`stringHandler\` was added. Please provide a valid string handler which transforms your content to a \`ProsemirrorNode\` to prevent this error.`}),o({document:r,content:t,schema:n});if(YD(t))return t.doc;if(Cy(t))return t;try{return n.nodeFromJSON(t)}catch(l){const c=Ene({schema:n,error:l,json:t}),u=i==null?void 0:i(c);return Pe(u,{code:re.INVALID_CONTENT,message:`An error occurred when processing the content. Please provide an \`onError\` handler to process the invalid content: ${JSON.stringify(c.invalidContent,null,2)}`}),QD({...e,content:u,attempts:s+1})}}function Ny(){const e=oD();if(e)return e;throw new Error(`Unable to retrieve the document from the global scope.
|
|
477
477
|
It seems that you are running Remirror in a non-browser environment. Remirror need browser APIs to work.
|
|
478
478
|
If you are using Jest (or other testing frameworks), make sure that you are using the JSDOM environment (https://jestjs.io/docs/29.0/configuration#testenvironment-string).
|
|
479
479
|
If you are using Next.js (or other server-side rendering frameworks), please use dynamic import with \`ssr: false\` to load the editor component without rendering it on the server (https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr).
|
|
480
|
-
If you are using Node.js, you can install JSDOM and Remirror will try to use it automatically, or you can create a fake document and pass it to Remirror`)}function eL(e){var t;return(e==null?void 0:e.defaultView)??(typeof window<"u"?window:void 0)??((t=oD())==null?void 0:t.defaultView)}function yne(e){return eL(e==null?void 0:e.ownerDocument)}function xne(e){const t=eL(e)??Ny().defaultView;if(t)return t;throw new Error("Unable to retrieve the window from the global scope")}function bne(e,t=Ny()){const n=mne(e,e.type.schema)?e.content:q.from(e);return $a.fromSchema(e.type.schema).serializeFragment(n,{document:t})}function wne(e,t){return new(xne(t)).DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function Sne(e,t=Ny()){const n=t.createElement("div");return n.append(bne(e,t)),n.innerHTML}function mw(e){const{content:t,schema:n,document:r,fragment:o=!1,...i}=e,s=wne(t,r),a=bu.fromSchema(n);return o?a.parseSlice(s,{...sN,...i}).content:a.parse(s,{...sN,...i})}var sN={preserveWhitespace:!1};function tL(e,t){const n=dh(t.defaults());return ik({...e},n)}var kne={remove(e,t){let n=e;for(const r of t)r.invalidParentNode||(n=sZ(r.path,n));return n}};function Ene({json:e,schema:t,...n}){const r=new Set(dh(t.marks)),o=new Set(dh(t.nodes)),i=nL({json:e,path:[],validNodes:o,validMarks:r});return{json:e,invalidContent:i,transformers:kne,...n}}function nL(e){const{json:t,validMarks:n,validNodes:r,path:o=[]}=e,i={validMarks:n,validNodes:r},s=[],{type:a,marks:l,content:c}=t;let{invalidParentMark:u=!1,invalidParentNode:d=!1}=e;if(l){const h=[];for(const[p,m]of l.entries()){const v=Ae(m)?m:m.type;n.has(v)||(h.unshift({name:v,path:[...o,"marks",`${p}`],type:"mark",invalidParentMark:u,invalidParentNode:d}),u=!0)}s.push(...h)}if(r.has(a)||(s.push({name:a,type:"node",path:o,invalidParentMark:u,invalidParentNode:d}),d=!0),c){const h=[];for(const[p,m]of c.entries())h.unshift(...nL({...i,json:m,path:[...o,"content",`${p}`],invalidParentMark:u,invalidParentNode:d}));s.unshift(...h)}return s}function Cne(e){return!!(Kl(e)&&e.$cursor&&e.$cursor.parentOffset>=e.$cursor.parent.content.size)}function gw(e){return!!(Kl(e)&&e.$cursor&&e.$cursor.parentOffset<=0)}function aN(e){const t=Ke.atStart(e.$anchor.doc);return!!(gw(e)&&t.anchor===e.anchor)}function _ne(e){return({dispatch:t,tr:n})=>{const{type:r,attrs:o=we(),appendText:i,range:s}=e,a=s?Le.between(n.doc.resolve(s.from),n.doc.resolve(s.to)):n.selection,{$from:l,from:c,to:u}=a;let d=l.depth===0?n.doc.type.allowsMarkType(r):!1;return n.doc.nodesBetween(c,u,h=>{if(d)return!1;if(h.inlineContent&&h.type.allowsMarkType(r)){d=!0;return}}),d?(t==null||t(n.addMark(c,u,r.create(o))&&i?n.insertText(i):n),!0):!1}}function Pne({tr:e,dispatch:t}){const{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Yu(o);return!Br(i)||!o?!1:(t==null||t(e.lift(o,i).scrollIntoView()),!0)}function rL(e,t={},n){return function(r){const{tr:o,dispatch:i,state:s}=r,a=Ae(e)?Rt(s.schema.nodes,e):e,{from:l,to:c}=uo(n??o.selection,o.doc),u=o.doc.resolve(l),d=o.doc.resolve(c),h=u.blockRange(d),p=h&&ck(h,a,t);return!p||!h?!1:(i==null||i(o.wrap(h,p).scrollIntoView()),!0)}}function Nne(e,t={},n){return r=>{const{tr:o,state:i}=r,s=Ae(e)?Rt(i.schema.nodes,e):e;return xh({state:o,type:s,attrs:t})?Pne(r):rL(e,t,n)(r)}}function ev(e,t,n,r=!0){return function(o){const{tr:i,dispatch:s,state:a}=o,l=Ae(e)?Rt(a.schema.nodes,e):e,{from:c,to:u}=uo(n??i.selection,i.doc);let d=!1,h;return i.doc.nodesBetween(c,u,(p,m)=>{if(d)return!1;if(!p.isTextblock||p.hasMarkup(l,t))return;if(p.type===l){d=!0,h=p.attrs;return}const v=i.doc.resolve(m),x=v.index();d=v.parent.canReplaceWith(x,x+1,l),d&&(h=v.parent.attrs)}),d?(s==null||s(i.setBlockType(c,u,l,{...r?h:{},...t}).scrollIntoView()),!0):!1}}function oL(e){return t=>{const{tr:n,state:r}=t,{type:o,attrs:i,preserveAttrs:s=!0}=e,a=xh({state:n,type:o,attrs:i}),l=e.toggleType??Py(r.schema);if(a)return ev(l,{...s?a.node.attrs:{},...i})(t);const c=xh({state:n,type:l,attrs:i});return ev(o,{...s?c==null?void 0:c.node.attrs:{},...i})(t)}}function Tne(e=0){const t=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return t?Number.parseInt(Rt(t,2),10)>=e:!1}function One(e,t){let{head:n,empty:r,anchor:o}=e;for(const i of t.steps)n=i.getMap().map(n);r?t.setSelection(Le.near(t.doc.resolve(n))):t.setSelection(Le.between(t.doc.resolve(o),t.doc.resolve(n)))}function Mne(e){const{attrs:t={},appendText:n="",content:r="",keepSelection:o=!1,range:i}=e;return({state:s,tr:a,dispatch:l})=>{var c;const u=s.schema,d=uo(e.selection??i??a.selection,a.doc),h=d.$from.index(),{from:p,to:m,$from:v}=d,x=Ae(e.type)?u.nodes[e.type]??u.marks[e.type]:e.type;if(Pe(Ae(e.type)?x:!0,{code:re.SCHEMA,message:`Schema contains no marks or nodes with name ${x}`}),tne(x)){if(!v.parent.canReplaceWith(h,h,x))return!1;a.replaceWith(p,m,x.create(t,r?u.text(r):void 0))}else Pe(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(p,m,u.text(r,qD(x)?[x.create(t)]:void 0));return n&&a.insertText(n),o&&One(s.selection,a),l&&(Tne(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function iL(e,t){const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const{marks:r,nodeSize:o}=n.node;if(r[0])return r[0].type;const s=e.start()+n.offset+o;return iL(e.doc.resolve(s+1))}function sL(e){return({dispatch:t,tr:n,state:r})=>{const{type:o,expand:i=!0,range:s}=e,a=uo(e.selection??s??n.selection,n.doc);let{from:l,to:c,$from:u,$to:d}=a;const h=Ae(o)?r.schema.marks[o]:o;h!==null&&Pe(h,{code:re.SCHEMA,message:`Mark type: ${o} does not exist on the current schema.`});const p=h??iL(u);if(!p)return!1;const m=ls(u,p,d);return i&&m&&(l=Math.max(0,Math.min(l,m.from)),c=Math.min(Math.max(c,m.to),n.doc.nodeSize-2)),t==null||t(n.removeMark(l,Br(c)?c:l,qD(h)?h:void 0)),!0}}function tv(e){const{regexp:t,type:n,getAttributes:r,ignoreWhitespace:o=!1,beforeDispatch:i,updateCaptured:s,shouldSkip:a,invalidMarks:l}=e;let c;const u=new mo(t,(d,h,p,m)=>{const{tr:v,schema:x}=d;c||(c=Ae(n)?x.marks[n]:n,Pe(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let b=h[1],w=h[0];const S=jne({captureGroup:b,fullMatch:w,end:m,start:p,rule:u,state:d,ignoreWhitespace:o,invalidMarks:l,shouldSkip:a,updateCaptured:s});if(!S)return null;({start:p,end:m,captureGroup:b,fullMatch:w}=S);const C=Pt(r)?r(h):r;let _=m,P=[];if(b){const O=w.search(/\S/),M=p+w.indexOf(b),I=M+b.length;P=v.storedMarks??[],I<m&&v.delete(I,m),M>p&&v.delete(p+O,M),_=p+O+b.length}return v.addMark(p,_,c.create(C)),v.setStoredMarks(P),i==null||i({tr:v,match:h,start:p,end:m}),v});return u}function jne({captureGroup:e,fullMatch:t,end:n,start:r,rule:o,ignoreWhitespace:i,shouldSkip:s,updateCaptured:a,state:l,invalidMarks:c}){var u;if(t==null)return null;const d=(a==null?void 0:a({captureGroup:e,fullMatch:t,start:r,end:n}))??{};e=d.captureGroup??e,t=d.fullMatch??t,r=d.start??r,n=d.end??n;const h=l.doc.resolve(r),p=l.doc.resolve(n);return c&&fw({$from:h,$to:p},c)||o.invalidMarks&&fw({$from:h,$to:p},o.invalidMarks)||i&&(e==null?void 0:e.trim())===""||s!=null&&s({state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})||(u=o.shouldSkip)!=null&&u.call(o,{state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})?null:{captureGroup:e,end:n,fullMatch:t,start:r}}var Rne=function(){const t=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];t.forEach(i=>{(i?i.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const o=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&o.push(n[i]);return o.push(...r),o.join(" ")},Ine=Rne;const aL=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Ane(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const lL=(e,t,n)=>{let r=Ane(e,n);if(!r)return!1;let o=cL(r);if(!o){let s=r.blockRange(),a=s&&Yu(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(fL(e,o,t,-1))return!0;if(r.parent.content.size==0&&(Eu(i,"end")||Oe.isSelectable(i)))for(let s=r.depth;;s--){let a=uk(e.doc,r.before(s),r.after(s),se.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(Eu(i,"end")?Ke.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Oe.create(l.doc,o.pos-i.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function Eu(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Dne=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=cL(r)}let s=i&&i.nodeBefore;return!s||!Oe.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Oe.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function cL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Lne(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Fne=(e,t,n)=>{let r=Lne(e,n);if(!r)return!1;let o=uL(r);if(!o)return!1;let i=o.nodeAfter;if(fL(e,o,t,1))return!0;if(r.parent.content.size==0&&(Eu(i,"start")||Oe.isSelectable(i))){let s=uk(e.doc,r.before(),r.after(),se.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(Eu(i,"start")?Ke.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Oe.create(a.doc,a.mapping.map(o.pos))),t(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},zne=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=uL(r)}let s=i&&i.nodeAfter;return!s||!Oe.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Oe.create(e.doc,i.pos)).scrollIntoView()),!0)};function uL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const $ne=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
481
|
-
`).scrollIntoView()),!0)};function Ok(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const dL=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Ok(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ke.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Bne=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Xn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ok(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(s,i.createAndFill());a.setSelection(Le.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},Vne=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Gc(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Yu(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function Une(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof Oe&&t.selection.node.isBlock)return!r.parentOffset||!Gc(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=Ok(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof Le||t.selection instanceof Xn)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=Gc(u.doc,d,i.length,i);if(h||(i[0]=a?{type:a}:null,h=Gc(u.doc,d,i.length,i)),u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),m=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const Hne=Une(),Wne=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(Oe.create(e.doc,o))),!0)},Kne=(e,t)=>(t&&t(e.tr.setSelection(new Xn(e.doc))),!0);function Gne(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||dp(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function fL(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&Gne(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,m=q.empty;for(let b=s.length-1;b>=0;b--)m=q.from(s[b].create(null,m));m=q.from(o.copy(m));let v=e.tr.step(new Ht(t.pos-1,p,t.pos,p,new se(m,1,0),s.length,!0)),x=v.doc.resolve(p+2*s.length);x.nodeAfter&&x.nodeAfter.type==o.type&&dp(v.doc,x.pos)&&v.join(x.pos),n(v.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Ke.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),h=d&&Yu(d);if(h!=null&&h>=t.depth)return n&&n(e.tr.lift(d,h).scrollIntoView()),!0;if(c&&Eu(i,"start",!0)&&Eu(o,"end")){let p=o,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let v=i,x=1;for(;!v.isTextblock;v=v.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(n){let b=q.empty;for(let S=m.length-1;S>=0;S--)b=q.from(m[S].copy(b));let w=e.tr.step(new Ht(t.pos-m.length,t.pos+i.nodeSize,t.pos+x,t.pos+i.nodeSize-x,new se(b,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function hL(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(Le.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const qne=hL(-1),Yne=hL(1);function Jne(e,t,n,r){for(let o=0;o<t.length;o++){let{$from:i,$to:s}=t[o],a=i.depth==0?e.inlineContent&&e.type.allowsMarkType(n):!1;if(e.nodesBetween(i.pos,s.pos,(l,c)=>{if(a||!r)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function Xne(e,t=null,n){let r=n!==!1;return function(o,i){let{empty:s,$cursor:a,ranges:l}=o.selection;if(s&&!a||!Jne(o.doc,l,e,r))return!1;if(i)if(a)e.isInSet(o.storedMarks||a.marks())?i(o.tr.removeStoredMark(e)):i(o.tr.addStoredMark(e.create(t)));else{let c,u=o.tr;c=!l.some(d=>o.doc.rangeHasMark(d.$from.pos,d.$to.pos,e));for(let d=0;d<l.length;d++){let{$from:h,$to:p}=l[d];if(!c)u.removeMark(h.pos,p.pos,e);else{let m=h.pos,v=p.pos,x=h.nodeAfter,b=p.nodeBefore,w=x&&x.isText?/^\s*/.exec(x.text)[0].length:0,S=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;m+w<v&&(m+=w,v-=S),u.addMark(m,v,e.create(t))}}i(u.scrollIntoView())}return!0}}function Ty(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let l0=Ty(aL,lL,Dne),lN=Ty(aL,Fne,zne);const Di={Enter:Ty($ne,Bne,Vne,Hne),"Mod-Enter":dL,Backspace:l0,"Mod-Backspace":l0,"Shift-Backspace":l0,Delete:lN,"Mod-Delete":lN,"Mod-a":Kne},pL={"Ctrl-h":Di.Backspace,"Alt-Backspace":Di["Mod-Backspace"],"Ctrl-d":Di.Delete,"Ctrl-Alt-Backspace":Di["Mod-Delete"],"Alt-Delete":Di["Mod-Delete"],"Alt-d":Di["Mod-Delete"],"Ctrl-a":qne,"Ctrl-e":Yne};for(let e in Di)pL[e]=Di[e];const Zne=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,c0=Zne?pL:Di;var Na={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},nv={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qne=typeof navigator<"u"&&/Mac/.test(navigator.platform),ere=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Sn=0;Sn<10;Sn++)Na[48+Sn]=Na[96+Sn]=String(Sn);for(var Sn=1;Sn<=24;Sn++)Na[Sn+111]="F"+Sn;for(var Sn=65;Sn<=90;Sn++)Na[Sn]=String.fromCharCode(Sn+32),nv[Sn]=String.fromCharCode(Sn);for(var u0 in Na)nv.hasOwnProperty(u0)||(nv[u0]=Na[u0]);function tre(e){var t=Qne&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ere&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?nv:Na)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const nre=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function rre(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))nre?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function ore(e){let t=Object.create(null);for(let n in e)t[rre(n)]=e[n];return t}function d0(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function mL(e){let t=ore(e);return function(n,r){let o=tre(r),i,s=t[d0(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[d0(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=Na[r.keyCode])&&i!=o){let a=t[d0(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function ire(e){const t=jl(e,(i,s)=>(s.priority??ht.Low)-(i.priority??ht.Low)),n=[],r=[];for(const i of t)fre(i)?n.push(i):r.push(i);let o;return new fs({key:sre,view:i=>(o=i,{}),props:{transformPasted:i=>{var c,u,d;const s=o.state.selection.$from,a=s.node().type.name,l=new Set(s.marks().map(h=>h.type.name));for(const h of n){if((c=h.ignoredNodes)!=null&&c.includes(a)||(u=h.ignoredMarks)!=null&&u.some(w=>l.has(w)))continue;const p=((d=i.content.firstChild)==null?void 0:d.textContent)??"",m=!o.state.selection.empty&&i.content.childCount===1&&p,v=xy(p,h.regexp)[0];if(m&&v&&h.type==="mark"&&h.replaceSelection){const{from:w,to:S}=o.state.selection,C=o.state.doc.slice(w,S),_=C.content.textBetween(0,C.content.size);if(typeof h.replaceSelection!="boolean"?h.replaceSelection(_):h.replaceSelection){const P=[],{getAttributes:O,markType:M}=h,I=Pt(O)?O(v,!0):O,L=M.create(I);return C.content.forEach(U=>{if(U.isText){const $=L.addToSet(U.marks);P.push(U.mark($))}}),se.maxOpen(q.fromArray(P))}}const{nodes:x,transformed:b}=ure(i.content,h,o.state.schema);b&&(i=h.type==="node"&&h.nodeType.isBlock?new se(q.fromArray(x),0,0):new se(q.fromArray(x),i.openStart,i.openEnd))}return gre(i)},handleDOMEvents:{paste:(i,s)=>{var d,h;const a=s;if(!((h=(d=i.props).editable)!=null&&h.call(d,i.state)))return!1;const{clipboardData:l}=a;if(!l)return!1;const c=[...l.items].map(p=>p.getAsFile()).filter(p=>!!p);if(c.length===0)return!1;const{selection:u}=i.state;for(const{fileHandler:p,regexp:m}of r){const v=m?c.filter(x=>m.test(x.type)):c;if(v.length!==0&&p({event:a,files:v,selection:u,view:i,type:"paste"}))return a.preventDefault(),!0}return!1},drop:(i,s)=>{var p,m,v;const a=s;if(!((m=(p=i.props).editable)!=null&&m.call(p,i.state)))return!1;const{dataTransfer:l,clientX:c,clientY:u}=a;if(!l)return!1;const d=mre(a);if(d.length===0)return!1;const h=((v=i.posAtCoords({left:c,top:u}))==null?void 0:v.pos)??i.state.selection.anchor;for(const{fileHandler:x,regexp:b}of r){const w=b?d.filter(S=>b.test(S.type)):d;if(w.length!==0&&x({event:a,files:w,pos:h,view:i,type:"drop"}))return a.preventDefault(),!0}return!1}}}})}var sre=new Ju("pasteRule");function f0(e,t){return function n(r){const{fragment:o,rule:i,nodes:s}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=i;let d=!1;return o.forEach(h=>{if(u!=null&&u.includes(h.type.name)||hre(h)){s.push(h);return}if(!h.isText){const v=n({fragment:h.content,rule:i,nodes:[]});d||(d=v.transformed);const x=q.fromArray(v.nodes);h.type.validContent(x)?s.push(h.copy(x)):s.push(...v.nodes);return}if(h.marks.some(v=>pre(v)||(c==null?void 0:c.includes(v.type.name)))){s.push(h);return}const p=h.text??"";let m=0;for(const v of xy(p,a)){const x=v[1],b=v[0];if(l&&(x==null?void 0:x.trim())===""||!b)return;const w=v.index,S=w+b.length;w>m&&s.push(h.cut(m,w));let C=h.cut(w,S);if(b&&x){const _=b.search(/\S/),P=w+b.indexOf(x),O=P+x.length;_&&s.push(h.cut(w,w+_)),C=h.cut(P,O)}e({nodes:s,rule:i,textNode:C,match:v,schema:t}),d=!0,m=S}p&&m<p.length&&s.push(h.cut(m))}),{nodes:s,transformed:d}}}function are(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s,getAttributes:a,markType:l}=n,c=Pt(a)?a(o,!1):a,u=r.text??"",d=l.create(c),h=s==null?void 0:s(o);if(h==="")return;if(h===!1){t.push(i.text(u,r.marks));return}const p=d.addToSet(r.marks);t.push(i.text(h??u,p))}function lre(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s}=n,a=s==null?void 0:s(o);if(a===""||a===!1)return;const l=a??r.text??"";t.push(i.text(l,r.marks))}function cre(e){const{nodes:t,rule:n,textNode:r,match:o}=e,{getAttributes:i,nodeType:s,getContent:a}=n,l=Pt(i)?i(o,!1):i,c=(a?a(o):r)||void 0;t.push(s.createChecked(l,c))}function ure(e,t,n){const r=[];switch(t.type){case"mark":return f0(are,n)({fragment:e,nodes:r,rule:t});case"node":return f0(cre,n)({fragment:e,nodes:r,rule:t});default:return f0(lre,n)({fragment:e,nodes:r,rule:t})}}var dre=["mark","node","text"];function fre(e){return Go(dre,e.type)}function hre(e){var t;return e.type.spec.code||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function pre(e){var t;return e.type.name==="code"||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function mre(e){var n,r;const{dataTransfer:t}=e;return t?((n=t.files)==null?void 0:n.length)>0?[...t.files]:(r=t.items)!=null&&r.length?[...t.items].map(o=>o.getAsFile()).filter(o=>!!o):[]:[]}function gre(e){const t=se.maxOpen(e.content);return t.openStart<e.openStart||t.openEnd<e.openEnd?t:e}var vre=Object.defineProperty,yre=Object.getOwnPropertyDescriptor,me=(e,t,n,r)=>{for(var o=r>1?void 0:r?yre(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&vre(t,n,o),o},gL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},le=(e,t,n)=>(gL(e,t,"read from private field"),n?n.call(e):t.get(e)),qt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},cn=(e,t,n,r)=>(gL(e,t,"write to private field"),t.set(e,n),n);function xre(e,t){return e===t}function cN(e){const{previousOptions:t,update:n,equals:r=xre}=e,o=rl({...t,...n}),i=we(),s=dh(t);for(const l of s){const c=t[l],u=o[l];if(r(c,u)){i[l]={changed:!1};continue}i[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=we();for(const u of l){const d=i[u];d!=null&&d.changed&&(c[u]=d.value)}return c};return{changes:rl(i),options:o,pickChanged:a}}var bre={[re.DUPLICATE_HELPER_NAMES]:"helper method",[re.DUPLICATE_COMMAND_NAMES]:"command method"};function vL(e){const{name:t,set:n,code:r}=e,o=bre[r];Pe(!n.has(t),{code:r,message:`There is a naming conflict for the name: ${t} used in this '${o}'. Please rename or remove from the editor to avoid runtime errors.`}),n.add(t)}function vw(...e){return fh(Ine(...e).split(" ")).join(" ")}var uN="__IGNORE__",wre="__ALL__",Qu=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=we(),this.populateMappedHandlers(),this._options=this._initialOptions=nZ(e,this.constructor.defaultOptions,t??we(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){const e=[],{customHandlerKeys:t,handlerKeys:n,staticKeys:r}=this.constructor;for(const o of dh(this._options))r.includes(o)||n.includes(o)||t.includes(o)||e.push(o);return e}ensureAllKeysAreDynamic(e){}setOptions(e){var t;const n=this.getDynamicOptions();this.ensureAllKeysAreDynamic(e);const{changes:r,options:o,pickChanged:i}=cN({previousOptions:n,update:e});this.updateDynamicOptions(o),(t=this.onSetOptions)==null||t.call(this,{reason:"set",changes:r,options:o,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var e;const t=this.getDynamicOptions(),{changes:n,options:r,pickChanged:o}=cN({previousOptions:t,update:this._initialOptions});this.updateDynamicOptions(r),(e=this.onSetOptions)==null||e.call(this,{reason:"reset",options:r,changes:n,pickChanged:o,initialOptions:this._initialOptions})}getDynamicOptions(){return ik(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(e){this._options={...this._options,...e}}populateMappedHandlers(){for(const e of this.constructor.handlerKeys)this._mappedHandlers[e]=[]}createDefaultHandlerOptions(){const e=we();for(const t of this.constructor.handlerKeys)e[t]=(...n)=>{var r;const{handlerKeyOptions:o}=this.constructor,i=(r=o[t])==null?void 0:r.reducer;let s=i==null?void 0:i.getDefault(...n);for(const[,a]of this._mappedHandlers[t]){const l=a(...n);if(s=i?i.accumulator(s,l,...n):l,Sre(o,s,t))return s}return s};return e}addHandler(e,t,n=ht.Default){return this._mappedHandlers[e].push([n,t]),this.sortHandlers(e),()=>this._mappedHandlers[e]=this._mappedHandlers[e].filter(([,r])=>r!==t)}hasHandlers(e){return(this._mappedHandlers[e]??[]).length>0}sortHandlers(e){this._mappedHandlers[e]=jl(this._mappedHandlers[e],([t],[n])=>n-t)}addCustomHandler(e,t){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[e]:t}))??b2}};Qu.defaultOptions={};Qu.staticKeys=[];Qu.handlerKeys=[];Qu.handlerKeyOptions={};Qu.customHandlerKeys=[];function Sre(e,t,n){const{[wre]:r}=e,o=e[n];return!r&&!o?!1:!!(o&&o.earlyReturnValue!==uN&&(Pt(o.earlyReturnValue)?o.earlyReturnValue(t)===!0:t===o.earlyReturnValue)||r&&r.earlyReturnValue!==uN&&(Pt(r.earlyReturnValue)?r.earlyReturnValue(t)===!0:t===r.earlyReturnValue))}var Oy=class extends Qu{constructor(...e){super(kre,...e),this["~E"]={},this._extensions=w2(this.createExtensions(),t=>t.constructor),this.extensionMap=new Map;for(const t of this._extensions)this.extensionMap.set(t.constructor,t)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${g2(this.name)}Extension`}get store(){return Pe(this._store,{code:re.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),rl(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(e,t){this.extensionMap.has(e)&&(this.extensionMap.set(e,t),this._extensions=this.extensions.map(n=>t.constructor===e?t:n))}createExtensions(){return[]}getExtension(e){const t=this.extensionMap.get(e);return Pe(t,{code:re.INVALID_GET_EXTENSION,message:`'${e.name}' does not exist within the preset: '${this.name}'`}),t}isOfType(e){return this.constructor===e}setStore(e){this._store||(this._store=e)}clone(...e){return new this.constructor(...e)}setPriority(e){this.priorityOverride=e}};Oy.defaultPriority=ht.Default;var Nt=class extends Oy{static get[as](){return mn.PlainExtensionConstructor}get[as](){return mn.PlainExtension}},mp=class extends Oy{static get[as](){return mn.MarkExtensionConstructor}get[as](){return mn.MarkExtension}get type(){return Rt(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};mp.disableExtraAttributes=!1;var go=class extends Oy{static get[as](){return mn.NodeExtensionConstructor}get[as](){return mn.NodeExtension}get type(){return Rt(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};go.disableExtraAttributes=!1;var kre={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function yL(e){return Xu(e)&&Zu(e,[mn.PlainExtension,mn.MarkExtension,mn.NodeExtension])}function Ere(e){return Xu(e)&&Zu(e,[mn.PlainExtensionConstructor,mn.MarkExtensionConstructor,mn.NodeExtensionConstructor])}function xL(e){return Xu(e)&&Zu(e,mn.PlainExtension)}function gp(e){return Xu(e)&&Zu(e,mn.NodeExtension)}function My(e){return Xu(e)&&Zu(e,mn.MarkExtension)}function ot(e){return t=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:o,staticKeys:i,defaultPriority:s,handlerKeyOptions:a,...l}=e,c=t;n&&(c.defaultOptions=n),s&&(c.defaultPriority=s),a&&(c.handlerKeyOptions=a),c.staticKeys=i??[],c.handlerKeys=o??[],c.customHandlerKeys=r??[];for(const[u,d]of Object.entries(l))c[u]||(c[u]=d);return c}}var Cre=class extends Nt{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=we(),this.updateAttributes=(e=!0)=>{this.transformAttributes(),e&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var e,t,n;if(this.attributeObject=we(),(e=this.store.managerSettings.exclude)!=null&&e.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}this.attributeList=[];for(const r of this.store.extensions){if((t=r.options.exclude)!=null&&t.attributes)continue;const o=(n=r.createAttributes)==null?void 0:n.call(r),i={...o,class:vw(...r.classNames??[],o==null?void 0:o.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:vw(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function zt(e={}){return(t,n,r)=>{(t.decoratedHelpers??(t.decoratedHelpers={}))[n]=e}}function ye(e={}){return(t,n,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[n]=e}}function qr(e){return(t,n,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[n]=e}}var _re=class{constructor(e){this.promiseCreator=e,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>t=>{let n=!0;const{view:r,tr:o,dispatch:i}=t;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...t,dispatch:()=>{}})){n=!1;break}return!i||!n?n:(this.promiseCreator(t).then(a=>{this.runHandlers(this.successHandlers,{value:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}).catch(a=>{this.runHandlers(this.failureHandlers,{error:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}),i(o),!0)}}validate(e,t="push"){return this.validateHandlers[t](e),this}success(e,t="push"){return this.successHandlers[t](e),this}failure(e,t="push"){return this.failureHandlers[t](e),this}runHandlers(e,t){var n;for(const r of e)if(!r({...t,dispatch:()=>{}}))break;(n=t.dispatch)==null||n.call(t,t.tr)}};function bh(e){const{type:t,attrs:n,range:r,selection:o}=e;return i=>{const{dispatch:s,tr:a,state:l}=i,c=Ae(t)?l.schema.marks[t]:t;if(Pe(c,{code:re.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||o){const{from:u,to:d}=uo(o??r??a.selection,a.doc);return Qg({trState:a,type:t,...r})?s==null||s(a.removeMark(u,d,c)):s==null||s(a.addMark(u,d,c.create(n))),!0}return bf(Xne(c,n))(i)}}function Pre(e,t,n){for(const{$from:r,$to:o}of n){let i=r.depth===0?t.type.allowsMarkType(e):!1;if(t.nodesBetween(r.pos,o.pos,s=>{if(i)return!1;i=s.inlineContent&&s.type.allowsMarkType(e)}),i)return!0}return!1}function Nre(e,t,n){return({tr:r,dispatch:o,state:i})=>{const s=uo(n??r.selection,r.doc),a=pne(s),l=Ae(e)?i.schema.marks[e]:e;if(Pe(l,{code:re.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),s.empty&&!a||!Pre(l,r.doc,s.ranges))return!1;if(!o)return!0;if(a)return r.removeStoredMark(l),t&&r.addStoredMark(l.create(t)),o(r),!0;let c=!1;for(const{$from:u,$to:d}of s.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,d.pos,l)}for(const{$from:u,$to:d}of s.ranges)c&&r.removeMark(u.pos,d.pos,l),t&&r.addMark(u.pos,d.pos,l.create(t));return o(r),!0}}function Tre(e,t={}){return({tr:n,dispatch:r,state:o})=>{const i=o.schema,s=n.selection,{from:a=s.from,to:l=a??s.to,marks:c={}}=t;if(!r)return!0;n.insertText(e,a,l);const u=Rt(n.steps,n.steps.length-1).getMap().map(l);for(const[d,h]of rn(c))n.addMark(a,u,Rt(i.marks,d).create(h));return r(n),!0}}var Ge=class extends Nt{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(e,...t)=>{const{forcedUpdates:n}=this.getCommandMeta(e);return this.setCommandMeta(e,{forcedUpdates:fh([...n,...t])}),e}}get name(){return"commands"}get transaction(){const e=this.store.getState();this._transaction||(this._transaction=e.tr);const t=this._transaction.before.eq(e.doc),n=!_a(this._transaction.steps);if(!t){const r=e.tr;if(n)for(const o of this._transaction.steps)r.step(o);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(e){var t;const{extensions:n,helpers:r}=this.store,o=we(),i=new Set;let s=we();const a=c=>{var u;const d=we(),h=()=>c??this.transaction;let p=[];const m=()=>p;for(const[x,b]of Object.entries(o))(u=s[x])!=null&&u.disableChaining||(d[x]=this.chainedFactory({chain:d,command:b.original,getTr:h,getChain:m}));const v=x=>{Pe(x===h(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return d.run=(x={})=>{const b=p;p=[];for(const w of b)if(!w(v)&&x.exitEarly)return;e.dispatch(h())},d.tr=()=>{const x=p;p=[];for(const b of x)b(v);return h()},d.enabled=()=>{for(const x of p)if(!x())return!1;return!0},d.new=x=>a(x),d};for(const c of n){const u=((t=c.createCommands)==null?void 0:t.call(c))??{},d=c.decoratedCommands??{},h={};s={...s,decoratedCommands:d};for(const[p,m]of Object.entries(d)){const v=Ae(m.shortcut)&&m.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(m.shortcut,c.options)}:void 0;this.updateDecorated(p,{...m,name:c.name,...v}),u[p]=c[p].bind(c),m.active&&(h[p]=()=>{var x;return((x=m.active)==null?void 0:x.call(m,c.options,this.store))??!1})}Dg(u)||this.addCommands({active:h,names:i,commands:o,extensionCommands:u})}const l=a();for(const[c,u]of Object.entries(l))a[c]=u;this.store.setStoreKey("commands",o),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",o),this.store.setExtensionStore("chain",a)}onStateUpdate({state:e}){this._transaction=e.tr}createPlugin(){return{}}customDispatch(e){return e}insertText(e,t={}){return Ae(e)?Tre(e,t):this.store.createPlaceholderCommand({promise:e,placeholder:{type:"inline"},onSuccess:(n,r,o)=>this.insertText(n,{...t,...r})(o)}).generateCommand()}selectText(e,t={}){return({tr:n,dispatch:r})=>{const o=uo(e,n.doc);return n.selection.anchor===o.anchor&&n.selection.head===o.head&&!t.forceUpdate?!1:(r==null||r(n.setSelection(o)),!0)}}selectMark(e){return t=>{const{tr:n}=t,r=ls(n.selection.$from,e);return r?this.store.commands.selectText.original({from:r.from,to:r.to})(t):!1}}delete(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=e??t.selection;return n==null||n(t.delete(r,o)),!0}}emptyUpdate(e){return({tr:t,dispatch:n})=>(n&&(e==null||e(),n(t)),!0)}forceUpdate(...e){return({tr:t,dispatch:n})=>(n==null||n(this.forceUpdateTransaction(t,...e)),!0)}updateNodeAttributes(e,t){return({tr:n,dispatch:r})=>(r==null||r(n.setNodeMarkup(e,void 0,t)),!0)}setContent(e,t){return n=>{const{tr:r,dispatch:o}=n,i=this.store.manager.createState({content:e,selection:t});return i?(o==null||o(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0):!1}}resetContent(){return e=>{const{tr:t,dispatch:n}=e,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(e):(n==null||n(t.delete(0,t.doc.nodeSize)),!0)}}emptySelection(){return({tr:e,dispatch:t})=>e.selection.empty?!1:(t==null||t(e.setSelection(Le.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>Kl(t.selection)?(e==null||e(t.insertText(`
|
|
482
|
-
`)),!0):!1}insertNode(e,t={}){return({dispatch:n,tr:r,state:o})=>{var i;const{attrs:s,range:a,selection:l,replaceEmptyParentBlock:c=!1}=t,{from:u,to:d,$from:h}=uo(l??a??r.selection,r.doc);if(Cy(e)||one(e)){const b=h.before(h.depth);return n==null||n(c&&u===d&&Tk(h.parent)?r.replaceWith(b,b+h.parent.nodeSize,e):r.replaceWith(u,d,e)),!0}const p=Ae(e)?o.schema.nodes[e]:e;Pe(p,{code:re.SCHEMA,message:`The requested node type ${e} does not exist in the schema.`});const m=(i=t.marks)==null?void 0:i.map(b=>{if(b instanceof tt)return b;const w=Ae(b)?o.schema.marks[b]:b;return Pe(w,{code:re.SCHEMA,message:`The requested mark type ${b} does not exist in the schema.`}),w.create()}),v=p.createAndFill(s,Ae(t.content)?o.schema.text(t.content):t.content,m);if(!v)return!1;const x=u!==d;return n==null||n(x?r.replaceRangeWith(u,d,v):r.insert(u,v)),!0}}focus(e){return t=>{const{dispatch:n,tr:r}=t,{view:o}=this.store;if(e===!1||o.hasFocus()&&(e===void 0||e===!0))return!1;if(e===void 0||e===!0){const{from:i=0,to:s=i}=r.selection;e={from:i,to:s}}return n&&this.delayedFocus(),this.selectText(e)(t)}}blur(e){return t=>{const{view:n}=this.store;return n.hasFocus()?(requestAnimationFrame(()=>{n.dom.blur()}),e?this.selectText(e)(t):!0):!1}}setBlockNodeType(e,t,n,r=!0){return ev(e,t,n,r)}toggleWrappingNode(e,t,n){return Nne(e,t,n)}toggleBlockNodeItem(e){return oL(e)}wrapInNode(e,t,n){return rL(e,t,n)}applyMark(e,t,n){return Nre(e,t,n)}toggleMark(e){return bh(e)}removeMark(e){return sL(e)}setMeta(e,t){return({tr:n})=>(n.setMeta(e,t),!0)}selectAll(){return this.selectText("all")}copy(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({promise:async()=>{var e;return(e=navigator.clipboard)!=null&&e.readText?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(e,t,n)=>this.insertNode(mw({content:e,schema:n.state.schema}),{selection:t})(n)}).generateCommand()}cut(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("cut"),!0)}replaceText(e){return Mne(e)}getAllCommandOptions(){const e={};for(const[t,n]of this.decorated)Dg(n)||(e[t]=n);return e}getCommandOptions(e){return this.decorated.get(e)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(e,t){if(!t){this.decorated.delete(e);return}const n=this.decorated.get(e)??{name:""};this.decorated.set(e,{...n,...t})}handleIosFocus(){Oo.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(e){return this.getCommandMeta(e).forcedUpdates}getCommandMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...Ore,...t}}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addCommands(e){const{extensionCommands:t,commands:n,names:r,active:o}=e;for(const[i,s]of rn(t))vL({name:i,set:r,code:re.DUPLICATE_COMMAND_NAMES}),Pe(!Mre.has(i),{code:re.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[i]=this.createUnchainedCommand(s,o[i])}unchainedFactory(e){return(...t)=>{const{shouldDispatch:n=!0,command:r}=e,{view:o}=this.store,{state:i}=o;let s;return n&&(s=o.dispatch),r(...t)({state:i,dispatch:s,view:o,tr:i.tr})}}createUnchainedCommand(e,t){const n=this.unchainedFactory({command:e});return n.enabled=this.unchainedFactory({command:e,shouldDispatch:!1}),n.isEnabled=n.enabled,n.original=e,n.active=t,n}chainedFactory(e){return(...t)=>{const{chain:n,command:r,getTr:o,getChain:i}=e,s=i(),{view:a}=this.store,{state:l}=a;return s.push(c=>r(...t)({state:l,dispatch:c,view:a,tr:o()})),n}}};me([ye()],Ge.prototype,"customDispatch",1);me([ye()],Ge.prototype,"insertText",1);me([ye()],Ge.prototype,"selectText",1);me([ye()],Ge.prototype,"selectMark",1);me([ye()],Ge.prototype,"delete",1);me([ye()],Ge.prototype,"emptyUpdate",1);me([ye()],Ge.prototype,"forceUpdate",1);me([ye()],Ge.prototype,"updateNodeAttributes",1);me([ye()],Ge.prototype,"setContent",1);me([ye()],Ge.prototype,"resetContent",1);me([ye()],Ge.prototype,"emptySelection",1);me([ye()],Ge.prototype,"insertNewLine",1);me([ye()],Ge.prototype,"insertNode",1);me([ye()],Ge.prototype,"focus",1);me([ye()],Ge.prototype,"blur",1);me([ye()],Ge.prototype,"setBlockNodeType",1);me([ye()],Ge.prototype,"toggleWrappingNode",1);me([ye()],Ge.prototype,"toggleBlockNodeItem",1);me([ye()],Ge.prototype,"wrapInNode",1);me([ye()],Ge.prototype,"applyMark",1);me([ye()],Ge.prototype,"toggleMark",1);me([ye()],Ge.prototype,"removeMark",1);me([ye()],Ge.prototype,"setMeta",1);me([ye({description:({t:e})=>e(Pa.SELECT_ALL_DESCRIPTION),label:({t:e})=>e(Pa.SELECT_ALL_LABEL),shortcut:oe.SelectAll})],Ge.prototype,"selectAll",1);me([ye({description:({t:e})=>e(Pa.COPY_DESCRIPTION),label:({t:e})=>e(Pa.COPY_LABEL),shortcut:oe.Copy,icon:"fileCopyLine"})],Ge.prototype,"copy",1);me([ye({description:({t:e})=>e(Pa.PASTE_DESCRIPTION),label:({t:e})=>e(Pa.PASTE_LABEL),shortcut:oe.Paste,icon:"clipboardLine"})],Ge.prototype,"paste",1);me([ye({description:({t:e})=>e(Pa.CUT_DESCRIPTION),label:({t:e})=>e(Pa.CUT_LABEL),shortcut:oe.Cut,icon:"scissorsFill"})],Ge.prototype,"cut",1);me([ye()],Ge.prototype,"replaceText",1);me([zt()],Ge.prototype,"getAllCommandOptions",1);me([zt()],Ge.prototype,"getCommandOptions",1);me([zt()],Ge.prototype,"getCommandProp",1);Ge=me([ot({defaultPriority:ht.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],Ge);var Ore={forcedUpdates:[]},Mre=new Set(["run","chain","original","raw","enabled","tr","new"]),Yo=class extends Nt{constructor(){super(...arguments),this.placeholders=it.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{const t=Fg(),{promise:n,placeholder:r,onFailure:o,onSuccess:i}=e;return new _re(n).validate(s=>this.addPlaceholder(t,r)(s)).success(s=>{const{state:a,tr:l,dispatch:c,view:u,value:d}=s,h=this.store.helpers.findPlaceholder(t);if(!h){const p=new Error("The placeholder has been removed");return(o==null?void 0:o({error:p,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(t)({state:a,tr:l,view:u,dispatch:()=>{}}),i(d,h,{state:a,tr:l,dispatch:c,view:u})}).failure(s=>(this.removePlaceholder(t)({...s,dispatch:()=>{}}),(o==null?void 0:o(s))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:e=>{var t,n,r,o,i,s;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(e);if(l){this.placeholders=it.empty;for(const[,d]of this.placeholderWidgets)(n=(t=d.spec).onDestroy)==null||n.call(t,this.store.view,d.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(e.mapping,e.doc,{onRemove:d=>{var h,p;const m=this.placeholderWidgets.get(d.id);m&&((p=(h=m.spec).onDestroy)==null||p.call(h,this.store.view,m.spec.element))}});for(const[,d]of this.placeholderWidgets)(o=(r=d.spec).onUpdate)==null||o.call(r,this.store.view,d.from,d.spec.element,d.spec.data);for(const d of a){if(d.type==="inline"){this.addInlinePlaceholder(d,e);continue}if(d.type==="node"){this.addNodePlaceholder(d,e);continue}if(d.type==="widget"){this.addWidgetPlaceholder(d,e);continue}}for(const{id:d,data:h}of u){const p=this.placeholderWidgets.get(d);if(!p)continue;const m=Ct.widget(p.from,p.spec.element,{...p.spec,data:h});this.placeholders=this.placeholders.remove([p]).add(e.doc,[m]),this.placeholderWidgets.set(d,m)}for(const d of c){const h=this.placeholders.find(void 0,void 0,m=>m.id===d&&m.__type===ac),p=this.placeholderWidgets.get(d);p&&((s=(i=p.spec).onDestroy)==null||s.call(i,this.store.view,p.spec.element)),this.placeholders=this.placeholders.remove(h),this.placeholderWidgets.delete(d)}}},props:{decorations:e=>{let t=this.options.decorations(e);t=t.add(e.doc,this.placeholders.find());for(const n of this.store.extensions){if(!n.createDecorations)continue;const r=n.createDecorations(e).find();t=t.add(e.doc,r)}return t},handleDOMEvents:{blur:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(dN,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(dN,!0)),!1)}}}}updateDecorations(){return({tr:e,dispatch:t})=>(t==null||t(e),!0)}addPlaceholder(e,t,n){return({dispatch:r,tr:o})=>this.addPlaceholderTransaction(e,t,o,!r)?(r==null||r(n?o.deleteSelection():o),!0):!1}updatePlaceholder(e,t){return({dispatch:n,tr:r})=>this.updatePlaceholderTransaction({id:e,data:t,tr:r,checkOnly:!n})?(n==null||n(r),!0):!1}removePlaceholder(e){return({dispatch:t,tr:n})=>this.removePlaceholderTransaction({id:e,tr:n,checkOnly:!t})?(t==null||t(n),!0):!1}clearPlaceholders(){return({tr:e,dispatch:t})=>this.clearPlaceholdersTransaction({tr:e,checkOnly:!t})?(t==null||t(e),!0):!1}findPlaceholder(e){return this.findAllPlaceholders().get(e)}findAllPlaceholders(){const e=new Map,t=this.placeholders.find(void 0,void 0,n=>n.__type===ac);for(const n of t)e.set(n.spec.id,{from:n.from,to:n.to});return e}createDecorations(e){var t,n,r;const{persistentSelectionClass:o}=this.options;return!o||(t=this.store.view)!=null&&t.hasFocus()||(r=(n=this.store.helpers).isInteracting)!=null&&r.call(n)?it.empty:Rre(e,it.empty,{class:Ae(o)?o:"selection"})}onApplyState(){}addWidgetPlaceholder(e,t){const{pos:n,createElement:r,onDestroy:o,onUpdate:i,className:s,nodeName:a,id:l,type:c}=e,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(s);const d=Ct.widget(n,u,{id:l,__type:ac,type:c,element:u,onDestroy:o,onUpdate:i});this.placeholderWidgets.set(l,d),this.placeholders=this.placeholders.add(t.doc,[d])}addInlinePlaceholder(e,t){const{from:n=t.selection.from,to:r=t.selection.to,className:o,nodeName:i,id:s,type:a}=e;let l;if(n===r){const c=document.createElement(i);c.classList.add(o),l=Ct.widget(n,c,{id:s,type:a,__type:ac,widget:c})}else l=Ct.inline(n,r,{nodeName:i,class:o},{id:s,__type:ac});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){const{pos:n,className:r,nodeName:o,id:i}=e,s=Br(n)?t.doc.resolve(n):t.selection.$from,a=Br(n)?s.nodeAfter?{pos:n,end:s.nodeAfter.nodeSize}:void 0:qte(s);if(!a)return;const l=Ct.node(a.pos,a.end,{nodeName:o,class:r},{id:i,__type:ac});this.placeholders=this.placeholders.add(t.doc,[l])}withRequiredBase(e,t){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:o=n,className:i,...s}=t,a=(i?[r,i]:[r]).join(" ");return{nodeName:o,className:a,...s,id:e}}getMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...jre,...t}}setMeta(e,t){const n=this.getMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addPlaceholderTransaction(e,t,n,r=!1){if(this.findPlaceholder(e))return!1;if(r)return!0;const{added:i}=this.getMeta(n);return this.setMeta(n,{added:[...i,this.withRequiredBase(e,t)]}),!0}updatePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1,data:o}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{updated:s}=this.getMeta(n);return this.setMeta(n,{updated:fh([...s,{id:t,data:o}])}),!0}removePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{removed:i}=this.getMeta(n);return this.setMeta(n,{removed:fh([...i,t])}),!0}clearPlaceholdersTransaction(e){const{tr:t,checkOnly:n=!1}=e;return this.getPluginState()===it.empty?!1:(n||this.setMeta(t,{clearTrackers:!0}),!0)}};me([ye()],Yo.prototype,"updateDecorations",1);me([ye()],Yo.prototype,"addPlaceholder",1);me([ye()],Yo.prototype,"updatePlaceholder",1);me([ye()],Yo.prototype,"removePlaceholder",1);me([ye()],Yo.prototype,"clearPlaceholders",1);me([zt()],Yo.prototype,"findPlaceholder",1);me([zt()],Yo.prototype,"findAllPlaceholders",1);Yo=me([ot({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(e,t,n)=>e.add(n.doc,t.find()),getDefault:()=>it.empty}}},defaultPriority:ht.Low})],Yo);var jre={added:[],updated:[],clearTrackers:!1,removed:[]},ac="placeholderDecoration",dN="persistentSelectionFocus";function Rre(e,t,n){const{selection:r,doc:o}=e;if(r.empty)return t;const{from:i,to:s}=r,a=_y(r)?Ct.node(i,s,n):Ct.inline(i,s,n);return t.add(o,[a])}var yw=class extends Nt{get name(){return"docChanged"}onStateUpdate(e){const{firstUpdate:t,transactions:n,tr:r}=e;t||(n??[r]).some(o=>o==null?void 0:o.docChanged)&&this.options.docChanged(e)}};yw=me([ot({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:ht.Lowest})],yw);var fo=class extends Nt{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",mw);const t=we(),n=we(),r=we(),o=new Set;for(const i of this.store.extensions){gp(i)&&(n[i.name]=a=>Xte({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=xh({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),My(i)&&(n[i.name]=a=>Qg({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=ls(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(_k(l.mark,a))return l.mark.attrs});const s=((e=i.createHelpers)==null?void 0:e.call(i))??{};for(const a of Object.keys(i.decoratedHelpers??{}))s[a]=i[a].bind(i);if(!Dg(s))for(const[a,l]of rn(s))vL({name:a,set:o,code:re.DUPLICATE_HELPER_NAMES}),t[a]=l}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",n),this.store.setStoreKey("helpers",t),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",n),this.store.setExtensionStore("helpers",t)}isSelectionEmpty(e=this.store.getState()){return Ck(e)}isViewEditable(e=this.store.getState()){var t,n;return((n=(t=this.store.view.props).editable)==null?void 0:n.call(t,e))??!1}getStateJSON(e=this.store.getState()){return e.toJSON()}getJSON(e=this.store.getState()){return e.doc.toJSON()}getRemirrorJSON(e=this.store.getState()){return this.getJSON(e)}insertHtml(e,t){return n=>{const{state:r}=n,o=mw({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(o,t)(n)}}getText({lineBreakDivider:e=`
|
|
480
|
+
If you are using Node.js, you can install JSDOM and Remirror will try to use it automatically, or you can create a fake document and pass it to Remirror`)}function eL(e){var t;return(e==null?void 0:e.defaultView)??(typeof window<"u"?window:void 0)??((t=oD())==null?void 0:t.defaultView)}function yne(e){return eL(e==null?void 0:e.ownerDocument)}function xne(e){const t=eL(e)??Ny().defaultView;if(t)return t;throw new Error("Unable to retrieve the window from the global scope")}function bne(e,t=Ny()){const n=mne(e,e.type.schema)?e.content:q.from(e);return $a.fromSchema(e.type.schema).serializeFragment(n,{document:t})}function wne(e,t){return new(xne(t)).DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function Sne(e,t=Ny()){const n=t.createElement("div");return n.append(bne(e,t)),n.innerHTML}function mw(e){const{content:t,schema:n,document:r,fragment:o=!1,...i}=e,s=wne(t,r),a=bu.fromSchema(n);return o?a.parseSlice(s,{...sN,...i}).content:a.parse(s,{...sN,...i})}var sN={preserveWhitespace:!1};function tL(e,t){const n=dh(t.defaults());return ik({...e},n)}var kne={remove(e,t){let n=e;for(const r of t)r.invalidParentNode||(n=sZ(r.path,n));return n}};function Ene({json:e,schema:t,...n}){const r=new Set(dh(t.marks)),o=new Set(dh(t.nodes)),i=nL({json:e,path:[],validNodes:o,validMarks:r});return{json:e,invalidContent:i,transformers:kne,...n}}function nL(e){const{json:t,validMarks:n,validNodes:r,path:o=[]}=e,i={validMarks:n,validNodes:r},s=[],{type:a,marks:l,content:c}=t;let{invalidParentMark:u=!1,invalidParentNode:d=!1}=e;if(l){const h=[];for(const[p,m]of l.entries()){const v=De(m)?m:m.type;n.has(v)||(h.unshift({name:v,path:[...o,"marks",`${p}`],type:"mark",invalidParentMark:u,invalidParentNode:d}),u=!0)}s.push(...h)}if(r.has(a)||(s.push({name:a,type:"node",path:o,invalidParentMark:u,invalidParentNode:d}),d=!0),c){const h=[];for(const[p,m]of c.entries())h.unshift(...nL({...i,json:m,path:[...o,"content",`${p}`],invalidParentMark:u,invalidParentNode:d}));s.unshift(...h)}return s}function Cne(e){return!!(Kl(e)&&e.$cursor&&e.$cursor.parentOffset>=e.$cursor.parent.content.size)}function gw(e){return!!(Kl(e)&&e.$cursor&&e.$cursor.parentOffset<=0)}function aN(e){const t=Ke.atStart(e.$anchor.doc);return!!(gw(e)&&t.anchor===e.anchor)}function _ne(e){return({dispatch:t,tr:n})=>{const{type:r,attrs:o=we(),appendText:i,range:s}=e,a=s?Le.between(n.doc.resolve(s.from),n.doc.resolve(s.to)):n.selection,{$from:l,from:c,to:u}=a;let d=l.depth===0?n.doc.type.allowsMarkType(r):!1;return n.doc.nodesBetween(c,u,h=>{if(d)return!1;if(h.inlineContent&&h.type.allowsMarkType(r)){d=!0;return}}),d?(t==null||t(n.addMark(c,u,r.create(o))&&i?n.insertText(i):n),!0):!1}}function Pne({tr:e,dispatch:t}){const{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Yu(o);return!Br(i)||!o?!1:(t==null||t(e.lift(o,i).scrollIntoView()),!0)}function rL(e,t={},n){return function(r){const{tr:o,dispatch:i,state:s}=r,a=De(e)?Rt(s.schema.nodes,e):e,{from:l,to:c}=uo(n??o.selection,o.doc),u=o.doc.resolve(l),d=o.doc.resolve(c),h=u.blockRange(d),p=h&&ck(h,a,t);return!p||!h?!1:(i==null||i(o.wrap(h,p).scrollIntoView()),!0)}}function Nne(e,t={},n){return r=>{const{tr:o,state:i}=r,s=De(e)?Rt(i.schema.nodes,e):e;return xh({state:o,type:s,attrs:t})?Pne(r):rL(e,t,n)(r)}}function ev(e,t,n,r=!0){return function(o){const{tr:i,dispatch:s,state:a}=o,l=De(e)?Rt(a.schema.nodes,e):e,{from:c,to:u}=uo(n??i.selection,i.doc);let d=!1,h;return i.doc.nodesBetween(c,u,(p,m)=>{if(d)return!1;if(!p.isTextblock||p.hasMarkup(l,t))return;if(p.type===l){d=!0,h=p.attrs;return}const v=i.doc.resolve(m),x=v.index();d=v.parent.canReplaceWith(x,x+1,l),d&&(h=v.parent.attrs)}),d?(s==null||s(i.setBlockType(c,u,l,{...r?h:{},...t}).scrollIntoView()),!0):!1}}function oL(e){return t=>{const{tr:n,state:r}=t,{type:o,attrs:i,preserveAttrs:s=!0}=e,a=xh({state:n,type:o,attrs:i}),l=e.toggleType??Py(r.schema);if(a)return ev(l,{...s?a.node.attrs:{},...i})(t);const c=xh({state:n,type:l,attrs:i});return ev(o,{...s?c==null?void 0:c.node.attrs:{},...i})(t)}}function Tne(e=0){const t=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return t?Number.parseInt(Rt(t,2),10)>=e:!1}function One(e,t){let{head:n,empty:r,anchor:o}=e;for(const i of t.steps)n=i.getMap().map(n);r?t.setSelection(Le.near(t.doc.resolve(n))):t.setSelection(Le.between(t.doc.resolve(o),t.doc.resolve(n)))}function Mne(e){const{attrs:t={},appendText:n="",content:r="",keepSelection:o=!1,range:i}=e;return({state:s,tr:a,dispatch:l})=>{var c;const u=s.schema,d=uo(e.selection??i??a.selection,a.doc),h=d.$from.index(),{from:p,to:m,$from:v}=d,x=De(e.type)?u.nodes[e.type]??u.marks[e.type]:e.type;if(Pe(De(e.type)?x:!0,{code:re.SCHEMA,message:`Schema contains no marks or nodes with name ${x}`}),tne(x)){if(!v.parent.canReplaceWith(h,h,x))return!1;a.replaceWith(p,m,x.create(t,r?u.text(r):void 0))}else Pe(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(p,m,u.text(r,qD(x)?[x.create(t)]:void 0));return n&&a.insertText(n),o&&One(s.selection,a),l&&(Tne(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function iL(e,t){const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const{marks:r,nodeSize:o}=n.node;if(r[0])return r[0].type;const s=e.start()+n.offset+o;return iL(e.doc.resolve(s+1))}function sL(e){return({dispatch:t,tr:n,state:r})=>{const{type:o,expand:i=!0,range:s}=e,a=uo(e.selection??s??n.selection,n.doc);let{from:l,to:c,$from:u,$to:d}=a;const h=De(o)?r.schema.marks[o]:o;h!==null&&Pe(h,{code:re.SCHEMA,message:`Mark type: ${o} does not exist on the current schema.`});const p=h??iL(u);if(!p)return!1;const m=ls(u,p,d);return i&&m&&(l=Math.max(0,Math.min(l,m.from)),c=Math.min(Math.max(c,m.to),n.doc.nodeSize-2)),t==null||t(n.removeMark(l,Br(c)?c:l,qD(h)?h:void 0)),!0}}function tv(e){const{regexp:t,type:n,getAttributes:r,ignoreWhitespace:o=!1,beforeDispatch:i,updateCaptured:s,shouldSkip:a,invalidMarks:l}=e;let c;const u=new mo(t,(d,h,p,m)=>{const{tr:v,schema:x}=d;c||(c=De(n)?x.marks[n]:n,Pe(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let b=h[1],w=h[0];const S=jne({captureGroup:b,fullMatch:w,end:m,start:p,rule:u,state:d,ignoreWhitespace:o,invalidMarks:l,shouldSkip:a,updateCaptured:s});if(!S)return null;({start:p,end:m,captureGroup:b,fullMatch:w}=S);const C=Pt(r)?r(h):r;let _=m,P=[];if(b){const O=w.search(/\S/),M=p+w.indexOf(b),I=M+b.length;P=v.storedMarks??[],I<m&&v.delete(I,m),M>p&&v.delete(p+O,M),_=p+O+b.length}return v.addMark(p,_,c.create(C)),v.setStoredMarks(P),i==null||i({tr:v,match:h,start:p,end:m}),v});return u}function jne({captureGroup:e,fullMatch:t,end:n,start:r,rule:o,ignoreWhitespace:i,shouldSkip:s,updateCaptured:a,state:l,invalidMarks:c}){var u;if(t==null)return null;const d=(a==null?void 0:a({captureGroup:e,fullMatch:t,start:r,end:n}))??{};e=d.captureGroup??e,t=d.fullMatch??t,r=d.start??r,n=d.end??n;const h=l.doc.resolve(r),p=l.doc.resolve(n);return c&&fw({$from:h,$to:p},c)||o.invalidMarks&&fw({$from:h,$to:p},o.invalidMarks)||i&&(e==null?void 0:e.trim())===""||s!=null&&s({state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})||(u=o.shouldSkip)!=null&&u.call(o,{state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})?null:{captureGroup:e,end:n,fullMatch:t,start:r}}var Rne=function(){const t=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];t.forEach(i=>{(i?i.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const o=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&o.push(n[i]);return o.push(...r),o.join(" ")},Ine=Rne;const aL=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Ane(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const lL=(e,t,n)=>{let r=Ane(e,n);if(!r)return!1;let o=cL(r);if(!o){let s=r.blockRange(),a=s&&Yu(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(fL(e,o,t,-1))return!0;if(r.parent.content.size==0&&(Eu(i,"end")||Oe.isSelectable(i)))for(let s=r.depth;;s--){let a=uk(e.doc,r.before(s),r.after(s),se.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(Eu(i,"end")?Ke.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Oe.create(l.doc,o.pos-i.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function Eu(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Dne=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=cL(r)}let s=i&&i.nodeBefore;return!s||!Oe.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Oe.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function cL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Lne(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Fne=(e,t,n)=>{let r=Lne(e,n);if(!r)return!1;let o=uL(r);if(!o)return!1;let i=o.nodeAfter;if(fL(e,o,t,1))return!0;if(r.parent.content.size==0&&(Eu(i,"start")||Oe.isSelectable(i))){let s=uk(e.doc,r.before(),r.after(),se.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(Eu(i,"start")?Ke.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Oe.create(a.doc,a.mapping.map(o.pos))),t(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},zne=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=uL(r)}let s=i&&i.nodeAfter;return!s||!Oe.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Oe.create(e.doc,i.pos)).scrollIntoView()),!0)};function uL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const $ne=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
481
|
+
`).scrollIntoView()),!0)};function Ok(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const dL=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Ok(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ke.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Bne=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Xn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ok(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(s,i.createAndFill());a.setSelection(Le.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},Vne=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Gc(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Yu(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function Une(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof Oe&&t.selection.node.isBlock)return!r.parentOffset||!Gc(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=Ok(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof Le||t.selection instanceof Xn)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=Gc(u.doc,d,i.length,i);if(h||(i[0]=a?{type:a}:null,h=Gc(u.doc,d,i.length,i)),u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),m=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const Hne=Une(),Wne=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(Oe.create(e.doc,o))),!0)},Kne=(e,t)=>(t&&t(e.tr.setSelection(new Xn(e.doc))),!0);function Gne(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||dp(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function fL(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&Gne(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,m=q.empty;for(let b=s.length-1;b>=0;b--)m=q.from(s[b].create(null,m));m=q.from(o.copy(m));let v=e.tr.step(new Ht(t.pos-1,p,t.pos,p,new se(m,1,0),s.length,!0)),x=v.doc.resolve(p+2*s.length);x.nodeAfter&&x.nodeAfter.type==o.type&&dp(v.doc,x.pos)&&v.join(x.pos),n(v.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Ke.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),h=d&&Yu(d);if(h!=null&&h>=t.depth)return n&&n(e.tr.lift(d,h).scrollIntoView()),!0;if(c&&Eu(i,"start",!0)&&Eu(o,"end")){let p=o,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let v=i,x=1;for(;!v.isTextblock;v=v.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(n){let b=q.empty;for(let S=m.length-1;S>=0;S--)b=q.from(m[S].copy(b));let w=e.tr.step(new Ht(t.pos-m.length,t.pos+i.nodeSize,t.pos+x,t.pos+i.nodeSize-x,new se(b,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function hL(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(Le.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const qne=hL(-1),Yne=hL(1);function Jne(e,t,n,r){for(let o=0;o<t.length;o++){let{$from:i,$to:s}=t[o],a=i.depth==0?e.inlineContent&&e.type.allowsMarkType(n):!1;if(e.nodesBetween(i.pos,s.pos,(l,c)=>{if(a||!r)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function Xne(e,t=null,n){let r=n!==!1;return function(o,i){let{empty:s,$cursor:a,ranges:l}=o.selection;if(s&&!a||!Jne(o.doc,l,e,r))return!1;if(i)if(a)e.isInSet(o.storedMarks||a.marks())?i(o.tr.removeStoredMark(e)):i(o.tr.addStoredMark(e.create(t)));else{let c,u=o.tr;c=!l.some(d=>o.doc.rangeHasMark(d.$from.pos,d.$to.pos,e));for(let d=0;d<l.length;d++){let{$from:h,$to:p}=l[d];if(!c)u.removeMark(h.pos,p.pos,e);else{let m=h.pos,v=p.pos,x=h.nodeAfter,b=p.nodeBefore,w=x&&x.isText?/^\s*/.exec(x.text)[0].length:0,S=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;m+w<v&&(m+=w,v-=S),u.addMark(m,v,e.create(t))}}i(u.scrollIntoView())}return!0}}function Ty(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let l0=Ty(aL,lL,Dne),lN=Ty(aL,Fne,zne);const Di={Enter:Ty($ne,Bne,Vne,Hne),"Mod-Enter":dL,Backspace:l0,"Mod-Backspace":l0,"Shift-Backspace":l0,Delete:lN,"Mod-Delete":lN,"Mod-a":Kne},pL={"Ctrl-h":Di.Backspace,"Alt-Backspace":Di["Mod-Backspace"],"Ctrl-d":Di.Delete,"Ctrl-Alt-Backspace":Di["Mod-Delete"],"Alt-Delete":Di["Mod-Delete"],"Alt-d":Di["Mod-Delete"],"Ctrl-a":qne,"Ctrl-e":Yne};for(let e in Di)pL[e]=Di[e];const Zne=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,c0=Zne?pL:Di;var Na={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},nv={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qne=typeof navigator<"u"&&/Mac/.test(navigator.platform),ere=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Sn=0;Sn<10;Sn++)Na[48+Sn]=Na[96+Sn]=String(Sn);for(var Sn=1;Sn<=24;Sn++)Na[Sn+111]="F"+Sn;for(var Sn=65;Sn<=90;Sn++)Na[Sn]=String.fromCharCode(Sn+32),nv[Sn]=String.fromCharCode(Sn);for(var u0 in Na)nv.hasOwnProperty(u0)||(nv[u0]=Na[u0]);function tre(e){var t=Qne&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ere&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?nv:Na)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const nre=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function rre(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))nre?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function ore(e){let t=Object.create(null);for(let n in e)t[rre(n)]=e[n];return t}function d0(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function mL(e){let t=ore(e);return function(n,r){let o=tre(r),i,s=t[d0(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[d0(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=Na[r.keyCode])&&i!=o){let a=t[d0(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function ire(e){const t=jl(e,(i,s)=>(s.priority??ht.Low)-(i.priority??ht.Low)),n=[],r=[];for(const i of t)fre(i)?n.push(i):r.push(i);let o;return new fs({key:sre,view:i=>(o=i,{}),props:{transformPasted:i=>{var c,u,d;const s=o.state.selection.$from,a=s.node().type.name,l=new Set(s.marks().map(h=>h.type.name));for(const h of n){if((c=h.ignoredNodes)!=null&&c.includes(a)||(u=h.ignoredMarks)!=null&&u.some(w=>l.has(w)))continue;const p=((d=i.content.firstChild)==null?void 0:d.textContent)??"",m=!o.state.selection.empty&&i.content.childCount===1&&p,v=xy(p,h.regexp)[0];if(m&&v&&h.type==="mark"&&h.replaceSelection){const{from:w,to:S}=o.state.selection,C=o.state.doc.slice(w,S),_=C.content.textBetween(0,C.content.size);if(typeof h.replaceSelection!="boolean"?h.replaceSelection(_):h.replaceSelection){const P=[],{getAttributes:O,markType:M}=h,I=Pt(O)?O(v,!0):O,L=M.create(I);return C.content.forEach(U=>{if(U.isText){const $=L.addToSet(U.marks);P.push(U.mark($))}}),se.maxOpen(q.fromArray(P))}}const{nodes:x,transformed:b}=ure(i.content,h,o.state.schema);b&&(i=h.type==="node"&&h.nodeType.isBlock?new se(q.fromArray(x),0,0):new se(q.fromArray(x),i.openStart,i.openEnd))}return gre(i)},handleDOMEvents:{paste:(i,s)=>{var d,h;const a=s;if(!((h=(d=i.props).editable)!=null&&h.call(d,i.state)))return!1;const{clipboardData:l}=a;if(!l)return!1;const c=[...l.items].map(p=>p.getAsFile()).filter(p=>!!p);if(c.length===0)return!1;const{selection:u}=i.state;for(const{fileHandler:p,regexp:m}of r){const v=m?c.filter(x=>m.test(x.type)):c;if(v.length!==0&&p({event:a,files:v,selection:u,view:i,type:"paste"}))return a.preventDefault(),!0}return!1},drop:(i,s)=>{var p,m,v;const a=s;if(!((m=(p=i.props).editable)!=null&&m.call(p,i.state)))return!1;const{dataTransfer:l,clientX:c,clientY:u}=a;if(!l)return!1;const d=mre(a);if(d.length===0)return!1;const h=((v=i.posAtCoords({left:c,top:u}))==null?void 0:v.pos)??i.state.selection.anchor;for(const{fileHandler:x,regexp:b}of r){const w=b?d.filter(S=>b.test(S.type)):d;if(w.length!==0&&x({event:a,files:w,pos:h,view:i,type:"drop"}))return a.preventDefault(),!0}return!1}}}})}var sre=new Ju("pasteRule");function f0(e,t){return function n(r){const{fragment:o,rule:i,nodes:s}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=i;let d=!1;return o.forEach(h=>{if(u!=null&&u.includes(h.type.name)||hre(h)){s.push(h);return}if(!h.isText){const v=n({fragment:h.content,rule:i,nodes:[]});d||(d=v.transformed);const x=q.fromArray(v.nodes);h.type.validContent(x)?s.push(h.copy(x)):s.push(...v.nodes);return}if(h.marks.some(v=>pre(v)||(c==null?void 0:c.includes(v.type.name)))){s.push(h);return}const p=h.text??"";let m=0;for(const v of xy(p,a)){const x=v[1],b=v[0];if(l&&(x==null?void 0:x.trim())===""||!b)return;const w=v.index,S=w+b.length;w>m&&s.push(h.cut(m,w));let C=h.cut(w,S);if(b&&x){const _=b.search(/\S/),P=w+b.indexOf(x),O=P+x.length;_&&s.push(h.cut(w,w+_)),C=h.cut(P,O)}e({nodes:s,rule:i,textNode:C,match:v,schema:t}),d=!0,m=S}p&&m<p.length&&s.push(h.cut(m))}),{nodes:s,transformed:d}}}function are(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s,getAttributes:a,markType:l}=n,c=Pt(a)?a(o,!1):a,u=r.text??"",d=l.create(c),h=s==null?void 0:s(o);if(h==="")return;if(h===!1){t.push(i.text(u,r.marks));return}const p=d.addToSet(r.marks);t.push(i.text(h??u,p))}function lre(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s}=n,a=s==null?void 0:s(o);if(a===""||a===!1)return;const l=a??r.text??"";t.push(i.text(l,r.marks))}function cre(e){const{nodes:t,rule:n,textNode:r,match:o}=e,{getAttributes:i,nodeType:s,getContent:a}=n,l=Pt(i)?i(o,!1):i,c=(a?a(o):r)||void 0;t.push(s.createChecked(l,c))}function ure(e,t,n){const r=[];switch(t.type){case"mark":return f0(are,n)({fragment:e,nodes:r,rule:t});case"node":return f0(cre,n)({fragment:e,nodes:r,rule:t});default:return f0(lre,n)({fragment:e,nodes:r,rule:t})}}var dre=["mark","node","text"];function fre(e){return Go(dre,e.type)}function hre(e){var t;return e.type.spec.code||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function pre(e){var t;return e.type.name==="code"||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function mre(e){var n,r;const{dataTransfer:t}=e;return t?((n=t.files)==null?void 0:n.length)>0?[...t.files]:(r=t.items)!=null&&r.length?[...t.items].map(o=>o.getAsFile()).filter(o=>!!o):[]:[]}function gre(e){const t=se.maxOpen(e.content);return t.openStart<e.openStart||t.openEnd<e.openEnd?t:e}var vre=Object.defineProperty,yre=Object.getOwnPropertyDescriptor,me=(e,t,n,r)=>{for(var o=r>1?void 0:r?yre(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&vre(t,n,o),o},gL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},le=(e,t,n)=>(gL(e,t,"read from private field"),n?n.call(e):t.get(e)),qt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},cn=(e,t,n,r)=>(gL(e,t,"write to private field"),t.set(e,n),n);function xre(e,t){return e===t}function cN(e){const{previousOptions:t,update:n,equals:r=xre}=e,o=rl({...t,...n}),i=we(),s=dh(t);for(const l of s){const c=t[l],u=o[l];if(r(c,u)){i[l]={changed:!1};continue}i[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=we();for(const u of l){const d=i[u];d!=null&&d.changed&&(c[u]=d.value)}return c};return{changes:rl(i),options:o,pickChanged:a}}var bre={[re.DUPLICATE_HELPER_NAMES]:"helper method",[re.DUPLICATE_COMMAND_NAMES]:"command method"};function vL(e){const{name:t,set:n,code:r}=e,o=bre[r];Pe(!n.has(t),{code:r,message:`There is a naming conflict for the name: ${t} used in this '${o}'. Please rename or remove from the editor to avoid runtime errors.`}),n.add(t)}function vw(...e){return fh(Ine(...e).split(" ")).join(" ")}var uN="__IGNORE__",wre="__ALL__",Qu=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=we(),this.populateMappedHandlers(),this._options=this._initialOptions=nZ(e,this.constructor.defaultOptions,t??we(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){const e=[],{customHandlerKeys:t,handlerKeys:n,staticKeys:r}=this.constructor;for(const o of dh(this._options))r.includes(o)||n.includes(o)||t.includes(o)||e.push(o);return e}ensureAllKeysAreDynamic(e){}setOptions(e){var t;const n=this.getDynamicOptions();this.ensureAllKeysAreDynamic(e);const{changes:r,options:o,pickChanged:i}=cN({previousOptions:n,update:e});this.updateDynamicOptions(o),(t=this.onSetOptions)==null||t.call(this,{reason:"set",changes:r,options:o,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var e;const t=this.getDynamicOptions(),{changes:n,options:r,pickChanged:o}=cN({previousOptions:t,update:this._initialOptions});this.updateDynamicOptions(r),(e=this.onSetOptions)==null||e.call(this,{reason:"reset",options:r,changes:n,pickChanged:o,initialOptions:this._initialOptions})}getDynamicOptions(){return ik(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(e){this._options={...this._options,...e}}populateMappedHandlers(){for(const e of this.constructor.handlerKeys)this._mappedHandlers[e]=[]}createDefaultHandlerOptions(){const e=we();for(const t of this.constructor.handlerKeys)e[t]=(...n)=>{var r;const{handlerKeyOptions:o}=this.constructor,i=(r=o[t])==null?void 0:r.reducer;let s=i==null?void 0:i.getDefault(...n);for(const[,a]of this._mappedHandlers[t]){const l=a(...n);if(s=i?i.accumulator(s,l,...n):l,Sre(o,s,t))return s}return s};return e}addHandler(e,t,n=ht.Default){return this._mappedHandlers[e].push([n,t]),this.sortHandlers(e),()=>this._mappedHandlers[e]=this._mappedHandlers[e].filter(([,r])=>r!==t)}hasHandlers(e){return(this._mappedHandlers[e]??[]).length>0}sortHandlers(e){this._mappedHandlers[e]=jl(this._mappedHandlers[e],([t],[n])=>n-t)}addCustomHandler(e,t){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[e]:t}))??b2}};Qu.defaultOptions={};Qu.staticKeys=[];Qu.handlerKeys=[];Qu.handlerKeyOptions={};Qu.customHandlerKeys=[];function Sre(e,t,n){const{[wre]:r}=e,o=e[n];return!r&&!o?!1:!!(o&&o.earlyReturnValue!==uN&&(Pt(o.earlyReturnValue)?o.earlyReturnValue(t)===!0:t===o.earlyReturnValue)||r&&r.earlyReturnValue!==uN&&(Pt(r.earlyReturnValue)?r.earlyReturnValue(t)===!0:t===r.earlyReturnValue))}var Oy=class extends Qu{constructor(...e){super(kre,...e),this["~E"]={},this._extensions=w2(this.createExtensions(),t=>t.constructor),this.extensionMap=new Map;for(const t of this._extensions)this.extensionMap.set(t.constructor,t)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${g2(this.name)}Extension`}get store(){return Pe(this._store,{code:re.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),rl(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(e,t){this.extensionMap.has(e)&&(this.extensionMap.set(e,t),this._extensions=this.extensions.map(n=>t.constructor===e?t:n))}createExtensions(){return[]}getExtension(e){const t=this.extensionMap.get(e);return Pe(t,{code:re.INVALID_GET_EXTENSION,message:`'${e.name}' does not exist within the preset: '${this.name}'`}),t}isOfType(e){return this.constructor===e}setStore(e){this._store||(this._store=e)}clone(...e){return new this.constructor(...e)}setPriority(e){this.priorityOverride=e}};Oy.defaultPriority=ht.Default;var Nt=class extends Oy{static get[as](){return mn.PlainExtensionConstructor}get[as](){return mn.PlainExtension}},mp=class extends Oy{static get[as](){return mn.MarkExtensionConstructor}get[as](){return mn.MarkExtension}get type(){return Rt(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};mp.disableExtraAttributes=!1;var go=class extends Oy{static get[as](){return mn.NodeExtensionConstructor}get[as](){return mn.NodeExtension}get type(){return Rt(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};go.disableExtraAttributes=!1;var kre={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function yL(e){return Xu(e)&&Zu(e,[mn.PlainExtension,mn.MarkExtension,mn.NodeExtension])}function Ere(e){return Xu(e)&&Zu(e,[mn.PlainExtensionConstructor,mn.MarkExtensionConstructor,mn.NodeExtensionConstructor])}function xL(e){return Xu(e)&&Zu(e,mn.PlainExtension)}function gp(e){return Xu(e)&&Zu(e,mn.NodeExtension)}function My(e){return Xu(e)&&Zu(e,mn.MarkExtension)}function ot(e){return t=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:o,staticKeys:i,defaultPriority:s,handlerKeyOptions:a,...l}=e,c=t;n&&(c.defaultOptions=n),s&&(c.defaultPriority=s),a&&(c.handlerKeyOptions=a),c.staticKeys=i??[],c.handlerKeys=o??[],c.customHandlerKeys=r??[];for(const[u,d]of Object.entries(l))c[u]||(c[u]=d);return c}}var Cre=class extends Nt{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=we(),this.updateAttributes=(e=!0)=>{this.transformAttributes(),e&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var e,t,n;if(this.attributeObject=we(),(e=this.store.managerSettings.exclude)!=null&&e.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}this.attributeList=[];for(const r of this.store.extensions){if((t=r.options.exclude)!=null&&t.attributes)continue;const o=(n=r.createAttributes)==null?void 0:n.call(r),i={...o,class:vw(...r.classNames??[],o==null?void 0:o.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:vw(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function zt(e={}){return(t,n,r)=>{(t.decoratedHelpers??(t.decoratedHelpers={}))[n]=e}}function ye(e={}){return(t,n,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[n]=e}}function qr(e){return(t,n,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[n]=e}}var _re=class{constructor(e){this.promiseCreator=e,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>t=>{let n=!0;const{view:r,tr:o,dispatch:i}=t;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...t,dispatch:()=>{}})){n=!1;break}return!i||!n?n:(this.promiseCreator(t).then(a=>{this.runHandlers(this.successHandlers,{value:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}).catch(a=>{this.runHandlers(this.failureHandlers,{error:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}),i(o),!0)}}validate(e,t="push"){return this.validateHandlers[t](e),this}success(e,t="push"){return this.successHandlers[t](e),this}failure(e,t="push"){return this.failureHandlers[t](e),this}runHandlers(e,t){var n;for(const r of e)if(!r({...t,dispatch:()=>{}}))break;(n=t.dispatch)==null||n.call(t,t.tr)}};function bh(e){const{type:t,attrs:n,range:r,selection:o}=e;return i=>{const{dispatch:s,tr:a,state:l}=i,c=De(t)?l.schema.marks[t]:t;if(Pe(c,{code:re.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||o){const{from:u,to:d}=uo(o??r??a.selection,a.doc);return Qg({trState:a,type:t,...r})?s==null||s(a.removeMark(u,d,c)):s==null||s(a.addMark(u,d,c.create(n))),!0}return bf(Xne(c,n))(i)}}function Pre(e,t,n){for(const{$from:r,$to:o}of n){let i=r.depth===0?t.type.allowsMarkType(e):!1;if(t.nodesBetween(r.pos,o.pos,s=>{if(i)return!1;i=s.inlineContent&&s.type.allowsMarkType(e)}),i)return!0}return!1}function Nre(e,t,n){return({tr:r,dispatch:o,state:i})=>{const s=uo(n??r.selection,r.doc),a=pne(s),l=De(e)?i.schema.marks[e]:e;if(Pe(l,{code:re.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),s.empty&&!a||!Pre(l,r.doc,s.ranges))return!1;if(!o)return!0;if(a)return r.removeStoredMark(l),t&&r.addStoredMark(l.create(t)),o(r),!0;let c=!1;for(const{$from:u,$to:d}of s.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,d.pos,l)}for(const{$from:u,$to:d}of s.ranges)c&&r.removeMark(u.pos,d.pos,l),t&&r.addMark(u.pos,d.pos,l.create(t));return o(r),!0}}function Tre(e,t={}){return({tr:n,dispatch:r,state:o})=>{const i=o.schema,s=n.selection,{from:a=s.from,to:l=a??s.to,marks:c={}}=t;if(!r)return!0;n.insertText(e,a,l);const u=Rt(n.steps,n.steps.length-1).getMap().map(l);for(const[d,h]of rn(c))n.addMark(a,u,Rt(i.marks,d).create(h));return r(n),!0}}var Ge=class extends Nt{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(e,...t)=>{const{forcedUpdates:n}=this.getCommandMeta(e);return this.setCommandMeta(e,{forcedUpdates:fh([...n,...t])}),e}}get name(){return"commands"}get transaction(){const e=this.store.getState();this._transaction||(this._transaction=e.tr);const t=this._transaction.before.eq(e.doc),n=!_a(this._transaction.steps);if(!t){const r=e.tr;if(n)for(const o of this._transaction.steps)r.step(o);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(e){var t;const{extensions:n,helpers:r}=this.store,o=we(),i=new Set;let s=we();const a=c=>{var u;const d=we(),h=()=>c??this.transaction;let p=[];const m=()=>p;for(const[x,b]of Object.entries(o))(u=s[x])!=null&&u.disableChaining||(d[x]=this.chainedFactory({chain:d,command:b.original,getTr:h,getChain:m}));const v=x=>{Pe(x===h(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return d.run=(x={})=>{const b=p;p=[];for(const w of b)if(!w(v)&&x.exitEarly)return;e.dispatch(h())},d.tr=()=>{const x=p;p=[];for(const b of x)b(v);return h()},d.enabled=()=>{for(const x of p)if(!x())return!1;return!0},d.new=x=>a(x),d};for(const c of n){const u=((t=c.createCommands)==null?void 0:t.call(c))??{},d=c.decoratedCommands??{},h={};s={...s,decoratedCommands:d};for(const[p,m]of Object.entries(d)){const v=De(m.shortcut)&&m.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(m.shortcut,c.options)}:void 0;this.updateDecorated(p,{...m,name:c.name,...v}),u[p]=c[p].bind(c),m.active&&(h[p]=()=>{var x;return((x=m.active)==null?void 0:x.call(m,c.options,this.store))??!1})}Dg(u)||this.addCommands({active:h,names:i,commands:o,extensionCommands:u})}const l=a();for(const[c,u]of Object.entries(l))a[c]=u;this.store.setStoreKey("commands",o),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",o),this.store.setExtensionStore("chain",a)}onStateUpdate({state:e}){this._transaction=e.tr}createPlugin(){return{}}customDispatch(e){return e}insertText(e,t={}){return De(e)?Tre(e,t):this.store.createPlaceholderCommand({promise:e,placeholder:{type:"inline"},onSuccess:(n,r,o)=>this.insertText(n,{...t,...r})(o)}).generateCommand()}selectText(e,t={}){return({tr:n,dispatch:r})=>{const o=uo(e,n.doc);return n.selection.anchor===o.anchor&&n.selection.head===o.head&&!t.forceUpdate?!1:(r==null||r(n.setSelection(o)),!0)}}selectMark(e){return t=>{const{tr:n}=t,r=ls(n.selection.$from,e);return r?this.store.commands.selectText.original({from:r.from,to:r.to})(t):!1}}delete(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=e??t.selection;return n==null||n(t.delete(r,o)),!0}}emptyUpdate(e){return({tr:t,dispatch:n})=>(n&&(e==null||e(),n(t)),!0)}forceUpdate(...e){return({tr:t,dispatch:n})=>(n==null||n(this.forceUpdateTransaction(t,...e)),!0)}updateNodeAttributes(e,t){return({tr:n,dispatch:r})=>(r==null||r(n.setNodeMarkup(e,void 0,t)),!0)}setContent(e,t){return n=>{const{tr:r,dispatch:o}=n,i=this.store.manager.createState({content:e,selection:t});return i?(o==null||o(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0):!1}}resetContent(){return e=>{const{tr:t,dispatch:n}=e,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(e):(n==null||n(t.delete(0,t.doc.nodeSize)),!0)}}emptySelection(){return({tr:e,dispatch:t})=>e.selection.empty?!1:(t==null||t(e.setSelection(Le.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>Kl(t.selection)?(e==null||e(t.insertText(`
|
|
482
|
+
`)),!0):!1}insertNode(e,t={}){return({dispatch:n,tr:r,state:o})=>{var i;const{attrs:s,range:a,selection:l,replaceEmptyParentBlock:c=!1}=t,{from:u,to:d,$from:h}=uo(l??a??r.selection,r.doc);if(Cy(e)||one(e)){const b=h.before(h.depth);return n==null||n(c&&u===d&&Tk(h.parent)?r.replaceWith(b,b+h.parent.nodeSize,e):r.replaceWith(u,d,e)),!0}const p=De(e)?o.schema.nodes[e]:e;Pe(p,{code:re.SCHEMA,message:`The requested node type ${e} does not exist in the schema.`});const m=(i=t.marks)==null?void 0:i.map(b=>{if(b instanceof tt)return b;const w=De(b)?o.schema.marks[b]:b;return Pe(w,{code:re.SCHEMA,message:`The requested mark type ${b} does not exist in the schema.`}),w.create()}),v=p.createAndFill(s,De(t.content)?o.schema.text(t.content):t.content,m);if(!v)return!1;const x=u!==d;return n==null||n(x?r.replaceRangeWith(u,d,v):r.insert(u,v)),!0}}focus(e){return t=>{const{dispatch:n,tr:r}=t,{view:o}=this.store;if(e===!1||o.hasFocus()&&(e===void 0||e===!0))return!1;if(e===void 0||e===!0){const{from:i=0,to:s=i}=r.selection;e={from:i,to:s}}return n&&this.delayedFocus(),this.selectText(e)(t)}}blur(e){return t=>{const{view:n}=this.store;return n.hasFocus()?(requestAnimationFrame(()=>{n.dom.blur()}),e?this.selectText(e)(t):!0):!1}}setBlockNodeType(e,t,n,r=!0){return ev(e,t,n,r)}toggleWrappingNode(e,t,n){return Nne(e,t,n)}toggleBlockNodeItem(e){return oL(e)}wrapInNode(e,t,n){return rL(e,t,n)}applyMark(e,t,n){return Nre(e,t,n)}toggleMark(e){return bh(e)}removeMark(e){return sL(e)}setMeta(e,t){return({tr:n})=>(n.setMeta(e,t),!0)}selectAll(){return this.selectText("all")}copy(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({promise:async()=>{var e;return(e=navigator.clipboard)!=null&&e.readText?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(e,t,n)=>this.insertNode(mw({content:e,schema:n.state.schema}),{selection:t})(n)}).generateCommand()}cut(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("cut"),!0)}replaceText(e){return Mne(e)}getAllCommandOptions(){const e={};for(const[t,n]of this.decorated)Dg(n)||(e[t]=n);return e}getCommandOptions(e){return this.decorated.get(e)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(e,t){if(!t){this.decorated.delete(e);return}const n=this.decorated.get(e)??{name:""};this.decorated.set(e,{...n,...t})}handleIosFocus(){Oo.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(e){return this.getCommandMeta(e).forcedUpdates}getCommandMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...Ore,...t}}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addCommands(e){const{extensionCommands:t,commands:n,names:r,active:o}=e;for(const[i,s]of rn(t))vL({name:i,set:r,code:re.DUPLICATE_COMMAND_NAMES}),Pe(!Mre.has(i),{code:re.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[i]=this.createUnchainedCommand(s,o[i])}unchainedFactory(e){return(...t)=>{const{shouldDispatch:n=!0,command:r}=e,{view:o}=this.store,{state:i}=o;let s;return n&&(s=o.dispatch),r(...t)({state:i,dispatch:s,view:o,tr:i.tr})}}createUnchainedCommand(e,t){const n=this.unchainedFactory({command:e});return n.enabled=this.unchainedFactory({command:e,shouldDispatch:!1}),n.isEnabled=n.enabled,n.original=e,n.active=t,n}chainedFactory(e){return(...t)=>{const{chain:n,command:r,getTr:o,getChain:i}=e,s=i(),{view:a}=this.store,{state:l}=a;return s.push(c=>r(...t)({state:l,dispatch:c,view:a,tr:o()})),n}}};me([ye()],Ge.prototype,"customDispatch",1);me([ye()],Ge.prototype,"insertText",1);me([ye()],Ge.prototype,"selectText",1);me([ye()],Ge.prototype,"selectMark",1);me([ye()],Ge.prototype,"delete",1);me([ye()],Ge.prototype,"emptyUpdate",1);me([ye()],Ge.prototype,"forceUpdate",1);me([ye()],Ge.prototype,"updateNodeAttributes",1);me([ye()],Ge.prototype,"setContent",1);me([ye()],Ge.prototype,"resetContent",1);me([ye()],Ge.prototype,"emptySelection",1);me([ye()],Ge.prototype,"insertNewLine",1);me([ye()],Ge.prototype,"insertNode",1);me([ye()],Ge.prototype,"focus",1);me([ye()],Ge.prototype,"blur",1);me([ye()],Ge.prototype,"setBlockNodeType",1);me([ye()],Ge.prototype,"toggleWrappingNode",1);me([ye()],Ge.prototype,"toggleBlockNodeItem",1);me([ye()],Ge.prototype,"wrapInNode",1);me([ye()],Ge.prototype,"applyMark",1);me([ye()],Ge.prototype,"toggleMark",1);me([ye()],Ge.prototype,"removeMark",1);me([ye()],Ge.prototype,"setMeta",1);me([ye({description:({t:e})=>e(Pa.SELECT_ALL_DESCRIPTION),label:({t:e})=>e(Pa.SELECT_ALL_LABEL),shortcut:oe.SelectAll})],Ge.prototype,"selectAll",1);me([ye({description:({t:e})=>e(Pa.COPY_DESCRIPTION),label:({t:e})=>e(Pa.COPY_LABEL),shortcut:oe.Copy,icon:"fileCopyLine"})],Ge.prototype,"copy",1);me([ye({description:({t:e})=>e(Pa.PASTE_DESCRIPTION),label:({t:e})=>e(Pa.PASTE_LABEL),shortcut:oe.Paste,icon:"clipboardLine"})],Ge.prototype,"paste",1);me([ye({description:({t:e})=>e(Pa.CUT_DESCRIPTION),label:({t:e})=>e(Pa.CUT_LABEL),shortcut:oe.Cut,icon:"scissorsFill"})],Ge.prototype,"cut",1);me([ye()],Ge.prototype,"replaceText",1);me([zt()],Ge.prototype,"getAllCommandOptions",1);me([zt()],Ge.prototype,"getCommandOptions",1);me([zt()],Ge.prototype,"getCommandProp",1);Ge=me([ot({defaultPriority:ht.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],Ge);var Ore={forcedUpdates:[]},Mre=new Set(["run","chain","original","raw","enabled","tr","new"]),Yo=class extends Nt{constructor(){super(...arguments),this.placeholders=it.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{const t=Fg(),{promise:n,placeholder:r,onFailure:o,onSuccess:i}=e;return new _re(n).validate(s=>this.addPlaceholder(t,r)(s)).success(s=>{const{state:a,tr:l,dispatch:c,view:u,value:d}=s,h=this.store.helpers.findPlaceholder(t);if(!h){const p=new Error("The placeholder has been removed");return(o==null?void 0:o({error:p,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(t)({state:a,tr:l,view:u,dispatch:()=>{}}),i(d,h,{state:a,tr:l,dispatch:c,view:u})}).failure(s=>(this.removePlaceholder(t)({...s,dispatch:()=>{}}),(o==null?void 0:o(s))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:e=>{var t,n,r,o,i,s;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(e);if(l){this.placeholders=it.empty;for(const[,d]of this.placeholderWidgets)(n=(t=d.spec).onDestroy)==null||n.call(t,this.store.view,d.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(e.mapping,e.doc,{onRemove:d=>{var h,p;const m=this.placeholderWidgets.get(d.id);m&&((p=(h=m.spec).onDestroy)==null||p.call(h,this.store.view,m.spec.element))}});for(const[,d]of this.placeholderWidgets)(o=(r=d.spec).onUpdate)==null||o.call(r,this.store.view,d.from,d.spec.element,d.spec.data);for(const d of a){if(d.type==="inline"){this.addInlinePlaceholder(d,e);continue}if(d.type==="node"){this.addNodePlaceholder(d,e);continue}if(d.type==="widget"){this.addWidgetPlaceholder(d,e);continue}}for(const{id:d,data:h}of u){const p=this.placeholderWidgets.get(d);if(!p)continue;const m=Ct.widget(p.from,p.spec.element,{...p.spec,data:h});this.placeholders=this.placeholders.remove([p]).add(e.doc,[m]),this.placeholderWidgets.set(d,m)}for(const d of c){const h=this.placeholders.find(void 0,void 0,m=>m.id===d&&m.__type===ac),p=this.placeholderWidgets.get(d);p&&((s=(i=p.spec).onDestroy)==null||s.call(i,this.store.view,p.spec.element)),this.placeholders=this.placeholders.remove(h),this.placeholderWidgets.delete(d)}}},props:{decorations:e=>{let t=this.options.decorations(e);t=t.add(e.doc,this.placeholders.find());for(const n of this.store.extensions){if(!n.createDecorations)continue;const r=n.createDecorations(e).find();t=t.add(e.doc,r)}return t},handleDOMEvents:{blur:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(dN,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(dN,!0)),!1)}}}}updateDecorations(){return({tr:e,dispatch:t})=>(t==null||t(e),!0)}addPlaceholder(e,t,n){return({dispatch:r,tr:o})=>this.addPlaceholderTransaction(e,t,o,!r)?(r==null||r(n?o.deleteSelection():o),!0):!1}updatePlaceholder(e,t){return({dispatch:n,tr:r})=>this.updatePlaceholderTransaction({id:e,data:t,tr:r,checkOnly:!n})?(n==null||n(r),!0):!1}removePlaceholder(e){return({dispatch:t,tr:n})=>this.removePlaceholderTransaction({id:e,tr:n,checkOnly:!t})?(t==null||t(n),!0):!1}clearPlaceholders(){return({tr:e,dispatch:t})=>this.clearPlaceholdersTransaction({tr:e,checkOnly:!t})?(t==null||t(e),!0):!1}findPlaceholder(e){return this.findAllPlaceholders().get(e)}findAllPlaceholders(){const e=new Map,t=this.placeholders.find(void 0,void 0,n=>n.__type===ac);for(const n of t)e.set(n.spec.id,{from:n.from,to:n.to});return e}createDecorations(e){var t,n,r;const{persistentSelectionClass:o}=this.options;return!o||(t=this.store.view)!=null&&t.hasFocus()||(r=(n=this.store.helpers).isInteracting)!=null&&r.call(n)?it.empty:Rre(e,it.empty,{class:De(o)?o:"selection"})}onApplyState(){}addWidgetPlaceholder(e,t){const{pos:n,createElement:r,onDestroy:o,onUpdate:i,className:s,nodeName:a,id:l,type:c}=e,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(s);const d=Ct.widget(n,u,{id:l,__type:ac,type:c,element:u,onDestroy:o,onUpdate:i});this.placeholderWidgets.set(l,d),this.placeholders=this.placeholders.add(t.doc,[d])}addInlinePlaceholder(e,t){const{from:n=t.selection.from,to:r=t.selection.to,className:o,nodeName:i,id:s,type:a}=e;let l;if(n===r){const c=document.createElement(i);c.classList.add(o),l=Ct.widget(n,c,{id:s,type:a,__type:ac,widget:c})}else l=Ct.inline(n,r,{nodeName:i,class:o},{id:s,__type:ac});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){const{pos:n,className:r,nodeName:o,id:i}=e,s=Br(n)?t.doc.resolve(n):t.selection.$from,a=Br(n)?s.nodeAfter?{pos:n,end:s.nodeAfter.nodeSize}:void 0:qte(s);if(!a)return;const l=Ct.node(a.pos,a.end,{nodeName:o,class:r},{id:i,__type:ac});this.placeholders=this.placeholders.add(t.doc,[l])}withRequiredBase(e,t){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:o=n,className:i,...s}=t,a=(i?[r,i]:[r]).join(" ");return{nodeName:o,className:a,...s,id:e}}getMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...jre,...t}}setMeta(e,t){const n=this.getMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addPlaceholderTransaction(e,t,n,r=!1){if(this.findPlaceholder(e))return!1;if(r)return!0;const{added:i}=this.getMeta(n);return this.setMeta(n,{added:[...i,this.withRequiredBase(e,t)]}),!0}updatePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1,data:o}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{updated:s}=this.getMeta(n);return this.setMeta(n,{updated:fh([...s,{id:t,data:o}])}),!0}removePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{removed:i}=this.getMeta(n);return this.setMeta(n,{removed:fh([...i,t])}),!0}clearPlaceholdersTransaction(e){const{tr:t,checkOnly:n=!1}=e;return this.getPluginState()===it.empty?!1:(n||this.setMeta(t,{clearTrackers:!0}),!0)}};me([ye()],Yo.prototype,"updateDecorations",1);me([ye()],Yo.prototype,"addPlaceholder",1);me([ye()],Yo.prototype,"updatePlaceholder",1);me([ye()],Yo.prototype,"removePlaceholder",1);me([ye()],Yo.prototype,"clearPlaceholders",1);me([zt()],Yo.prototype,"findPlaceholder",1);me([zt()],Yo.prototype,"findAllPlaceholders",1);Yo=me([ot({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(e,t,n)=>e.add(n.doc,t.find()),getDefault:()=>it.empty}}},defaultPriority:ht.Low})],Yo);var jre={added:[],updated:[],clearTrackers:!1,removed:[]},ac="placeholderDecoration",dN="persistentSelectionFocus";function Rre(e,t,n){const{selection:r,doc:o}=e;if(r.empty)return t;const{from:i,to:s}=r,a=_y(r)?Ct.node(i,s,n):Ct.inline(i,s,n);return t.add(o,[a])}var yw=class extends Nt{get name(){return"docChanged"}onStateUpdate(e){const{firstUpdate:t,transactions:n,tr:r}=e;t||(n??[r]).some(o=>o==null?void 0:o.docChanged)&&this.options.docChanged(e)}};yw=me([ot({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:ht.Lowest})],yw);var fo=class extends Nt{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",mw);const t=we(),n=we(),r=we(),o=new Set;for(const i of this.store.extensions){gp(i)&&(n[i.name]=a=>Xte({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=xh({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),My(i)&&(n[i.name]=a=>Qg({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=ls(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(_k(l.mark,a))return l.mark.attrs});const s=((e=i.createHelpers)==null?void 0:e.call(i))??{};for(const a of Object.keys(i.decoratedHelpers??{}))s[a]=i[a].bind(i);if(!Dg(s))for(const[a,l]of rn(s))vL({name:a,set:o,code:re.DUPLICATE_HELPER_NAMES}),t[a]=l}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",n),this.store.setStoreKey("helpers",t),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",n),this.store.setExtensionStore("helpers",t)}isSelectionEmpty(e=this.store.getState()){return Ck(e)}isViewEditable(e=this.store.getState()){var t,n;return((n=(t=this.store.view.props).editable)==null?void 0:n.call(t,e))??!1}getStateJSON(e=this.store.getState()){return e.toJSON()}getJSON(e=this.store.getState()){return e.doc.toJSON()}getRemirrorJSON(e=this.store.getState()){return this.getJSON(e)}insertHtml(e,t){return n=>{const{state:r}=n,o=mw({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(o,t)(n)}}getText({lineBreakDivider:e=`
|
|
483
483
|
|
|
484
484
|
`,state:t=this.store.getState()}={}){return t.doc.textBetween(0,t.doc.content.size,e,Js)}getTextBetween(e,t,n=this.store.getState().doc){return n.textBetween(e,t,`
|
|
485
485
|
|
|
486
|
-
`,Js)}getHTML(e=this.store.getState()){return Sne(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};me([zt()],fo.prototype,"isSelectionEmpty",1);me([zt()],fo.prototype,"isViewEditable",1);me([zt()],fo.prototype,"getStateJSON",1);me([zt()],fo.prototype,"getJSON",1);me([zt()],fo.prototype,"getRemirrorJSON",1);me([ye()],fo.prototype,"insertHtml",1);me([zt()],fo.prototype,"getText",1);me([zt()],fo.prototype,"getTextBetween",1);me([zt()],fo.prototype,"getHTML",1);fo=me([ot({})],fo);var xw=class extends Nt{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var e,t;const n=[],r=this.store.markTags[He.ExcludeInputRules];for(const o of this.store.extensions)if(!((e=this.store.managerSettings.exclude)!=null&&e.inputRules||!o.createInputRules||(t=o.options.exclude)!=null&&t.inputRules))for(const i of o.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return LQ({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};xw=me([ot({defaultPriority:ht.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],xw);var Mo=class extends Nt{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:e})=>{var t,n;if(e)return this.extraKeyBindings=[...this.extraKeyBindings,e],(n=(t=this.store).rebuildKeymap)==null||n.call(t),()=>{var r,o;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==e),(o=(r=this.store).rebuildKeymap)==null||o.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:e}=this.options;return Ae(e)?Lre[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new fs({props:{handleKeyDown:(t,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,t,n)}}})])}setupKeydownHandler(){const e=this.generateKeymapBindings();this.keydownHandler=mL(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension(Ge),o=a=>l=>km({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((e=a.options.exclude)!=null&&e.keymap)){a.createKeymap&&t.push(Are(a.createKeymap(o(a)),n));for(const[c,u]of rn(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),h=km({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),p=Pt(u.priority)?u.priority(a.options,this.store):u.priority??ht.Low,m=we();for(const v of h)m[v]=d;t.push([p,m]),u.command&&r.updateDecorated(u.command,{shortcut:h})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...t]);return Qte(i)}arrowRightShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return Zg(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return Zg(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=we();if(!n)for(const[o,i]of rn(c0))r[o]=bf(i);return t&&c0.Backspace&&(r.Backspace=bf(Ty(FQ,c0.Backspace))),e&&(r.Escape=bf(Wne)),[ht.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?km({shortcut:e,map:this.shortcutMap,store:this.store,options:t}):[e]}onSetOptions(e){var t,n;const{changes:r}=e;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(t=this.store).rebuildKeymap)==null||n.call(t))}sortKeymaps(e){return jl(e.map(t=>on(t)?t:[ht.Default,t]),(t,n)=>n[0]-t[0]).map(t=>t[1])}exitMarkForwards(e,t){return n=>{const{tr:r,dispatch:o}=n;if(!Cne(r.selection)||yh({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(_a(a))return!1;if(!o)return!0;for(const l of a)r.removeStoredMark(l);return o(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(e,t=!1){return n=>{const{tr:r}=n;if(!(t?aN:gw)(r.selection))return!1;const i=r.selection.$anchor.node();return!Tk(i)||cne(i)||e.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(e,t,n=!1){return r=>{const{tr:o,dispatch:i}=r;if(!(n?aN:gw)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(yh({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(_a(l))return!1;if(!i)return!0;for(const c of l)o.removeStoredMark(c);return this.backwardMarkExitTracker.set(o.selection.anchor,!0),i(o),!0}}};me([qr({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],Mo.prototype,"arrowRightShortcut",1);me([qr({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],Mo.prototype,"arrowLeftShortcut",1);me([qr({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],Mo.prototype,"backspace",1);me([zt()],Mo.prototype,"getNamedShortcut",1);Mo=me([ot({defaultPriority:ht.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],Mo);function Ire(e){return Go(vy(oe),e)}function km({shortcut:e,map:t,options:n,store:r}){return Ae(e)?[bw(e,t)]:on(e)?e.map(o=>bw(o,t)):(e=e(n,r),km({shortcut:e,map:t,options:n,store:r}))}function bw(e,t){return Ire(e)?t[e]:e}function Are(e,t){const n={};let r,o;on(e)?[o,r]=e:r=e;for(const[i,s]of rn(r))n[bw(i,t)]=s;return yy(o)?n:[o,n]}var bL={[oe.Copy]:"Mod-c",[oe.Cut]:"Mod-x",[oe.Paste]:"Mod-v",[oe.PastePlain]:"Mod-Shift-v",[oe.SelectAll]:"Mod-a",[oe.Undo]:"Mod-z",[oe.Redo]:Oo.isMac?"Shift-Mod-z":"Mod-y",[oe.Bold]:"Mod-b",[oe.Italic]:"Mod-i",[oe.Underline]:"Mod-u",[oe.Strike]:"Mod-d",[oe.Code]:"Mod-`",[oe.Paragraph]:"Mod-Shift-0",[oe.H1]:"Mod-Shift-1",[oe.H2]:"Mod-Shift-2",[oe.H3]:"Mod-Shift-3",[oe.H4]:"Mod-Shift-4",[oe.H5]:"Mod-Shift-5",[oe.H6]:"Mod-Shift-6",[oe.TaskList]:"Mod-Shift-7",[oe.BulletList]:"Mod-Shift-8",[oe.OrderedList]:"Mod-Shift-9",[oe.Quote]:"Mod->",[oe.Divider]:"Mod-Shift-|",[oe.Codeblock]:"Mod-Shift-~",[oe.ClearFormatting]:"Mod-Shift-C",[oe.Superscript]:"Mod-.",[oe.Subscript]:"Mod-,",[oe.LeftAlignment]:"Mod-Shift-L",[oe.CenterAlignment]:"Mod-Shift-E",[oe.RightAlignment]:"Mod-Shift-R",[oe.JustifyAlignment]:"Mod-Shift-J",[oe.InsertLink]:"Mod-k",[oe.Find]:"Mod-f",[oe.FindBackwards]:"Mod-Shift-f",[oe.FindReplace]:"Mod-Shift-H",[oe.AddFootnote]:"Mod-Alt-f",[oe.AddComment]:"Mod-Alt-m",[oe.ContextMenu]:"Mod-Shift-\\",[oe.IncreaseFontSize]:"Mod-Shift-.",[oe.DecreaseFontSize]:"Mod-Shift-,",[oe.IncreaseIndent]:"Tab",[oe.DecreaseIndent]:"Shift-Tab",[oe.Shortcuts]:"Mod-/",[oe.Format]:Oo.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},Dre={...bL,[oe.Strike]:"Mod-Shift-S",[oe.Code]:"Mod-Shift-M",[oe.Paragraph]:"Mod-Alt-0",[oe.H1]:"Mod-Alt-1",[oe.H2]:"Mod-Alt-2",[oe.H3]:"Mod-Alt-3",[oe.H4]:"Mod-Alt-4",[oe.H5]:"Mod-Alt-5",[oe.H6]:"Mod-Alt-6",[oe.OrderedList]:"Mod-Alt-7",[oe.BulletList]:"Mod-Alt-8",[oe.Quote]:"Mod-Alt-9",[oe.ClearFormatting]:"Mod-\\",[oe.IncreaseIndent]:"Mod-[",[oe.DecreaseIndent]:"Mod-]"},Lre={default:bL,googleDoc:Dre},Fre=class extends Nt{get name(){return"nodeViews"}createPlugin(){const e=[],t=we();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(Pt(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},zre=class extends Nt{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.pasteRules||!r.createPasteRules||(t=r.options.exclude)!=null&&t.pasteRules)continue;const o=r.createPasteRules(),i=on(o)?o:[o];n.push(...i)}return ire(n)}},ww=class extends Nt{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=we(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return Pe(t,{message:"No plugin exists for the requested extension name."}),t()}}get name(){return"plugins"}onCreate(){const{setStoreKey:e,setExtensionStore:t,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:o=[]}=n;this.updatePlugins(o,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=o,this.store.setStoreKey("plugins",this.plugins),e("pluginKeys",this.pluginKeys),e("getPluginState",this.getStateByName),t("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr,o={previousState:t,tr:r,transactions:e,state:n};for(const i of this.appendTransactionHandlers)i(o);return this.options.appendTransaction(o),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(e,t)=>{for(const n of this.initStateHandlers)n(t)},apply:(e,t,n,r)=>{const o={previousState:n,state:r,tr:e};for(const i of this.applyStateHandlers)i(o);this.options.applyState(o)}}}}extractExtensionPlugins(e){var t,n;if(!(!e.createPlugin&&!e.createExternalPlugins||(t=this.store.managerSettings.exclude)!=null&&t.plugins||(n=e.options.exclude)!=null&&n.plugins)){if(e.createPlugin){const o=new Ju(e.name);this.pluginKeys[e.name]=o;const i=this.getPluginStateCreator(o);e.pluginKey=o,e.getPluginState=i,this.stateGetters.set(e.name,i),this.stateGetters.set(e.constructor,i);const s={...e.createPlugin(),key:o},a=new fs(s);this.updatePlugins([a],e.plugin?[e.plugin]:void 0),e.plugin=a}if(e.createExternalPlugins){const o=e.createExternalPlugins();this.updatePlugins(o,e.externalPlugins),e.externalPlugins=o}}}updatePlugins(e,t){if(!t||_a(t)){this.plugins=[...this.plugins,...e];return}if(e.length!==t.length){this.plugins=[...this.plugins.filter(r=>!t.includes(r)),...e];return}const n=new Map;for(const[r,o]of e.entries())n.set(Rt(t,r),o);this.plugins=this.plugins.map(r=>t.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:e}=this.store;e("updatePlugins",this.updatePlugins.bind(this)),e("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),e("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(e){const t=yL(e)?e:Ere(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);Pe(t,{code:re.INVALID_MANAGER_EXTENSION,message:`The extension ${e} does not exist within the editor.`}),this.extractExtensionPlugins(t),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){Pe(this.store.phase>=ir.EditorView,{code:re.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:e,updateState:t}=this.store,n=e.state.reconfigure({plugins:this.plugins});t(n)}};ww=me([ot({defaultPriority:ht.Highest,handlerKeys:["applyState","appendTransaction"]})],ww);var Sw=class extends Nt{constructor(){super(...arguments),this.dynamicAttributes={marks:we(),nodes:we()}}get name(){return"schema"}onCreate(){const{managerSettings:e,tags:t,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:i,disableExtraAttributes:s,nodeOverride:a,markOverride:l}=e,c=m=>!!(m&&t[He.Block].includes(m));if(e.schema){const{nodes:m,marks:v}=Gre(e.schema);this.addSchema(e.schema,m,v);return}const u=c(i)?{doc:we(),[i]:we()}:we(),d=we(),h=$re({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const m of o){h[m.name]={...h[m.name],...m.options.extraAttributes};const v=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(gp(m)){const{spec:x,dynamic:b}=fN({createExtensionSpec:(w,S)=>m.createNodeSpec(w,S),extraAttributes:Rt(h,m.name),override:{...a,...m.options.nodeOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags});m.spec=x,u[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.nodes[m.name]=b)}if(My(m)){const{spec:x,dynamic:b}=fN({createExtensionSpec:(w,S)=>m.createMarkSpec(w,S),extraAttributes:Rt(h,m.name),override:{...l,...m.options.markOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags??[]});m.spec=x,d[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.marks[m.name]=b)}}const p=new PZ({nodes:u,marks:d,topNode:"doc"});this.addSchema(p,u,d)}createPlugin(){return{appendTransaction:(e,t,n)=>{const{tr:r}=n;return!e.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,s)=>(this.checkAndUpdateDynamicNodes(i,s,r),this.checkAndUpdateDynamicMarks(i,s,r),!0)),r.steps.length>0?r:null)}}}addSchema(e,t,n){this.store.setStoreKey("nodes",t),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",e),this.store.setExtensionStore("schema",e),this.store.setStoreKey("defaultBlockNode",Py(e).name);for(const r of Object.values(e.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(e,t,n){for(const[r,o]of rn(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[i,s]of rn(o)){if(!Ca(e.attrs[i]))continue;const a={...e.attrs,[i]:s(e)};n.setNodeMarkup(t,void 0,a),rN(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of rn(this.dynamicAttributes.marks)){const i=Rt(this.store.schema.marks,r),s=e.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of rn(o)){if(!Ca(s.attrs[a]))continue;const c=ls(n.doc.resolve(t),i);if(!c)continue;const{from:u,to:d}=c,h=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,d,i).addMark(u,d,h),rN(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};Sw=me([ot({defaultPriority:ht.Highest})],Sw);function $re(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=e,s=we();if(t.disableExtraAttributes)return s;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=Vre({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:i});for(const u of c){const d=s[u]??{};s[u]={...d,...l.attributes}}}return s}function Bre(e){return Wl(e)&&on(e.tags)}function Vre(e){const{identifiers:t,nodeNames:n,markNames:r,tags:o}=e;if(t==="nodes")return n;if(t==="marks")return r;if(t==="all")return[...n,...r];if(on(t))return t;Pe(Bre(t),{code:re.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:s=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=t,d=new Set,h=u==="mark"?r:u==="node"?n:[...r,...n],p=v=>h.includes(v)&&!(l!=null&&l.includes(v));for(const v of s)p(v)&&d.add(v);const m=new Map;for(const v of i)if(!(c!=null&&c.includes(v)))for(const x of o[v]){if(!p(x))continue;if(a==="any"){d.add(x);continue}const b=m.get(x)??new Set;b.add(v),m.set(x,b)}for(const[v,x]of m)x.size===i.length&&d.add(v);return[...d]}function fN(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=e,l=we();function c(x,b){l[x]=b}let u=!1;function d(){u=!0}const h=Ure(r,o,d,c),p=Hre(r,o),m=Wre(r,o),v=n({defaults:h,parse:p,dom:m},a);return Pe(o||u,{code:re.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),v.group=[...((t=v.group)==null?void 0:t.split(" "))??[],...s].join(" ")||void 0,{spec:v,dynamic:l}}function Mk(e){return Ae(e)||Pt(e)?{default:e}:(Pe(e,{message:`${y2(e)} is not supported`,code:re.EXTENSION_EXTRA_ATTRIBUTES}),e)}function Ure(e,t,n,r){return()=>{n();const o=we();if(t)return o;for(const[i,s]of rn(e)){let l=Mk(s).default;Pt(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function Hre(e,t){return n=>{const r=we();if(t)return r;for(const[o,i]of rn(e)){const{parseDOM:s,...a}=Mk(i);if(yi(n)){if(Ca(s)){r[o]=n.getAttribute(o)??a.default;continue}if(Pt(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function Wre(e,t){return n=>{const r=we();if(t)return r;function o(i,s){if(i){if(Ae(i)){r[s]=i;return}if(on(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of rn(i))r[a]=l}}for(const[i,s]of rn(e)){const{toDOM:a,parseDOM:l}=Mk(s);if(Ca(a)){const c=Ae(l)?l:i;r[c]=n.attrs[i];continue}if(Pt(a)){o(a(n.attrs,Kre(n)),i);continue}o(a,i)}return r}}function Kre(e){return Cy(e)?{node:e}:ine(e)?{mark:e}:{}}function Gre(e){const t=we(),n=we();for(const[r,o]of Object.entries(e.nodes))t[r]=o.spec;for(const[r,o]of Object.entries(e.marks))n[r]=o.spec;return{nodes:t,marks:n}}var Cu=class extends Nt{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return nN(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>nN(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>Hte(this.store.getState(),e))}createExternalPlugins(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.suggesters)break;if(!r.createSuggesters||(t=r.options.exclude)!=null&&t.suggesters)continue;const o=r.createSuggesters(),i=on(o)?o:[o];n.push(...i)}return[Wte(...n)]}getSuggestState(e){return Sk(e??this.store.getState())}getSuggestMethods(){const{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return Go(on(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};me([zt()],Cu.prototype,"getSuggestState",1);me([zt()],Cu.prototype,"getSuggestMethods",1);me([zt()],Cu.prototype,"isSuggesterActive",1);Cu=me([ot({customHandlerKeys:["suggester"]})],Cu);var kw=class extends Nt{constructor(){super(...arguments),this.allTags=we(),this.plainTags=we(),this.markTags=we(),this.nodeTags=we()}get name(){return"tags"}onCreate(){this.resetTags();for(const e of this.store.extensions)this.updateTagForExtension(e);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const e=we(),t=we(),n=we(),r=we();for(const o of vy(He))e[o]=[],t[o]=[],n[o]=[],r[o]=[];this.allTags=e,this.plainTags=t,this.markTags=n,this.nodeTags=r}updateTagForExtension(e){var t,n;const r=new Set([...e.tags??[],...((t=e.createTags)==null?void 0:t.call(e))??[],...e.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[e.name])??[]]);for(const o of r)Pe(qre(o),{code:re.EXTENSION,message:`The tag provided by the extension: ${e.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[o].push(e.name),xL(e)&&this.plainTags[o].push(e.name),My(e)&&this.markTags[o].push(e.name),gp(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};kw=me([ot({defaultPriority:ht.Highest})],kw);function qre(e){return Go(vy(He),e)}var Yre=new Ju("remirrorFilePlaceholderPlugin");function Jre(){const e=new fs({key:Yre,state:{init(){return{set:it.empty,payloads:new Map}},apply(t,{set:n,payloads:r}){n=n.map(t.mapping,t.doc);const o=t.getMeta(e);if(o)if(o.type===0){const i=document.createElement("placeholder"),s=Ct.widget(o.pos,i,{id:o.id});n=n.add(t.doc,[s]),r.set(o.id,o.payload)}else o.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===o.id)),r.delete(o.id));return{set:n,payloads:r}}},props:{decorations(t){var n;return((n=e.getState(t))==null?void 0:n.set)??null}}});return e}var Xre=class extends Nt{get name(){return"upload"}createExternalPlugins(){return[Jre()]}};function Zre(e={}){e={...{exitMarksOnArrowPress:Mo.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:Mo.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:Mo.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:Mo.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:Yo.defaultOptions.persistentSelectionClass},...e};const n=Yb(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=Yb(e,["persistentSelectionClass"]);return[new kw,new Sw,new Cre,new ww,new xw,new zre,new Fre,new Cu,new Ge,new fo,new Mo(n),new yw,new Xre,new Yo(r)]}var hN=class extends Nt{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const e of this.store.extensions)this.captureCommands(e),this.captureKeybindings(e)}createPlugin(){return{}}captureCommands(e){const t=e.decoratedCommands??{},n=e.createCommands;for(const r of Object.keys(t)){const o=e[r];e[r]=(...i)=>s=>{var a;const l=o(...i)(s);return s.dispatch&&l&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==((a=s.view)==null?void 0:a.dispatch),name:r,extension:e.name,decorated:!0}),l}}n&&(e.createCommands=()=>{const r=n();for(const[o,i]of Object.entries(r))r[o]=(...s)=>a=>{var l;const c=i(...s)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:o,extension:e.name,decorated:!1}),c};return r})}captureKeybindings(e){}getCommandMeta(e){return e.getMeta(this.pluginKey)??[]}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,[...n,t])}};hN=me([ot({defaultOptions:{capture:Oo.isDevelopment},staticKeys:["capture"],defaultPriority:ht.Highest})],hN);var Em,Ad,Cm,mc,Ms,_m,Pm,Qre=class{constructor(e){qt(this,Em,Fg()),qt(this,Ad,void 0),qt(this,Cm,void 0),qt(this,mc,!0),qt(this,Ms,gy()),qt(this,_m,void 0),qt(this,Pm,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;Pe(!this.manager.destroyed,{code:re.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(s=this.props).onDispatchTransaction)==null?void 0:a.call(s,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);cn(this,Cm,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);_a(d)||this.updateViewProps(...d)},this.onChange=(i=we())=>{var s,a;const l=this.eventListenerProps(i);le(this,mc)&&cn(this,mc,!1),(a=(s=this.props).onChange)==null||a.call(s,l)},this.onBlur=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onBlur)==null||a.call(s,l,i),le(this,Ms).emit("blur",l,i)},this.onFocus=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onFocus)==null||a.call(s,l,i),le(this,Ms).emit("focus",l,i)},this.setContent=(i,{triggerChange:s=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(s)return this.updateState({state:c,triggerChange:s});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,s)=>this.manager.createState({content:i,selection:s}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:t,initialEditorState:n,element:r}=e;if(cn(this,Ad,t),cn(this,Pm,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const o=this.createView(n,r);this.manager.addView(o)}get addHandler(){return le(this,_m)??cn(this,_m,le(this,Ms).on.bind(le(this,Ms)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return le(this,mc)}get props(){return le(this,Ad).call(this)}get previousState(){return this.previousStateOverride??le(this,Cm)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return le(this,Em)}get initialEditorState(){return le(this,Pm)}updateListener(e){const{state:t,tr:n}=e;return le(this,Ms).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return cn(this,Ad,t),this}updateViewProps(...e){const t=Yb(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;const{attributes:n,autoFocus:r,classNames:o=[],label:i,editable:s}=this.props,a=(t=this.manager.store)==null?void 0:t.attributes,l=Pt(n)?n(this.eventListenerProps()):n;let c={};(r||Br(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=fh(vw(e&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...s??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return eZ({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){le(this,Ms).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=we()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:le(this,mc),state:t??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:le(this,Em),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Em=new WeakMap;Ad=new WeakMap;Cm=new WeakMap;mc=new WeakMap;Ms=new WeakMap;_m=new WeakMap;Pm=new WeakMap;function eoe(e,t){const n=[],r=new WeakMap,o=[],i=new WeakMap;let s=[];const a={duplicateMap:i,parentExtensions:o,gatheredExtensions:s,settings:t};for(const d of e)wL(a,{extension:d});s=jl(s,(d,h)=>h.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of s){const h=d.constructor,p=d.name,m=i.get(h);Pe(m,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:re.INTERNAL}),!(l.has(h)||c.has(p))&&(l.add(h),c.add(p),n.push(d),r.set(h,d),m.forEach(v=>v==null?void 0:v.replaceChildExtension(h,d)))}const u=[];for(const d of n)toe({extension:d,found:l,missing:u});return Pe(_a(u),{code:re.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:h})=>`The extension '${h.name}' requires '${d.name} in order to run correctly.`).join(`
|
|
487
|
-
`)}),{extensions:n,extensionMap:r}}function wL(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;Pe(yL(a),{code:re.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=s.priority)==null?void 0:n[a.name]),r.push(a),noe({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)wL(e,{names:c,extension:d,parentExtension:a})}}function toe(e){const{extension:t,found:n,missing:r}=e;if(t.requiredExtensions)for(const o of t.requiredExtensions??[])n.has(o)||r.push({Constructor:o,extension:t})}function noe(e){const{duplicateMap:t,extension:n,parentExtension:r}=e,o=n.constructor,i=t.get(o),s=r?[r]:[];t.set(o,i?[...i,...s]:s)}function roe(e){var t,n,r,o;const{extension:i,nodeNames:s,markNames:a,plainNames:l,store:c,handlers:u}=e;i.setStore(c);const d=(t=i.onCreate)==null?void 0:t.bind(i),h=(n=i.onView)==null?void 0:n.bind(i),p=(r=i.onStateUpdate)==null?void 0:r.bind(i),m=(o=i.onDestroy)==null?void 0:o.bind(i);d&&u.create.push(d),h&&u.view.push(h),p&&u.update.push(p),m&&u.destroy.push(m),My(i)&&a.push(i.name),gp(i)&&i.name!=="doc"&&s.push(i.name),xL(i)&&l.push(i.name)}var js,Dd,wo,Oi,Ld,Er,Ya,Fd,Ja,zd,Xa,So,$d,Nm=class{constructor(e,t={}){qt(this,js,void 0),qt(this,Dd,we()),qt(this,wo,we()),qt(this,Oi,void 0),qt(this,Ld,void 0),qt(this,Er,ir.None),qt(this,Ya,void 0),qt(this,Fd,!0),qt(this,Ja,{create:[],view:[],update:[],destroy:[]}),qt(this,zd,[]),qt(this,Xa,gy()),qt(this,So,void 0),qt(this,$d,void 0),this.getState=()=>{var o;return le(this,Er)>=ir.EditorView?this.view.state:(Pe(le(this,So),{code:re.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(o=le(this,So))==null?void 0:o.initialEditorState)},this.updateState=o=>{const i=this.getState();this.view.updateState(o),this.onStateUpdate({previousState:i,state:o})};const{extensions:n,extensionMap:r}=eoe(e,t);cn(this,Ya,t),cn(this,Oi,rl(n)),cn(this,Ld,r),cn(this,js,this.createExtensionStore()),cn(this,Er,ir.Create),this.setupLifecycleHandlers();for(const o of le(this,Ja).create){const i=o();i&&le(this,zd).push(i)}}static create(e,t={}){return new Nm([...k2(e),...Zre(t.builtin)],t)}get[as](){return mn.Manager}get destroyed(){return le(this,Er)===ir.Destroy}get mounted(){return le(this,Er)>=ir.EditorView&&le(this,Er)<ir.Destroy}get output(){var e;return(e=le(this,So))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!le(this,So)}get extensions(){return le(this,Oi)}get stringHandlers(){return le(this,Dd)}get store(){return rl(le(this,wo))}get extensionStore(){return rl(le(this,js))}get tr(){return this.getExtension(Ge).transaction}get nodes(){return le(this,wo).nodes}get marks(){return le(this,wo).marks}get schema(){return le(this,wo).schema}get extensionTags(){return le(this,wo).tags}get view(){return le(this,wo).view}get settings(){return le(this,Ya)}get document(){return le(this,Ya).document??Ny()}setupLifecycleHandlers(){const e=le(this,js),t=le(this,Ja),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const i of le(this,Oi))roe({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){le(this,Dd)[e]=t}setStoreKey(e,t){le(this,wo)[e]=t}getStoreKey(e){const t=le(this,wo)[e];return Pe(!Ca(t),{code:re.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){Pe(le(this,Er)<=ir.EditorView,{code:re.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),le(this,js)[e]=t}createExtensionStore(){const e=we(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>le(this,Oi),enumerable:t},phase:{get:()=>le(this,Er),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>rl(le(this,Ya)),enumerable:t},getState:{value:this.getState,enumerable:t},updateState:{value:this.updateState,enumerable:t},isMounted:{value:()=>this.mounted,enumerable:t},getExtension:{value:this.getExtension.bind(this),enumerable:t},manager:{get:()=>this,enumerable:t},document:{get:()=>this.document,enumerable:t},stringHandlers:{get:()=>le(this,Dd),enumerable:t},currentState:{get:()=>n??(n=this.getState()),set:o=>{n=o},enumerable:t},previousState:{get:()=>r,set:o=>{r=o},enumerable:t}}),e.getStoreKey=this.getStoreKey.bind(this),e.setStoreKey=this.setStoreKey.bind(this),e.setExtensionStore=this.setExtensionStore.bind(this),e.setStringHandler=this.setStringHandler.bind(this),e}addView(e){if(le(this,Er)>=ir.EditorView)return this;cn(this,Fd,!0),cn(this,Er,ir.EditorView),le(this,wo).view=e;for(const t of le(this,Ja).view){const n=t(e);n&&le(this,zd).push(n)}return this}attachFramework(e,t){var n;le(this,So)!==e&&(le(this,So)&&(le(this,So).destroy(),(n=le(this,$d))==null||n.call(this)),cn(this,So,e),cn(this,$d,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return Pe(t,{code:re.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),t}createState(e={}){const{onError:t,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:o=n,stringHandler:i=this.settings.stringHandler}=e,{schema:s,plugins:a}=this.store,l=QD({stringHandler:Ae(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:s,selection:o});return ol.create({schema:s,doc:l,plugins:a,selection:uo(o,l)})}addHandler(e,t){return le(this,Xa).on(e,t)}onStateUpdate(e){const t=le(this,Fd);le(this,js).currentState=e.state,le(this,js).previousState=e.previousState,t&&(cn(this,Er,ir.Runtime),cn(this,Fd,!1));const n={...e,firstUpdate:t};for(const r of le(this,Ja).update)r(n);le(this,Xa).emit("stateUpdate",n)}getExtension(e){const t=le(this,Ld).get(e);return Pe(t,{code:re.INVALID_MANAGER_EXTENSION,message:`'${e.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),t}hasExtension(e){return!!le(this,Ld).get(e)}clone(){const e=le(this,Oi).map(n=>n.clone(n.options)),t=Nm.create(()=>e,le(this,Ya));return le(this,Xa).emit("clone",t),t}recreate(e=[],t={}){const n=le(this,Oi).map(o=>o.clone(o.initialOptions)),r=Nm.create(()=>[...n,...e],t);return le(this,Xa).emit("recreate",r),r}destroy(){var e,t,n,r,o,i;cn(this,Er,ir.Destroy);for(const s of((e=this.view)==null?void 0:e.state.plugins)??[])(n=(t=s.getState(this.view.state))==null?void 0:t.destroy)==null||n.call(t);(r=le(this,So))==null||r.destroy(),(o=le(this,$d))==null||o.call(this);for(const s of le(this,zd))s();for(const s of le(this,Ja).destroy)s();(i=this.view)==null||i.destroy(),le(this,Xa).emit("destroy")}includes(e){const t=[],n=[];for(const r of le(this,Oi))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>Ae(r)?Go(t,r):Go(n,r))}},ooe=Nm;js=new WeakMap;Dd=new WeakMap;wo=new WeakMap;Oi=new WeakMap;Ld=new WeakMap;Er=new WeakMap;Ya=new WeakMap;Fd=new WeakMap;Ja=new WeakMap;zd=new WeakMap;Xa=new WeakMap;So=new WeakMap;$d=new WeakMap;function ioe(e,t){return!(!Xu(e)||!Zu(e,mn.Manager))}var soe=Object.defineProperty,aoe=Object.getOwnPropertyDescriptor,loe=(e,t,n,r)=>{for(var o=r>1?void 0:r?aoe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&soe(t,n,o),o},SL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},xe=(e,t,n)=>(SL(e,t,"read from private field"),n?n.call(e):t.get(e)),Cr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},kr=(e,t,n,r)=>(SL(e,t,"write to private field"),t.set(e,n),n),Bd,coe=class{constructor(){this.portals=new Map,Cr(this,Bd,gy()),this.on=e=>xe(this,Bd).on("update",e),this.once=e=>{const t=xe(this,Bd).on("update",n=>{t(),e(n)});return t}}update(){xe(this,Bd).emit("update",this.portals)}render({Component:e,container:t}){const n=this.portals.get(t);this.portals.set(t,{Component:e,key:(n==null?void 0:n.key)??Fg()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:Fg()})}remove(e){this.portals.delete(e),this.update()}};Bd=new WeakMap;var uoe=e=>{const{portals:t}=e;return ke.createElement(ke.Fragment,null,t.map(([n,{Component:r,key:o}])=>jr.createPortal(ke.createElement(r,null),n,o)))};function doe(e){const[t,n]=g.useState(()=>Array.from(e.portals.entries()));return g.useEffect(()=>e.on(r=>{n(Array.from(r.entries()))}),[e]),g.useMemo(()=>t,[t])}var Ot,Vd,Za,Ud,Tm,Hd,gc,Wd,Om,Mi,Kn,Ew,kL=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:i}){Cr(this,Ot,void 0),Cr(this,Vd,[]),Cr(this,Za,void 0),Cr(this,Ud,void 0),Cr(this,Tm,void 0),Cr(this,Hd,void 0),Cr(this,gc,void 0),Cr(this,Wd,!1),Cr(this,Om,void 0),Cr(this,Mi,void 0),Cr(this,Kn,void 0),Cr(this,Ew,l=>{l&&(Pe(xe(this,Mi),{code:re.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${xe(this,Ot).type.name}' which doesn't support content.`}),l.append(xe(this,Mi)))}),this.Component=()=>{const l=xe(this,Tm);return Pe(l,{code:re.REACT_NODE_VIEW,message:`The custom react node view provided for ${xe(this,Ot).type.name} doesn't have a valid ReactComponent`}),ke.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:xe(this,Za),getPosition:xe(this,Hd),node:xe(this,Ot),forwardRef:xe(this,Ew),decorations:xe(this,Vd)})},this.updateAttributes=l=>{if(!xe(this,Za).editable)return;const c=xe(this,Hd).call(this);if(c==null)return;const u=xe(this,Za).state.tr.setNodeMarkup(c,void 0,{...xe(this,Ot).attrs,...l});xe(this,Za).dispatch(u)},Pe(Pt(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),kr(this,Ot,t),kr(this,Za,r),kr(this,Ud,n),kr(this,Tm,o),kr(this,Hd,e),kr(this,gc,i),kr(this,Kn,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};kr(this,Om,s??void 0),kr(this,Mi,a),xe(this,Mi)&&xe(this,Kn).append(xe(this,Mi)),this.setDomAttributes(xe(this,Ot),xe(this,Kn)),this.Component.displayName=g2(`${xe(this,Ot).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,i,s)=>new kL({options:r,node:o,view:i,getPosition:s,portalContainer:t,ReactComponent:n})}get selected(){return xe(this,Wd)}get contentDOM(){return xe(this,Om)}get dom(){return xe(this,Kn)}renderComponent(){xe(this,Ud).render({Component:this.Component,container:xe(this,Kn)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=xe(this,gc),n=xe(this,Ot).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${G_(xe(this,Ot).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(xe(this,Ot).isLeaf)return;const n=(t=(e=xe(this,Ot).type.spec).toDOM)==null?void 0:t.call(e,xe(this,Ot));if(!n)return;const{contentDOM:r,dom:o}=$a.renderSpec(document,n);let i;if(yi(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${G_(xe(this,Ot).type.name)}-node-view-content-wrapper`),i.append(r)),yi(r),{wrapper:i,contentDOM:r}}update(e,t){return Ek({types:xe(this,Ot).type,node:e})?(xe(this,Ot)===e&&xe(this,Vd)===t||(xe(this,Ot).sameMarkup(e)||this.setDomAttributes(e,xe(this,Kn)),kr(this,Ot,e),kr(this,Vd,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=xe(this,Ot).type.spec;let r=e.attrs;if(n){const o=n(e);if(Ae(o)||foe(o))return;Wl(o[1])&&(r=o[1])}for(const[o,i]of rn(r))t.setAttribute(o,i)}selectNode(){kr(this,Wd,!0),xe(this,Kn)&&xe(this,Kn).classList.add(U_),this.renderComponent()}deselectNode(){kr(this,Wd,!1),xe(this,Kn)&&xe(this,Kn).classList.remove(U_),this.renderComponent()}destroy(){xe(this,Ud).remove(xe(this,Kn))}ignoreMutation(e){return e.type==="selection"?!xe(this,Ot).type.spec.selectable:xe(this,Mi)?!xe(this,Mi).contains(e.target):!0}stopEvent(e){var t;if(!xe(this,Kn))return!1;if(Pt(xe(this,gc).stopEvent))return xe(this,gc).stopEvent({event:e});const n=e.target;if(!(xe(this,Kn).contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o)return!0;const s=!!xe(this,Ot).type.spec.draggable,a=Oe.isSelectable(xe(this,Ot)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",d=e.type==="mousedown",h=e.type.startsWith("drag");return!s&&a&&h&&e.preventDefault(),!(h||o||l||c||u||d&&a)}},pN=kL;Ot=new WeakMap;Vd=new WeakMap;Za=new WeakMap;Ud=new WeakMap;Tm=new WeakMap;Hd=new WeakMap;gc=new WeakMap;Wd=new WeakMap;Om=new WeakMap;Mi=new WeakMap;Kn=new WeakMap;Ew=new WeakMap;function foe(e){return pw(e)||Wl(e)&&pw(e.dom)}var wh=class extends Nt{constructor(){super(...arguments),this.portalContainer=new coe}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=we(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!gp(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=pN.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=rn({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=pN.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};wh=loe([ot({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],wh);var hoe=Object.defineProperty,mN=Object.getOwnPropertySymbols,poe=Object.prototype.hasOwnProperty,moe=Object.prototype.propertyIsEnumerable,gN=(e,t,n)=>t in e?hoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vN=(e,t)=>{for(var n in t||(t={}))poe.call(t,n)&&gN(e,n,t[n]);if(mN)for(var n of mN(t))moe.call(t,n)&&gN(e,n,t[n]);return e};function goe(e){const t=g.createContext(null),n=voe(t);return[o=>{const i=e(o);return ke.createElement(t.Provider,{value:i},o.children)},n,t]}function voe(e){return(t,n)=>{const r=g.useContext(e),o=yoe(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!t)return r;if(typeof t!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=t(r);if(!o||!n)return i;const s=t(o);return n(s,i)?s:i}}function yoe(e){const t=g.useRef();return xoe(()=>{t.current=e}),t.current}var xoe=typeof document<"u"?g.useLayoutEffect:g.useEffect;function boe(e,t){return goe(n=>{const r=g.useRef(null),o=g.useRef(),i=void 0,[s,a]=g.useState(()=>e({get:yN(r),set:xN(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return g.useEffect(()=>{l.length!==0&&a(c=>e({get:yN(r),set:xN(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function yN(e){return t=>{if(!e.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!t)return e.current;if(typeof t!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return t(e.current)}}function xN(e){return t=>{if(!e.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");e.current(n=>vN(vN({},n),typeof t=="function"?t(n):t))}}var EL={},CL={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorMessages=e.ErrorType=void 0;var t;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(t=e.ErrorType||(e.ErrorType={})),e.errorMessages=new Map([[t.MalformedUnicode,"malformed Unicode character escape sequence"],[t.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[t.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[t.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[t.EndOfString,"malformed escape sequence at end of string"]])})(CL);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=CL;Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return t.ErrorType}}),Object.defineProperty(e,"errorMessages",{enumerable:!0,get:function(){return t.errorMessages}});function n(p){return!p.match(/[^a-f0-9]/i)?parseInt(p,16):NaN}function r(p,m,v){const x=n(p);if(Number.isNaN(x)||v!==void 0&&v!==p.length)throw new SyntaxError(t.errorMessages.get(m));return x}function o(p){const m=r(p,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(p,m){const v=r(p,t.ErrorType.MalformedUnicode,4);if(m!==void 0){const x=r(m,t.ErrorType.MalformedUnicode,4);return String.fromCharCode(v,x)}return String.fromCharCode(v)}function s(p){return p.charAt(0)==="{"&&p.charAt(p.length-1)==="}"}function a(p){if(!s(p))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const m=p.slice(1,-1),v=r(m,t.ErrorType.MalformedUnicode);try{return String.fromCodePoint(v)}catch(x){throw x instanceof RangeError?new SyntaxError(t.errorMessages.get(t.ErrorType.CodePointLimit)):x}}function l(p,m=!1){if(m)throw new SyntaxError(t.errorMessages.get(t.ErrorType.OctalDeprecation));const v=parseInt(p,8);return String.fromCharCode(v)}const c=new Map([["b","\b"],["f","\f"],["n",`
|
|
488
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(p){return c.get(p)||p}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function h(p,m=!1){return p.replace(d,function(v,x,b,w,S,C,_,P,O){if(x!==void 0)return"\\";if(b!==void 0)return o(b);if(w!==void 0)return a(w);if(S!==void 0)return i(S,C);if(_!==void 0)return i(_);if(P==="0")return"\0";if(P!==void 0)return l(P,!m);if(O!==void 0)return u(O);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=h,e.default=h})(EL);const xl=e=>typeof e=="string",woe=e=>typeof e=="function",bN=new Map,_L="en";function jk(e){return[...Array.isArray(e)?e:[e],_L]}function PL(e,t,n){const r=jk(e);return rv(()=>ov("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(xl(t)?new Date(t):t)}function Cw(e,t,n){const r=jk(e);return rv(()=>ov("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function wN(e,t,n,{offset:r=0,...o}){const i=jk(e),s=t?rv(()=>ov("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):rv(()=>ov("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function rv(e,t){const n=e();let r=bN.get(n);return r||(r=t(),bN.set(n,r)),r}function ov(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const NL=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,TL="%__lingui_octothorpe__%",Soe=(e,t,n={})=>{const r=t||e,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=Cw(r,s,l);return a.replace(new RegExp(TL,"g"),c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=wN(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=wN(r,!0,s,a);return i(s-l,c)},select:koe,number:(s,a)=>Cw(r,s,o(a)),date:(s,a)=>PL(r,s,o(a))}},koe=(e,t)=>t[e]??t.other;function Eoe(e,t,n){return(r={},o)=>{const i=Soe(t,n,o),s=(l,c=!1)=>Array.isArray(l)?l.reduce((u,d)=>{if(d==="#"&&c)return u+TL;if(xl(d))return u+d;const[h,p,m]=d;let v={};p==="plural"||p==="selectordinal"||p==="select"?Object.entries(m).forEach(([b,w])=>{v[b]=s(w,p==="plural"||p==="selectordinal")}):v=m;let x;if(p){const b=i[p];x=b(r[h],v)}else x=r[h];return x==null?u:u+x},""):l,a=s(e);return xl(a)&&NL.test(a)?EL.unraw(a.trim()):xl(a)?a.trim():a?String(a):""}}var Coe=Object.defineProperty,_oe=(e,t,n)=>t in e?Coe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Poe=(e,t,n)=>(_oe(e,t+"",n),n);class Noe{constructor(){Poe(this,"_events",{})}on(t,n){var r;return(r=this._events)[t]??(r[t]=[]),this._events[t].push(n),()=>this.removeListener(t,n)}removeListener(t,n){const r=this._getListeners(t);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(t,...n){const r=this._getListeners(t);r&&r.map(o=>o.apply(this,n))}_getListeners(t){const n=this._events[t];return Array.isArray(n)?n:!1}}var Toe=Object.defineProperty,Ooe=(e,t,n)=>t in e?Toe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lc=(e,t,n)=>(Ooe(e,typeof t!="symbol"?t+"":t,n),n);class Moe extends Noe{constructor(t){super(),lc(this,"_locale",""),lc(this,"_locales"),lc(this,"_localeData",{}),lc(this,"_messages",{}),lc(this,"_missing"),lc(this,"t",this._.bind(this)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate(t.locale??_L,t.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(t,n){const r=this._localeData[t];r?Object.assign(r,n):this._localeData[t]=n}loadLocaleData(t,n){n!=null?this._loadLocaleData(t,n):Object.keys(t).forEach(r=>this._loadLocaleData(r,t[r])),this.emit("change")}_load(t,n){const r=this._messages[t];r?Object.assign(r,n):this._messages[t]=n}load(t,n){typeof t=="string"&&typeof n=="object"?this._load(t,n):Object.entries(t).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:t,locales:n,messages:r}){this._locale=t,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(t,n){this._locale=t,this._locales=n,this.emit("change")}_(t,n,r){let o=r==null?void 0:r.message;t||(t=""),xl(t)||(n=t.values||n,o=t.message,t=t.id);const i=this.messages[t],s=i===void 0,a=this._missing;if(a&&s)return woe(a)?a(this._locale,t):a;s&&this.emit("missing",{id:t,locale:this._locale});let l=i||o||t;return xl(l)&&NL.test(l)?JSON.parse(`"${l}"`):xl(l)?l:Eoe(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return PL(this._locales||this._locale,t,n)}number(t,n){return Cw(this._locales||this._locale,t,n)}}function joe(e={}){return new Moe(e)}const jy=joe();function ie(e,t){return t?"other":e==1?"one":"other"}function hs(e,t){return t?"other":e==0||e==1?"one":"other"}function xr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function lt(e,t){return"other"}function Va(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const Roe=lt,Ioe=ie,Aoe=hs;function Doe(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Loe=ie;function Foe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function zoe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function $oe(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Boe=ie,Voe=xr;function Uoe(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return t?o==1||o==2||o==5||o==7||o==8||i==20||i==50||i==70||i==80?"one":o==3||o==4||s==100||s==200||s==300||s==400||s==500||s==600||s==700||s==800||s==900?"few":r==0||o==6||i==40||i==60||i==90?"many":"other":e==1?"one":"other"}function Hoe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?(o==2||o==3)&&i!=12&&i!=13?"few":"other":o==1&&i!=11?"one":o>=2&&o<=4&&(i<12||i>14)?"few":r&&o==0||o>=5&&o<=9||i>=11&&i<=14?"many":"other"}const Woe=ie,Koe=ie,Goe=ie,qoe=hs,Yoe=lt;function Joe(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Xoe=lt;function Zoe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return t?"other":o==1&&i!=11&&i!=71&&i!=91?"one":o==2&&i!=12&&i!=72&&i!=92?"two":(o==3||o==4||o==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":e!=0&&r&&s==0?"many":"other"}const Qoe=ie;function eie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function tie(e,t){var n=String(e).split("."),r=!n[1];return t?e==1||e==3?"one":e==2?"two":e==4?"few":"other":e==1&&r?"one":"other"}const nie=ie;function rie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const oie=ie,iie=ie,sie=ie;function aie(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function lie(e,t){return t?e==0||e==7||e==8||e==9?"zero":e==1?"one":e==2?"two":e==3||e==4?"few":e==5||e==6?"many":"other":e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"}function cie(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e;return t?"other":e==1||!o&&(r==0||r==1)?"one":"other"}const uie=xr;function die(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}const fie=ie,hie=lt,pie=ie,mie=ie;function gie(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":e==1&&r?"one":"other"}const vie=ie,yie=ie,xie=xr,bie=ie;function wie(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function Sie(e,t){return t?"other":e>=0&&e<2?"one":"other"}const kie=xr;function Eie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Cie=ie;function _ie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Pie=ie,Nie=xr;function Tie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1?"one":"other":e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"}function Oie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==11?"one":e==2||e==12?"two":e==3||e==13?"few":"other":e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"}const Mie=xr,jie=ie;function Rie(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Iie=hs;function Aie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(s==0||s==20||s==40||s==60||s==80)?"few":o?"other":"many"}const Die=ie,Lie=ie;function Fie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}function zie(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}function $ie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Bie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}function Vie(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function Uie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Hie=xr,Wie=lt,Kie=lt,Gie=lt,qie=xr;function Yie(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e,i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11||!o?"one":"other"}function Jie(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const Xie=Va;function Zie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}const Qie=lt,ese=lt,tse=ie,nse=xr,rse=ie,ose=lt,ise=lt;function sse(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-2);return t?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":e==1?"one":"other"}function ase(e,t){return t?"other":e>=0&&e<2?"one":"other"}const lse=ie,cse=ie,use=lt,dse=lt;function fse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||r&&o==0&&e!=0?"many":"other":e==1?"one":"other"}const hse=ie,pse=ie,mse=lt;function gse(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const vse=lt,yse=ie,xse=ie;function bse(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const wse=ie;function Sse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2),i=r&&n[0].slice(-3),s=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return t?r&&e>=1&&e<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":e==5||o==5?"many":"other":e==0?"zero":e==1?"one":o==2||o==22||o==42||o==62||o==82||r&&i==0&&(s>=1e3&&s<=2e4||s==4e4||s==6e4||s==8e4)||e!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":e!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const kse=ie;function Ese(e,t){var n=String(e).split("."),r=n[0];return t?"other":e==0?"zero":(r==0||r==1)&&e!=0?"one":"other"}const Cse=ie,_se=ie,Pse=lt,Nse=hs;function Tse(e,t){return t&&e==1?"one":"other"}function Ose(e,t){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function Mse(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const jse=ie,Rse=hs,Ise=ie;function Ase(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?s==1&&a!=11?"one":s==2&&a!=12?"two":(s==7||s==8)&&a!=17&&a!=18?"many":"other":i&&s==1&&a!=11||l==1&&c!=11?"one":"other"}const Dse=ie,Lse=ie;function Fse(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}function zse(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function $se(e,t){return t&&e==1?"one":"other"}function Bse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==1?"one":e==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const Vse=lt,Use=ie,Hse=Va,Wse=ie,Kse=ie;function Gse(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?r&&e>=1&&e<=4?"one":"other":e==1?"one":"other"}const qse=xr,Yse=ie,Jse=ie,Xse=ie,Zse=lt,Qse=ie,eae=hs,tae=ie,nae=ie,rae=ie;function oae(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==5||r&&e>=7&&e<=9?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e==1?"one":"other"}const iae=ie,sae=lt,aae=hs,lae=ie;function cae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":e==1&&o?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&r!=1&&(i==0||i==1)||o&&i>=5&&i<=9||o&&s>=12&&s<=14?"many":"other"}function uae(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const dae=ie;function fae(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const hae=xr,pae=ie;function mae(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}const gae=ie,vae=lt;function yae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&i==0||o&&i>=5&&i<=9||o&&s>=11&&s<=14?"many":"other"}const xae=ie,bae=lt,wae=ie;function Sae(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}function kae(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const Eae=ie,Cae=ie,_ae=Va,Pae=ie,Nae=lt,Tae=lt;function Oae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Mae(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e>=0&&e<=1?"one":r&&e>=2&&e<=10?"few":"other"}function jae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"";return t?"other":e==0||e==1||r==0&&o==1?"one":"other"}function Rae(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function Iae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const Aae=Va,Dae=Va,Lae=Va,Fae=Va,zae=Va,$ae=ie,Bae=ie;function Vae(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?e==1?"one":o==4&&i!=14?"many":"other":e==1?"one":"other"}function Uae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const Hae=ie,Wae=ie,Kae=ie,Gae=lt;function qae(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?(i==1||i==2)&&s!=11&&s!=12?"one":"other":e==1&&r?"one":"other"}const Yae=xr,Jae=ie,Xae=ie,Zae=ie,Qae=ie,ele=lt,tle=hs,nle=ie;function rle(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||e==10?"few":"other":e==1?"one":"other"}function ole(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const ile=ie,sle=lt,ale=ie,lle=ie;function cle(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e==0||e==1||r&&e>=11&&e<=99?"one":"other"}const ule=ie;function dle(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return t?s==3&&a!=13?"few":"other":o&&l==1&&c!=11?"one":o&&l>=2&&l<=4&&(c<12||c>14)?"few":o&&l==0||o&&l>=5&&l<=9||o&&c>=11&&c<=14?"many":"other"}const fle=xr,hle=ie,ple=ie;function mle(e,t){return t&&e==1?"one":"other"}const gle=ie,vle=ie,yle=hs,xle=ie,ble=lt,wle=ie,Sle=ie,kle=xr,Ele=lt,Cle=lt,_le=lt;function Ple(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Nle=Object.freeze(Object.defineProperty({__proto__:null,_in:Roe,af:Ioe,ak:Aoe,am:Doe,an:Loe,ar:Foe,ars:zoe,as:$oe,asa:Boe,ast:Voe,az:Uoe,be:Hoe,bem:Woe,bez:Koe,bg:Goe,bho:qoe,bm:Yoe,bn:Joe,bo:Xoe,br:Zoe,brx:Qoe,bs:eie,ca:tie,ce:nie,ceb:rie,cgg:oie,chr:iie,ckb:sie,cs:aie,cy:lie,da:cie,de:uie,dsb:die,dv:fie,dz:hie,ee:pie,el:mie,en:gie,eo:vie,es:yie,et:xie,eu:bie,fa:wie,ff:Sie,fi:kie,fil:Eie,fo:Cie,fr:_ie,fur:Pie,fy:Nie,ga:Tie,gd:Oie,gl:Mie,gsw:jie,gu:Rie,guw:Iie,gv:Aie,ha:Die,haw:Lie,he:Fie,hi:zie,hr:$ie,hsb:Bie,hu:Vie,hy:Uie,ia:Hie,id:Wie,ig:Kie,ii:Gie,io:qie,is:Yie,it:Jie,iu:Xie,iw:Zie,ja:Qie,jbo:ese,jgo:tse,ji:nse,jmc:rse,jv:ose,jw:ise,ka:sse,kab:ase,kaj:lse,kcg:cse,kde:use,kea:dse,kk:fse,kkj:hse,kl:pse,km:mse,kn:gse,ko:vse,ks:yse,ksb:xse,ksh:bse,ku:wse,kw:Sse,ky:kse,lag:Ese,lb:Cse,lg:_se,lkt:Pse,ln:Nse,lo:Tse,lt:Ose,lv:Mse,mas:jse,mg:Rse,mgo:Ise,mk:Ase,ml:Dse,mn:Lse,mo:Fse,mr:zse,ms:$se,mt:Bse,my:Vse,nah:Use,naq:Hse,nb:Wse,nd:Kse,ne:Gse,nl:qse,nn:Yse,nnh:Jse,no:Xse,nqo:Zse,nr:Qse,nso:eae,ny:tae,nyn:nae,om:rae,or:oae,os:iae,osa:sae,pa:aae,pap:lae,pl:cae,prg:uae,ps:dae,pt:fae,pt_PT:hae,rm:pae,ro:mae,rof:gae,root:vae,ru:yae,rwk:xae,sah:bae,saq:wae,sc:Sae,scn:kae,sd:Eae,sdh:Cae,se:_ae,seh:Pae,ses:Nae,sg:Tae,sh:Oae,shi:Mae,si:jae,sk:Rae,sl:Iae,sma:Aae,smi:Dae,smj:Lae,smn:Fae,sms:zae,sn:$ae,so:Bae,sq:Vae,sr:Uae,ss:Hae,ssy:Wae,st:Kae,su:Gae,sv:qae,sw:Yae,syr:Jae,ta:Xae,te:Zae,teo:Qae,th:ele,ti:tle,tig:nle,tk:rle,tl:ole,tn:ile,to:sle,tr:ale,ts:lle,tzm:cle,ug:ule,uk:dle,ur:fle,uz:hle,ve:ple,vi:mle,vo:gle,vun:vle,wa:yle,wae:xle,wo:ble,xh:wle,xog:Sle,yi:kle,yo:Ele,yue:Cle,zh:_le,zu:Ple},Symbol.toStringTag,{value:"Module"}));var Tle=Object.defineProperty,Ole=Object.getOwnPropertyDescriptor,Mle=Object.getOwnPropertyNames,jle=Object.prototype.hasOwnProperty,Rle=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Mle(t))!jle.call(e,o)&&o!==n&&Tle(e,o,{get:()=>t[o],enumerable:!(r=Ole(t,o))||r.enumerable});return e},Ile=(e,t,n)=>(Rle(e,t,"default"),n),Ale=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),OL={};Ile(OL,Nle);jy.loadLocaleData("en",{plurals:OL.en});jy.load("en",Ale);jy.activate("en");var Dle=Object.defineProperty,Lle=Object.getOwnPropertyDescriptor,Rk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lle(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Dle(t,n,o),o},_u=class extends go{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=we();if(Wl(n))for(const[i,s]of rn(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...t}}setDocAttributes(e){return({tr:t,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(e))t.step(new _w(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return Nk(e.doc,t)}};Rk([ye()],_u.prototype,"setDocAttributes",1);Rk([zt()],_u.prototype,"isDefaultDocNode",1);_u=Rk([ot({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:ht.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],_u);var ML="SetDocAttribute",jL="RevertSetDocAttribute",_w=class Pw extends sn{constructor(n,r,o=ML){super();$t(this,"key");$t(this,"stepType");$t(this,"value");$t(this,"previous");this.stepType=o,this.key=n,this.value=r}static fromJSON(n,r){return new Pw(r.key,r.value,r.stepType)}apply(n){this.previous=n.attrs[this.key];const r={...n.attrs,[this.key]:this.value};return Ut.ok(n.type.create(r,n.content,n.marks))}invert(){return new Pw(this.key,this.previous,jL)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{sn.jsonID(ML,_w),sn.jsonID(jL,_w)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var Fle=Object.defineProperty,zle=Object.getOwnPropertyDescriptor,RL=(e,t,n,r)=>{for(var o=r>1?void 0:r?zle(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Fle(t,n,o),o};function $le(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function Ble(e,t){const n=t.target;if(n){const r=$le(e,n,0);if(r!==null){const o=e.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return e.posAtCoords({left:t.clientX,top:t.clientY})??void 0}var iv=class extends Nt{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=Ble(t,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=t.state.doc.resolve(l),u=c.depth+1;for(const d of S2(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const h=ls(c,d);h&&s.push(h)}return e(r,{view:t,nodes:i,marks:s,getMark:d=>{const h=Ae(d)?t.state.schema.marks[d]:d;return Pe(h,{code:re.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(p=>p.mark.type===h)},getNode:d=>{var h;const p=Ae(d)?t.state.schema.nodes[d]:d;Pe(p,{code:re.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:v})=>v.type===p);if(m)return{...m,isRoot:!!((h=i[0])!=null&&h.node.eq(m.node))}}})}}get name(){return"events"}onView(){var e,t;if(!((e=this.store.managerSettings.exclude)!=null&&e.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(t=n.options.exclude)!=null&&t.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of rn(r))this.addHandler(o,i)}}createPlugin(){const e=new WeakMap,t=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:h}=u,p=h.resolve(i),m=e.has(l),v=Vle({$pos:p,handled:m,view:o,state:u});let x=!1;m||(x=n(l,v)||x);const b={...v,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:w=>{const S=Ae(w)?d.nodes[w]:w;return Pe(S,{code:re.EXTENSION,message:"The node being checked does not exist"}),S===s.type?{node:s,pos:a}:void 0}};return e.set(l,!0),r(l,b)||x};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,o,i)=>this.options.textInput({from:r,to:o,text:i})||!1,handleClickOn:(n,r,o,i,s,a)=>t(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>t(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>t(this.options.tripleClickMark,this.options.tripleClick,n,r,o,i,s,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!1};return this.options.hover(n,o)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!0};return this.options.hover(n,o)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const o=this.options;return{update(i){const s=i.editable;s!==r&&(o.editable(s),r=s)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};RL([zt()],iv.prototype,"isInteracting",1);iv=RL([ot({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:ht.High})],iv);function Vle(e){const{handled:t,view:n,$pos:r,state:o}=e,i={getMark:b2,markRanges:[],view:n,state:o};if(t)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=ls(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=Ae(s)?o.schema.marks[s]:s;return Pe(a,{code:re.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class Ft extends Ke{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Ft.valid(r)?new Ft(r):Ke.near(r)}content(){return se.empty}eq(t){return t instanceof Ft&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ft(t.resolve(n.pos))}getBookmark(){return new Ik(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!Ule(t)||!Hle(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&Ft.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let l=t.doc.resolve(o);if(Ft.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Oe.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=t.doc.resolve(o);if(Ft.valid(a))return a}return null}}}Ft.prototype.visible=!1;Ft.findFrom=Ft.findGapCursorFrom;Ke.jsonID("gapcursor",Ft);class Ik{constructor(t){this.pos=t}map(t){return new Ik(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Ft.valid(n)?new Ft(n):Ke.near(n)}}function Ule(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Hle(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Wle(){return new fs({props:{decorations:Yle,createSelectionBetween(e,t,n){return t.pos==n.pos&&Ft.valid(n)?new Ft(n):null},handleClick:Gle,handleKeyDown:Kle,handleDOMEvents:{beforeinput:qle}}})}const Kle=mL({ArrowLeft:em("horiz",-1),ArrowRight:em("horiz",1),ArrowUp:em("vert",-1),ArrowDown:em("vert",1)});function em(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof Le){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=Ft.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new Ft(c))),!0):!1}}function Gle(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Ft.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Oe.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Ft(r))),!0)}function qle(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Ft))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=q.empty;for(let s=r.length-1;s>=0;s--)o=q.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new se(o,0,0));return i.setSelection(Le.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Yle(e){if(!(e.selection instanceof Ft))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",it.create(e.doc,[Ct.widget(e.selection.head,t,{key:"gapcursor"})])}var Jle=Object.defineProperty,Xle=Object.getOwnPropertyDescriptor,Zle=(e,t,n,r)=>{for(var o=r>1?void 0:r?Xle(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Jle(t,n,o),o},Nw=class extends Nt{get name(){return"gapCursor"}createExternalPlugins(){return[Wle()]}};Nw=Zle([ot({})],Nw);var sv=200,gn=function(){};gn.prototype.append=function(t){return t.length?(t=gn.from(t),!this.length&&t||t.length<sv&&this.leafAppend(t)||this.length<sv&&t.leafPrepend(this)||this.appendInner(t)):this};gn.prototype.prepend=function(t){return t.length?gn.from(t).append(this):this};gn.prototype.appendInner=function(t){return new Qle(this,t)};gn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?gn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};gn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};gn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};gn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};gn.from=function(t){return t instanceof gn?t:t&&t.length?new IL(t):gn.empty};var IL=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=sv)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=sv)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(gn);gn.empty=new IL([]);var Qle=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(gn);const ece=500;class jo{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){o||(o=this.remapping(r,h+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new _s(d.map));let p=d.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new _s(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new jo(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),h=new _s(t.mapping.maps[u],d,n),p;(p=l&&l.merge(h))&&(h=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(s++,n=void 0),o||(l=h)}let c=s-r.depth;return c>nce&&(a=tce(a,c),s-=c),new jo(a.append(i),s)}remapping(t,n){let r=new Kc;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new jo(this.items.append(t.map(n=>new _s(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},o);let l=n;this.items.forEach(h=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(h.step){let v=t.steps[p].invert(t.docs[p]),x=h.selection&&h.selection.map(i.slice(l+1,p));x&&a++,r.push(new _s(m,v,x))}else r.push(new _s(m))},o);let c=[];for(let h=n;h<s;h++)c.push(new _s(i.maps[h]));let u=this.items.slice(0,o).append(c).append(r),d=new jo(u,a);return d.emptyItemCount()>ece&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=t)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new _s(c.invert(),l,u),h,p=o.length-1;(h=o.length&&o[p].merge(d))?o[p]=h:o.push(d)}}else s.map&&r--},this.items.length,0),new jo(gn.from(o.reverse()),i)}}jo.empty=new jo(gn.empty,0);function tce(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let _s=class AL{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new AL(n.getMap().invert(),n,this.selection)}}};class Fs{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const nce=20;function rce(e,t,n,r){let o=n.getMeta(Ji),i;if(o)return o.historyState;n.getMeta(sce)&&(e=new Fs(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(Ji))return s.getMeta(Ji).redo?new Fs(e.done.addTransform(n,void 0,r,Mm(t)),e.undone,SN(n.mapping.maps),e.prevTime,e.prevComposition):new Fs(e.done,e.undone.addTransform(n,void 0,r,Mm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!oce(n,e.prevRanges)),c=s?h0(e.prevRanges,n.mapping):SN(n.mapping.maps);return new Fs(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Mm(t)),jo.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new Fs(e.done.rebased(n,i),e.undone.rebased(n,i),h0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Fs(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),h0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function oce(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function SN(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function h0(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function ice(e,t,n){let r=Mm(t),o=Ji.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Fs(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Ji,{redo:n,historyState:l})}let p0=!1,kN=null;function Mm(e){let t=e.plugins;if(kN!=t){p0=!1,kN=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){p0=!0;break}}return p0}const Ji=new Ju("history"),sce=new Ju("closeHistory");function ace(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new fs({key:Ji,state:{init(){return new Fs(jo.empty,jo.empty,null,0,-1)},apply(t,n,r){return rce(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?jm:r=="historyRedo"?Kd:null;return o?(n.preventDefault(),o(t.state,t.dispatch)):!1}}}})}function DL(e,t){return(n,r)=>{let o=Ji.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=ice(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const jm=DL(!1,!0),Kd=DL(!0,!0);function Tw(e){let t=Ji.getState(e);return t?t.done.eventCount:0}function lce(e){let t=Ji.getState(e);return t?t.undone.eventCount:0}var cce=Object.defineProperty,uce=Object.getOwnPropertyDescriptor,Gl=(e,t,n,r)=>{for(var o=r>1?void 0:r?uce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&cce(t,n,o),o},xi=class extends Nt{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=Pt(i)?i():n,l=Pt(s)&&r?s():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":Oo.isMac?()=>!1:this.wrapMethod(Kd,this.options.onRedo),"Mod-z":this.wrapMethod(jm,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(Kd,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(jm,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(Kd,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[ace({depth:e,newGroupDelay:t})]}undo(){return oN(this.wrapMethod(jm,this.options.onUndo))}redo(){return oN(this.wrapMethod(Kd,this.options.onRedo))}undoDepth(e=this.store.getState()){return Tw(e)}redoDepth(e=this.store.getState()){return lce(e)}};Gl([qr({shortcut:oe.Undo,command:"undo"})],xi.prototype,"undoShortcut",1);Gl([qr({shortcut:oe.Redo,command:"redo"})],xi.prototype,"redoShortcut",1);Gl([ye({disableChaining:!0,description:({t:e})=>e(Wg.UNDO_DESCRIPTION),label:({t:e})=>e(Wg.UNDO_LABEL),icon:"arrowGoBackFill"})],xi.prototype,"undo",1);Gl([ye({disableChaining:!0,description:({t:e})=>e(Wg.REDO_DESCRIPTION),label:({t:e})=>e(Wg.REDO_LABEL),icon:"arrowGoForwardFill"})],xi.prototype,"redo",1);Gl([zt()],xi.prototype,"undoDepth",1);Gl([zt()],xi.prototype,"redoDepth",1);xi=Gl([ot({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],xi);var dce=Object.defineProperty,fce=Object.getOwnPropertyDescriptor,Ry=(e,t,n,r)=>{for(var o=r>1?void 0:r?fce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&dce(t,n,o),o},hce={icon:"paragraph",label:({t:e})=>e(Kg.INSERT_LABEL),description:({t:e})=>e(Kg.INSERT_DESCRIPTION)},pce={icon:"paragraph",label:({t:e})=>e(Kg.CONVERT_LABEL),description:({t:e})=>e(Kg.CONVERT_DESCRIPTION)},Ll=class extends go{get name(){return"paragraph"}createTags(){return[He.LastNodeCompatible,He.TextBlock,He.Block,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",draggable:!1,...t,attrs:{...e.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...e.parse(n)})},...t.parseDOM??[]],toDOM:n=>["p",e.dom(n),0]}}convertParagraph(e={}){const{attrs:t,selection:n,preserveAttrs:r}=e;return this.store.commands.setBlockNodeType.original(this.type,t,n,r)}insertParagraph(e,t={}){const{selection:n,attrs:r}=t;return this.store.commands.insertNode.original(this.type,{content:e,selection:n,attrs:r})}shortcut(e){return this.convertParagraph()(e)}};Ry([ye(pce)],Ll.prototype,"convertParagraph",1);Ry([ye(hce)],Ll.prototype,"insertParagraph",1);Ry([qr({shortcut:oe.Paragraph,command:"convertParagraph"})],Ll.prototype,"shortcut",1);Ll=Ry([ot({defaultPriority:ht.Medium})],Ll);function Ui(e,t,n){return Math.min(Math.max(e,n),t)}class mce extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Gd=mce;function Ak(e){if(typeof e!="string")throw new Gd(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=kce.test(e)?yce(e):e;const n=xce.exec(t);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(Sh(a,2),16)),parseInt(Sh(s[3]||"f",2),16)/255]}const r=bce.exec(t);if(r){const s=Array.from(r).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,16)),parseInt(s[3]||"ff",16)/255]}const o=wce.exec(t);if(o){const s=Array.from(o).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,10)),parseFloat(s[3]||"1")]}const i=Sce.exec(t);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Ui(0,100,a)!==a)throw new Gd(e);if(Ui(0,100,l)!==l)throw new Gd(e);return[...Ece(s,a,l),Number.isNaN(c)?1:c]}throw new Gd(e)}function gce(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const EN=e=>parseInt(e.replace(/_/g,""),36),vce="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=EN(t.substring(0,3)),r=EN(t.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return e[n]=`${o}${r}`,e},{});function yce(e){const t=e.toLowerCase().trim(),n=vce[gce(t)];if(!n)throw new Gd(e);return`#${n}`}const Sh=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),xce=new RegExp(`^#${Sh("([a-f0-9])",3)}([a-f0-9])?$`,"i"),bce=new RegExp(`^#${Sh("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),wce=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Sh(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Sce=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,kce=/^[a-z]+$/i,CN=e=>Math.round(e*255),Ece=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(CN);const o=(e%360+360)%360/60,i=(1-Math.abs(2*r-1))*(t/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,d=a+u,h=l+u,p=c+u;return[d,h,p].map(CN)};function Cce(e){const[t,n,r,o]=Ak(e).map((d,h)=>h===3?d:d/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2;if(i===s)return[0,0,a,o];const l=i-s,c=a>.5?l/(2-i-s):l/(i+s);return[60*(t===i?(n-r)/l+(n<r?6:0):n===i?(r-t)/l+2:(t-n)/l+4),c,a,o]}function _ce(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${Ui(0,100,t*100).toFixed()}%, ${Ui(0,100,n*100).toFixed()}%, ${parseFloat(Ui(0,1,r).toFixed(3))})`}function Tr(e,t){const[n,r,o,i]=Cce(e);return _ce(n,r,o-t,i)}function Pce(e){if(e==="transparent")return 0;function t(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=Ak(e);return .2126*t(n)+.7152*t(r)+.0722*t(o)}function Nce(e,t,n,r){return`rgba(${Ui(0,255,e).toFixed()}, ${Ui(0,255,t).toFixed()}, ${Ui(0,255,n).toFixed()}, ${parseFloat(Ui(0,1,r).toFixed(3))})`}function Rm(e,t){return Tr(e,-t)}function av(e,t){const[n,r,o,i]=Ak(e);return Nce(n,r,o,i-t)}function Tce(e){return Pce(e)>.179}function Jc(e){return Tce(e)?"#000":"#fff"}const Oce="remirror-editor-wrapper",Mce="remirror-button-active",jce="remirror-button",Rce="remirror-composite",Ice="remirror-dialog",Ace="remirror-dialog-backdrop",Dce="remirror-form",Lce="remirror-form-message",Fce="remirror-form-label",zce="remirror-form-group",$ce="remirror-group",Bce="remirror-input",Vce="remirror-menu",Uce="remirror-menu-pane",Hce="remirror-menu-pane-active",Wce="remirror-menu-dropdown-label",Kce="remirror-menu-pane-icon",Gce="remirror-menu-pane-label",qce="remirror-menu-pane-shortcut",Yce="remirror-menu-button-left",Jce="remirror-menu-button-right",Xce="remirror-menu-button-nested-left",Zce="remirror-menu-button-nested-right",Qce="remirror-menu-button",eue="remirror-menu-bar",tue="remirror-flex-column",nue="remirror-flex-row",rue="remirror-menu-item",oue="remirror-menu-item-row",iue="remirror-menu-item-column",sue="remirror-menu-item-checkbox",aue="remirror-menu-item-radio",lue="remirror-menu-group",cue="remirror-floating-popover",uue="remirror-popover",due="remirror-animated-popover",fue="remirror-role",hue="remirror-separator",pue="remirror-tab",mue="remirror-tab-list",gue="remirror-tabbable",vue="remirror-toolbar",yue="remirror-tooltip",xue="remirror-table-size-editor",bue="remirror-table-size-editor-body",wue="remirror-table-size-editor-cell",Sue="remirror-table-size-editor-cell-selected",kue="remirror-table-size-editor-footer",Eue="remirror-color-picker",Cue="remirror-color-picker-cell",_ue="remirror-color-picker-cell-selected";var Pue=Object.freeze({__proto__:null,ANIMATED_POPOVER:due,BUTTON:jce,BUTTON_ACTIVE:Mce,COLOR_PICKER:Eue,COLOR_PICKER_CELL:Cue,COLOR_PICKER_CELL_SELECTED:_ue,COMPOSITE:Rce,DIALOG:Ice,DIALOG_BACKDROP:Ace,EDITOR_WRAPPER:Oce,FLEX_COLUMN:tue,FLEX_ROW:nue,FLOATING_POPOVER:cue,FORM:Dce,FORM_GROUP:zce,FORM_LABEL:Fce,FORM_MESSAGE:Lce,GROUP:$ce,INPUT:Bce,MENU:Vce,MENU_BAR:eue,MENU_BUTTON:Qce,MENU_BUTTON_LEFT:Yce,MENU_BUTTON_NESTED_LEFT:Xce,MENU_BUTTON_NESTED_RIGHT:Zce,MENU_BUTTON_RIGHT:Jce,MENU_DROPDOWN_LABEL:Wce,MENU_GROUP:lue,MENU_ITEM:rue,MENU_ITEM_CHECKBOX:sue,MENU_ITEM_COLUMN:iue,MENU_ITEM_RADIO:aue,MENU_ITEM_ROW:oue,MENU_PANE:Uce,MENU_PANE_ACTIVE:Hce,MENU_PANE_ICON:Kce,MENU_PANE_LABEL:Gce,MENU_PANE_SHORTCUT:qce,POPOVER:uue,ROLE:fue,SEPARATOR:hue,TAB:pue,TABBABLE:gue,TABLE_SIZE_EDITOR:xue,TABLE_SIZE_EDITOR_BODY:bue,TABLE_SIZE_EDITOR_CELL:wue,TABLE_SIZE_EDITOR_CELL_SELECTED:Sue,TABLE_SIZE_EDITOR_FOOTER:kue,TAB_LIST:mue,TOOLBAR:vue,TOOLTIP:yue});const Nue="remirror-image-loader";var Tue=Object.freeze({__proto__:null,IMAGE_LOADER:Nue});const Oue="remirror-list-item-with-custom-mark",Mue="remirror-ul-list-content",jue="remirror-editor",Rue="remirror-list-item-marker-container",Iue="remirror-list-item-checkbox",Aue="remirror-collapsible-list-item-closed",Due="remirror-collapsible-list-item-button",Lue="remirror-list-spine";var Ta=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:Due,COLLAPSIBLE_LIST_ITEM_CLOSED:Aue,EDITOR:jue,LIST_ITEM_CHECKBOX:Iue,LIST_ITEM_MARKER_CONTAINER:Rue,LIST_ITEM_WITH_CUSTOM_MARKER:Oue,LIST_SPINE:Lue,UL_LIST_CONTENT:Mue});const Fue="remirror-is-empty";var zue=Object.freeze({__proto__:null,IS_EMPTY:Fue});const $ue="remirror-editor",Bue="remirror-positioner",Vue="remirror-positioner-widget";var Uue=Object.freeze({__proto__:null,EDITOR:$ue,POSITIONER:Bue,POSITIONER_WIDGET:Vue});const ko={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},Hi="#000000",Dk="#ffffff",Hue="#252103",Lk=av(Hi,.75),Iy="#7963d2",Fk="#bcd263",Wue="#fff",Kue="#fff",zk=ko.gray[1],_N="rgba(10,31,68,0.08)",PN="rgba(10,31,68,0.10)",NN="rgba(10,31,68,0.12)",Gue=Rm(av(Hi,.1),.13),$k={background:Dk,border:Lk,foreground:Hi,muted:zk,primary:Iy,secondary:Fk,primaryText:Wue,secondaryText:Kue,text:Hue,faded:Gue},que={...$k,background:Tr(Dk,.15),border:Tr(Lk,.15),foreground:Tr(Hi,.15),muted:Tr(zk,.15),primary:Tr(Iy,.15),secondary:Tr(Fk,.15),get text(){return Jc(this.background)},get primaryText(){return Jc(this.primary)},get secondaryText(){return Jc(this.secondary)}},Yue={...$k,background:Tr(Dk,.075),border:Tr(Lk,.075),foreground:Tr(Hi,.075),muted:Tr(zk,.075),primary:Tr(Iy,.075),secondary:Tr(Fk,.075),get text(){return Jc(this.background)},get primaryText(){return Jc(this.primary)},get secondaryText(){return Jc(this.secondary)}};({...$k,backdrop:av(Hi,.1),outline:av(Iy,.6),table:(Rm(Hi,.8),Rm(Hi,.4),ko.gray[3],ko.blue[7],ko.blue[1],ko.blue[5],ko.blue[7],Rm(Hi,.4),ko.blue[5],ko.red[7],ko.red[1],ko.red[5])},`${_N}`,`${PN}`,`${NN}`);var Jue=Object.defineProperty,Xue=Object.getOwnPropertyDescriptor,Bk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Xue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Jue(t,n,o),o},LL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Xt=(e,t,n)=>(LL(e,t,"read from private field"),n?n.call(e):t.get(e)),Ni=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ps=(e,t,n,r)=>(LL(e,t,"write to private field"),t.set(e,n),n),qd,Yd,vc,Jd,Im,Xd,Zd,Qd,ef,Am=class{constructor(e){Ni(this,qd,gy()),Ni(this,Yd,[]),Ni(this,vc,new Map),Ni(this,Jd,[]),Ni(this,Im,!1),Ni(this,Xd,void 0),Ni(this,Zd,void 0),Ni(this,Qd,void 0),Ni(this,ef,void 0),this.addListener=(t,n)=>Xt(this,qd).on(t,n),Ps(this,Xd,e),Ps(this,Zd,e.getActive),Ps(this,ef,e.getPosition),Ps(this,Qd,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new Am(e)}static fromPositioner(e,t){return Am.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:Xt(this,Zd),getPosition:Xt(this,ef),hasChanged:this.hasChanged,events:this.events,getID:Xt(this,Qd)}}onActiveChanged(e){this.recentUpdate=e;const t=Xt(this,Zd).call(this,e);Ps(this,Yd,t),Ps(this,vc,new Map),Ps(this,Im,!1),Ps(this,Jd,[]);const n=[];for(const[r,o]of t.entries()){const i=this.getID(o,r);Xt(this,Jd).push(i),n.push({setElement:s=>this.addProps({...e,data:o,element:s},r),id:i,data:o})}Xt(this,qd).emit("update",n)}getID(e,t){var n;return((n=Xt(this,Qd))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(Xt(this,Im)||(Xt(this,vc).set(t,e),Xt(this,vc).size<Xt(this,Yd).length))return;const n=[];for(const r of Xt(this,Yd).keys()){const o=Xt(this,vc).get(r);Pe(o,{code:re.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=Xt(this,Jd)[r];if(!i)return;n.push({position:Xt(this,ef).call(this,o),element:o.element,id:i})}Xt(this,qd).emit("done",n)}clone(e){return Am.create({...Xt(this,Xd),...Pt(e)?e(Xt(this,Xd)):e})}active(e){const t=Pt(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},zo=Am;qd=new WeakMap;Yd=new WeakMap;vc=new WeakMap;Jd=new WeakMap;Im=new WeakMap;Xd=new WeakMap;Zd=new WeakMap;Qd=new WeakMap;ef=new WeakMap;zo.EMPTY=[];function Zue(e,t=BL){const{key:n}=(e==null?void 0:e.getMeta($L))??{};return n===t}function FL(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&Zue(t)?!0:t?Jte(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function zL(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(yi(t)&&o){const u=Number.parseFloat(Cs(t,"padding-left").replace("px","")),d=Number.parseFloat(Cs(t,"padding-right").replace("px","")),h=Number.parseFloat(Cs(t,"padding-top").replace("px","")),p=Number.parseFloat(Cs(t,"padding-bottom").replace("px","")),m=Number.parseFloat(Cs(t,"border-left").replace("px","")),v=Number.parseFloat(Cs(t,"border-right").replace("px","")),x=Number.parseFloat(Cs(t,"border-top").replace("px","")),b=Number.parseFloat(Cs(t,"border-bottom").replace("px","")),w=t.offsetWidth-t.clientWidth,S=t.offsetHeight-t.clientHeight;i+=u+m+(t.dir==="rtl"?w:0),s+=d+v+(t.dir==="rtl"?0:w),a+=h+x,l+=p+b+S}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,d]of[[e.top,e.left],[e.top,e.right],[e.bottom,e.left],[e.bottom,e.right]])if(Y_(u,c.top,c.bottom)&&Y_(d,c.left,c.right))return!0;return!1}var Que="remirror-positioner-widget",$L="positionerUpdate",BL="__all_positioners__",VL={y:-999999,x:-999999,width:0,height:0},TN={...VL,left:-999999,top:-999999,bottom:-999999,right:-999999},ede={...VL,rect:{...TN,toJSON:()=>TN},visible:!1},tde=zo.create({hasChanged:FL,getActive(e){const{state:t}=e;if(!Ck(t)||t.selection.$anchor.depth>2)return zo.EMPTY;const n=Ey({predicate:r=>r.type.isBlock,selection:t});return n?[n]:zo.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!yi(r))return ede;const o=r.getBoundingClientRect(),i=t.dom.getBoundingClientRect(),s=o.height,a=o.width,l=t.dom.scrollLeft+o.left-i.left,c=t.dom.scrollTop+o.top-i.top,u=zL(o,t.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),UL=tde.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&Tk(n.node)&&n.node.type===Py(t.state.schema)?[n]:zo.EMPTY}}));UL.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));UL.clone(({getPosition:e})=>({getPosition:t=>{const{width:n,x:r,y:o,height:i}=e(t);return{...e(t),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function Vk(e){return zo.create({hasChanged:FL,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!Kl(n.selection))return zo.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return zo.EMPTY}},getPosition(t){const{element:n,data:r,view:o}=t,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,s.left),h=Math.min(i.top,s.top),p=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+h-l.top,v=u?1:Math.abs(i.left-s.right),x=new DOMRect(u?s.left:d,h,v,c),b=zL(x,o.dom);return{rect:x,y:m,x:p,height:c,width:v,visible:b}}})}var nde=Vk(e=>!e.selection.empty);Vk(e=>e.selection.empty);Vk(()=>!0);nde.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return zo.EMPTY;const r=ZD(t);if(!r)return zo.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return zo.EMPTY}}}));var kh=class extends Nt{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:e})=>{if(e)return this.positioners=[...this.positioners,e],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(t=>t!==e)}}}get name(){return"positioner"}createAttributes(){return{class:Uue.EDITOR}}init(){this.onScroll=KX(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(e,t)=>(this.positioner(this.getBaseProps("hover",{hover:t})),!1),contextmenu:(e,t)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:t})),!1)}}onStateUpdate(e){this.positioner({...e,previousState:e.firstUpdate?void 0:e.previousState,event:"state",helpers:this.store.helpers})}createDecorations(e){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return it.empty;const t=Ct.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return it.create(e.doc,[t])}forceUpdatePositioners(e=BL){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta($L,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=Que,e.setAttribute("role","presentation"),e}triggerPositioner(e,t){e.hasChanged(t)&&e.onActiveChanged({...t,view:this.store.view})}positioner(e){for(const t of this.positioners)t.events.includes(e.event)&&this.triggerPositioner(t,e)}getBaseProps(e,t){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:e,firstUpdate:!1,previousState:r,state:n,...t}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};Bk([ye()],kh.prototype,"forceUpdatePositioners",1);Bk([zt()],kh.prototype,"getPositionerWidget",1);kh=Bk([ot({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],kh);var rde=Object.defineProperty,ode=Object.getOwnPropertyDescriptor,ide=(e,t,n,r)=>{for(var o=r>1?void 0:r?ode(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&rde(t,n,o),o},Ow=class extends go{get name(){return"text"}createTags(){return[He.InlineNode]}createNodeSpec(){return{}}};Ow=ide([ot({disableExtraAttributes:!0,defaultPriority:ht.Medium})],Ow);var sde={..._u.defaultOptions,...Ll.defaultOptions,...xi.defaultOptions,excludeExtensions:[]};function ade(e={}){e={...sde,...e};const{content:t,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=e,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new xi({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new _u({content:t})),a.text||l.push(new Ow),a.paragraph||l.push(new Ll),a.positioner||l.push(new kh),a.gapCursor||l.push(new Nw),a.events||l.push(new iv),l}var lde=Object.defineProperty,cde=Object.getOwnPropertyDescriptor,ude=(e,t,n,r)=>{for(var o=r>1?void 0:r?cde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&lde(t,n,o),o},Fl=class extends Nt{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:Nk(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>dde({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>fde({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=ir.EditorView&&this.store.updateAttributes()}};Fl=ude([ot({defaultOptions:{emptyNodeClass:zue.IS_EMPTY,placeholder:""}})],Fl);function dde(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:Nk(o.doc)}:t}function fde(e){const{extension:t,state:n}=e,{empty:r}=t.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=t.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=Ct.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),it.create(n.doc,s)}var hde=Object.defineProperty,pde=Object.getOwnPropertyDescriptor,mde=(e,t,n,r)=>{for(var o=r>1?void 0:r?pde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&hde(t,n,o),o},gde={...Fl.defaultOptions,...wh.defaultOptions},vde=[...Fl.staticKeys,...wh.staticKeys],Eh=class extends Nt{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(Fl).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Fl({emptyNodeClass:e,placeholder:t,priority:ht.Low}),new wh({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};Eh=mde([ot({defaultOptions:gde,staticKeys:vde})],Eh);var HL={};Object.defineProperty(HL,"__esModule",{value:!0});function yde(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return MN(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return MN(r,o)},e[0]);return n||null}var Sd=HL.default=yde,ON=new WeakMap;function MN(e,t){if(e&&t){var n=ON.get(e)||new WeakMap;ON.set(e,n);var r=n.get(t)||function(o){jN(e,o),jN(t,o)};return n.set(t,r),r}return e||t}function jN(e,t){typeof e=="function"?e(t):e.current=t}var WL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},m0=(e,t,n)=>(WL(e,t,"read from private field"),t.get(e)),xde=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},bde=(e,t,n,r)=>(WL(e,t,"write to private field"),t.set(e,n),n);function wde(){const[,e]=g.useState(we());return g.useCallback(()=>{e(we())},[])}var KL=g.createContext(null);function Ay(e){const t=g.useContext(KL),n=g.useRef(wde());Pe(t,{code:re.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return g.useEffect(()=>{let o=e;if(o){if(Wl(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(Pt(o))return r("updated",o)}},[r,e]),t}function Sde(e=!0){return Ay({autoUpdate:e}).active}function kde(e=!1){return Ay(e?{autoUpdate:!0}:void 0).attrs}function GL(){return Ay().chain.new()}var[Ede,$me]=boe(({props:e})=>{const t=e.locale??"en",n=e.i18n??jy,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function RN(e,t={}){const{core:n,react:r,...o}=t;return ioe(e)?e:ooe.create(()=>[...k2(e),new Eh(r),...ade(n)],o)}function Cde(e,t={}){const n=g.useRef(e),r=g.useRef(t),[o,i]=g.useState(()=>RN(e,t));return n.current=e,r.current=t,g.useEffect(()=>o.addHandler("destroy",()=>{i(()=>RN(n.current,r.current))}),[o]),o}var _de=typeof Sd=="object"&&Sd.__esModule&&Sd.default?Sd.default:Sd,yc,Pde=class extends Qre{constructor(e){if(super(e),xde(this,yc,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=t=>this.internalGetRootProps(t,null),this.internalGetRootProps=(t,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=t??we();return{[r]:_de(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,Pe(this.rootPropsConfig.count<=1,{code:re.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),bde(this,yc,t),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(Fl).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new vte(null,{state:e,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:e,...t}){const{triggerChange:n=!0,tr:r,transactions:o}=t;if(this.props.state){const{onChange:i}=this.props;Pe(i,{code:re.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),Pe(n,{code:re.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:e,tr:r,transactions:o});return}!r&&!o&&(e=e.apply(e.tr.setMeta(H_,{}))),this.view.updateState(e),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:e,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:e,tr:r,transactions:o})}updateControlledState(e,t){this.previousStateOverride=t,e=e.apply(e.tr.setMeta(H_,{})),this.view.updateState(e),this.manager.onStateUpdate({previousState:this.previousState,state:e}),this.previousStateOverride=void 0}addProsemirrorViewToDom(e,t){this.props.insertPosition==="start"?e.insertBefore(t,e.firstChild):e.append(t)}onRefLoad(){Pe(m0(this,yc),{code:re.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:e}=this.props;this.addProsemirrorViewToDom(m0(this,yc),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&m0(this,yc)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};yc=new WeakMap;var qL=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Nde(e){const t=g.useRef();return qL(()=>{t.current=e}),t.current}function Tde(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;g.useRef(!0).current&&!Ca(r)&&t.getExtension(Eh).setOptions({placeholder:r}),g.useEffect(()=>{r!=null&&t.getExtension(Eh).setOptions({placeholder:r})},[r,t]);const[s]=g.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=on(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=Ode({initialEditorState:s,getProps:()=>e});return g.useEffect(()=>()=>{a.destroy()},[a]),g.useEffect(()=>{a.onUpdate()},[o,a]),Mde(a),a.frameworkOutput}function Ode(e){const t=g.useRef(e);t.current=e;const n=g.useMemo(()=>new Pde(t.current),[]);return n.update(e),n}function Mde(e){const{state:t}=e.props,n=g.useRef(!!t),r=Nde(t);qL(()=>{const o=t?n.current===!0:n.current===!1;Pe(o,{code:re.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!t||t===r)&&e.updateControlledState(t,r??void 0)},[t,r,e])}function jde(e={}){const{content:t,document:n,selection:r,extensions:o,...i}=e,s=Cde(o??(()=>[]),i),[a,l]=g.useState(()=>s.createState({selection:r,content:t??s.createEmptyDoc()})),c=g.useCallback(({state:d})=>{l(d)},[]),u=g.useCallback(()=>s.output,[s]);return g.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var Mw=()=>ke.createElement("div",{className:Pue.EDITOR_WRAPPER,...Ay().getRootProps()}),Rde=e=>(e.hook(),null);function Ide(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=e,l=Tde(a),c=doe(l.portalContainer),u=n==="start"||n===!0||!t&&Ca(n),d=n==="end";return ke.createElement(Ede,{i18n:r,locale:o,supportedLocales:i},ke.createElement(KL.Provider,{value:l},ke.createElement(uoe,{portals:c}),s.map((h,p)=>ke.createElement(Rde,{hook:h,key:p})),u&&ke.createElement(Mw,null),t,d&&ke.createElement(Mw,null)))}function Ade(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return Dde(a,s,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function Dde(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=s.resolve(t.start-2);i=new Rl(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new Rl(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=ck(i,n,r,t);return a?(e&&Lde(e,t,a,o,n),!0):!1}function Lde(e,t,n,r,o){let i=q.empty;for(let u=n.length-1;u>=0;u--)i=q.from(n[u].type.create(n[u].attrs,i));e.step(new Ht(t.start-(r?2:0),t.end,t.start,t.end,new se(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,h=!0;u<d;u++,h=!1)!h&&Gc(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function Fde(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?zde(t,n,e,i):$de(t,n,i):!0:!1}}function zde(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Ht(i-1,s,i,s,new se(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Rl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Yu(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return dp(o.doc,l)&&o.join(l),t(o.scrollIntoView()),!0}function $de(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?q.empty:q.from(o))))return!1;let d=i.pos,h=d+s.nodeSize;return r.step(new Ht(d-(a?1:0),h+(l?1:0),d+1,h-1,new se((a?q.empty:q.from(o.copy(q.empty))).append(l?q.empty:q.from(o.copy(q.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var Bde=Object.defineProperty,Vde=Object.getOwnPropertyDescriptor,vo=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Bde(t,n,o),o};function jw(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListContainerNode))}function Ude(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListItemNode))}function Oa(e){return jw(e.type)}function pa(e){return Ude(e.type)}function Uk(e,t){return n=>{const{dispatch:r,tr:o}=n,i=kk(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Ey({predicate:u=>jw(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return XL(t)(n);if(jw(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):Hde(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return Ade(e)(i,r)}}function YL(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var p,m;const i=nne(e,o.schema),{$from:s,$to:a}=n.selection;if(_y(n.selection)&&n.selection.node.isBlock||s.depth<2||!s.sameParent(a))return!1;const l=s.node(-1);if(l.type!==i)return!1;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==i||s.index(-2)!==s.node(-2).childCount-1)return!1;if(r){const v=s.index(-1)>0;let x=q.empty;for(let S=s.depth-(v?1:2);S>=s.depth-3;S--)x=q.from(s.node(S).copy(x));const b=((p=i.contentMatch.defaultType)==null?void 0:p.createAndFill())||void 0;x=x.append(q.from(i.createAndFill(null,b)||void 0));const w=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;n.replace(s.before(v?void 0:-1),s.after(-w),new se(x,v?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(s.pos+(v?3:2)))),r(n.scrollIntoView())}return!0}if(l.attrs.closed&&s.sameParent(a)&&a.pos===a.end()){if(r){const v=s.after(-1),x=((m=i.contentMatch.defaultType)==null?void 0:m.createAndFill())||void 0,b=i.createAndFill(null,x);b&&(n.insert(v,b),n.setSelection(Le.near(n.doc.resolve(v+1)))),n.delete(s.pos,a.pos),r(n.scrollIntoView())}return!0}const c=Object.fromEntries(Object.entries(l.attrs).filter(([v])=>!t.includes(v))),u=a.pos===s.end()?l.contentMatchAt(0).defaultType:null,d={...s.node().attrs};n.delete(s.pos,a.pos);const h=u?[{type:i,attrs:c},{type:u,attrs:d}]:[{type:i,attrs:c}];return Gc(n.doc,s.pos,2)?(r&&r(n.split(s.pos,2,h).scrollIntoView()),!0):!1}}function Hde(e,t,n,r){const o=t.node,i=e.doc.resolve(t.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,q.from(n.create())))return!1;const l=[];for(let p=0;p<o.childCount;p++){const m=o.child(p);if(!r.validContent(m.content))return!1;const v=r.createChecked(null,m.content);l.push(v)}const c=n.createChecked(null,l),u=t.pos,d=u+o.nodeSize,h=e.selection.from;return e.replaceRangeWith(u,d,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(h))),!0}function Wde({listType:e,itemType:t,tr:n,range:r}){var l;const o=r.parent,i=n.doc.slice(r.start,r.end);if(o.type===e&&((l=i.content.firstChild)==null?void 0:l.type)===t)return!1;const s=[];for(let c=0;c<i.content.childCount;c++){const u=i.content.child(c);if(!t.validContent(u.content))return!1;const d=t.createChecked(null,u.content);s.push(d)}const a=e.createChecked(null,s);return n.replaceRange(r.start,r.end,new se(q.from(a),0,0)),!0}function Pu({listType:e,itemType:t,tr:n}){const r=lv(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return Wde({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(Le.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function Kde(e,t,n){const r=e.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,v=n.endIndex-1,x=n.startIndex;v>x;v--)m-=o.child(v).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?q.empty:q.from(o))))return!1;const h=s.pos,p=h+a.nodeSize;return r.step(new Ht(h-(l?1:0),p+(c?1:0),h+1,p-1,new se((l?q.empty:q.from(o.copy(q.empty))).append(c?q.empty:q.from(o.copy(q.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function JL(e,t){const n=t||e.selection.$from;let r=[],o,i,s,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),o=n.index(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Oa(s)){const u=n.before(c+1);r.push(u)}if(o=n.indexAfter(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Oa(s)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)dp(e.doc,c)&&(e.join(c),l=!0);return l}function XL(e){return t=>{const{dispatch:n,tr:r}=t,o=kk(r,t.state),i=Gde(e,r.selection);return i?(n&&Kde(o,n,i),!0):!1}}function Gde(e,t){const{$from:n,$to:r}=t;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===e})}function lv(e){const{$from:t,$to:n}=e;return t.blockRange(n,Oa)}function qde(e){const t=e.selection.$from,n=t.blockRange();if(!n||!pa(n.parent)||n.startIndex!==0)return!1;const r=t.node(n.depth-2),o=t.index(n.depth),i=t.index(n.depth-1),s=t.index(n.depth-2),a=r.maybeChild(s-1),l=a==null?void 0:a.lastChild;if(o!==0||i!==0)return!1;if(a&&Oa(a)&&l&&pa(l))return Pu({listType:a.type,itemType:l.type,tr:e});if(pa(r)){const c=r,u=t.node(n.depth-3);if(Oa(u))return Pu({listType:u.type,itemType:c.type,tr:e})}return!1}function IN({view:e}){if(!e)return!1;{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!pa(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;qde(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!pa(n.parent)||n.startIndex!==0)return!1;const r=t.index(n.depth),o=t.index(n.depth-1),i=t.index(n.depth-2),s=n.depth-2>=1&&pa(t.node(n.depth-2));r===0&&o===0&&i<=1&&s&&Fde(n.parent.type)(e.state,e.dispatch)}return lL(e.state,e.dispatch,e),!0}function ZL({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(Ta.LIST_ITEM_MARKER_CONTAINER),o.append(t);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(Ta.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==e.type?!1:(e=l,n(e,s),r(e,t),!0);return a(e),{dom:s,contentDOM:i,update:a}}function Yde(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!pa(n)||!Oa(r)?!1:{parentItem:n,parentList:r}}function Jde(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth);return o<i?(e.step(new Ht(o-1,i,o,i,new se(q.from(r.type.create(null,n.copy())),1,0),1,!0)),new Rl(e.doc.resolve(t.$from.pos),e.doc.resolve(i),t.depth)):t}function Xde(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth-1);return o+1<i?(e.step(new Ht(o-1,i,o+1,i,new se(q.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Rl(e.selection.$from,e.selection.$to,t.depth)):t}function Zde(e,t,n,r){return Pu({listType:n.type,itemType:r.type,tr:e})?new Rl(e.selection.$from,e.selection.$to,t.depth):t}function Qde(e){let t=lv(e.selection);if(!t)return!1;const n=Yde(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=Jde(e,t),t=Xde(e,t),t=Zde(e,t,o,r);const i=Yu(t);return typeof i!="number"||(e.lift(t,i),t=lv(e.selection),t&&JL(e,e.doc.resolve(t.end-2))),!0}var efe=({tr:e,dispatch:t})=>Qde(e)?(t==null||t(e.scrollIntoView()),!0):!1;function tfe(e,t,n){let r,o,i,s;const a=t.doc;if(n.startIndex>=1){r=e.child(n.startIndex-1),o=e,s=a.resolve(n.start).start(n.depth),i=s+1;for(let l=0;l<n.startIndex-1;l++)i+=o.child(l).nodeSize}else{const l=t.index(n.depth-1);if(l>=1){const c=t.node(n.depth-1),u=t.start(n.depth-1);if(o=c.child(l-1),!Oa(o))return!1;s=u+1;for(let d=0;d<l-1;d++)s+=c.child(d).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!pa(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function nfe(e,t,n){let r,o;const i=n.start,s=t.depth>=n.depth+2?t.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=e.slice(i,a),o=null):(r=e.slice(i,s),o=e.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function rfe(e){const{$from:t,$to:n}=e.selection,r=lv(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!Oa(o))return!1;const i=tfe(o,t,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=nfe(e.doc,n,r),d=s.content.append(q.fromArray([o.copy(c.content)])).append(u?u.content:q.empty);e.deleteRange(r.start,r.end);const h=l+s.nodeSize-2,p=s.copy(d);return p.check(),e.replaceRangeWith(l-1,h+1,p),e.setSelection(a===o?Le.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):Le.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var ofe=({tr:e,dispatch:t})=>rfe(e)?(t==null||t(e.scrollIntoView()),!0):!1,QL=class extends Nt{get name(){return"listItemShared"}createKeymap(){const e={Tab:ofe,"Shift-Tab":efe,Backspace:IN,"Mod-Backspace":IN};if(Oo.isMac){const t={"Ctrl-h":e.Backspace,"Alt-Backspace":e["Mod-Backspace"]};return{...e,...t}}return e}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr;return JL(r)?r:null}}}},Nu=class extends go{get name(){return"listItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:e.parse,priority:ht.Lowest},...t.parseDOM??[]],toDOM:n=>["li",e.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(e,t,n)=>{const r=document.createElement("div");return r.classList.add(Ta.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=Oe.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),ZL({mark:r,node:e,updateDOM:ife,updateMark:sfe})}:{}}createKeymap(){return{Enter:YL(this.type)}}createExtensions(){return[new QL]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!_y(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return e=YX(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(i,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return XL(e??this.type)}};vo([ye()],Nu.prototype,"toggleListItemClosed",1);vo([ye()],Nu.prototype,"liftListItemOutOfList",1);Nu=vo([ot({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],Nu);function ife(e,t){e.attrs.closed?t.classList.add(Ta.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(Ta.COLLAPSIBLE_LIST_ITEM_CLOSED)}function sfe(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var Ch=class extends go{get name(){return"bulletList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["ul",e.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(e,t,n)=>{var c;const r=document.createElement("div");r.style.position="relative";const o=n(),i=t.state.doc.resolve(o+1),s=i.node(i.depth-1);if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(Ta.LIST_SPINE),u.addEventListener("click",d=>{const h=n(),p=t.state.doc.resolve(h+1),m=p.start(p.depth-1),v=Oe.create(t.state.doc,m-1);t.dispatch(t.state.tr.setSelection(v)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),r.append(u)}const l=document.createElement("ul");return l.classList.add(Ta.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new Nu({priority:ht.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return Uk(this.type,Rt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[hk(e,this.type),new mo(e,(t,n,r,o)=>{const i=t.tr;return i.deleteRange(r,o),Pu({listType:this.type,itemType:Rt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};vo([ye({icon:"listUnordered",label:({t:e})=>e(fk.BULLET_LIST_LABEL)})],Ch.prototype,"toggleBulletList",1);vo([qr({shortcut:oe.BulletList,command:"toggleBulletList"})],Ch.prototype,"listShortcut",1);Ch=vo([ot({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],Ch);var _h=class extends go{get name(){return"orderedList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>yi(n)?{...e.parse(n),order:+(n.getAttribute("start")??1)}:{}},...t.parseDOM??[]],toDOM:n=>{const r=e.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new Nu({priority:ht.Low})]}toggleOrderedList(){return Uk(this.type,Rt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[hk(e,this.type,t=>({order:+Rt(t,1)}),(t,n)=>n.childCount+n.attrs.order===+Rt(t,1)),new mo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Pu({listType:this.type,itemType:Rt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+Rt(n,1);if(a!==1){const l=yh({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};vo([ye({icon:"listOrdered",label:({t:e})=>e(fk.ORDERED_LIST_LABEL)})],_h.prototype,"toggleOrderedList",1);vo([qr({shortcut:oe.OrderedList,command:"toggleOrderedList"})],_h.prototype,"listShortcut",1);_h=vo([ot({})],_h);var e4=class extends go{get name(){return"taskListItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return yi(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...e.parse(n)}},priority:ht.Medium},...t.parseDOM??[]],toDOM:n=>["li",{...e.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(e,t,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(Ta.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{t.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=t.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=e.attrs.checked,ZL({node:e,mark:r,updateDOM:afe,updateMark:lfe})}}createKeymap(){return{Enter:YL(this.type)}}createExtensions(){return[new QL]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const i=yh({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:t??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const e=/^\s*(\[( ?|x|X)]\s)$/;return[hk(e,this.type,t=>({checked:["x","X"].includes(wf(t,2))})),new mo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Pu({listType:Rt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(wf(n,2));if(a){const l=yh({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};vo([ye()],e4.prototype,"toggleCheckboxChecked",1);function afe(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function lfe(e,t){t.checked=!!e.attrs.checked}var t4=class extends go{get name(){return"taskList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"taskListItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:e.parse,priority:ht.Medium},...t.parseDOM??[]],toDOM:n=>["ul",{...e.dom(n),"data-task-list":""},0]}}createExtensions(){return[new e4({})]}toggleTaskList(){return Uk(this.type,Rt(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};vo([ye({icon:"checkboxMultipleLine",label:({t:e})=>e(fk.TASK_LIST_LABEL)})],t4.prototype,"toggleTaskList",1);vo([qr({shortcut:oe.TaskList,command:"toggleTaskList"})],t4.prototype,"listShortcut",1);function cfe(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:h,children:p,...m}=d,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:x,children:p})}function u(d,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,ufe(o,...t)]}function ufe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var g0="rovingFocusGroup.onEntryFocus",dfe={bubbles:!1,cancelable:!0},Dy="RovingFocusGroup",[Rw,n4,ffe]=ty(Dy),[hfe,r4]=cfe(Dy,[ffe]),[pfe,mfe]=hfe(Dy),o4=g.forwardRef((e,t)=>f.jsx(Rw.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Rw.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(gfe,{...e,ref:t})})}));o4.displayName=Dy;var gfe=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=g.useRef(null),p=$e(t,h),m=Qh(i),[v=null,x]=zr({prop:s,defaultProp:a,onChange:l}),[b,w]=g.useState(!1),S=tn(c),C=n4(n),_=g.useRef(!1),[P,O]=g.useState(0);return g.useEffect(()=>{const M=h.current;if(M)return M.addEventListener(g0,S),()=>M.removeEventListener(g0,S)},[S]),f.jsx(pfe,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:v,onItemFocus:g.useCallback(M=>x(M),[x]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>O(M=>M+1),[]),onFocusableItemRemove:g.useCallback(()=>O(M=>M-1),[]),children:f.jsx(Te.div,{tabIndex:b||P===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{_.current=!0}),onFocus:ne(e.onFocus,M=>{const I=!_.current;if(M.target===M.currentTarget&&I&&!b){const L=new CustomEvent(g0,dfe);if(M.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=C().filter(A=>A.focusable),$=U.find(A=>A.active),K=U.find(A=>A.id===v),B=[$,K,...U].filter(Boolean).map(A=>A.ref.current);a4(B,u)}}_.current=!1}),onBlur:ne(e.onBlur,()=>w(!1))})})}),i4="RovingFocusGroupItem",s4=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Ar(),l=i||a,c=mfe(i4,n),u=c.currentTabStopId===l,d=n4(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return g.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),f.jsx(Rw.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(Te.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:ne(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:ne(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:ne(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=xfe(m,c.orientation,c.dir);if(v!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let b=d().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const w=b.indexOf(m.currentTarget);b=c.loop?bfe(b,w+1):b.slice(w+1)}setTimeout(()=>a4(b))}})})})});s4.displayName=i4;var vfe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function yfe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function xfe(e,t,n){const r=yfe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return vfe[r]}function a4(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function bfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wfe=o4,Sfe=s4,Iw=["Enter"," "],kfe=["ArrowDown","PageUp","Home"],l4=["ArrowUp","PageDown","End"],Efe=[...kfe,...l4],Cfe={ltr:[...Iw,"ArrowRight"],rtl:[...Iw,"ArrowLeft"]},_fe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},vp="Menu",[Ph,Pfe,Nfe]=ty(vp),[ql,c4]=ho(vp,[Nfe,wi,r4]),Ly=wi(),u4=r4(),[Tfe,Yl]=ql(vp),[Ofe,yp]=ql(vp),d4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=Ly(t),[l,c]=g.useState(null),u=g.useRef(!1),d=tn(i),h=Qh(o);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),f.jsx(Wh,{...a,children:f.jsx(Tfe,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:f.jsx(Ofe,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};d4.displayName=vp;var Mfe="MenuAnchor",Hk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ly(n);return f.jsx(Au,{...o,...r,ref:t})});Hk.displayName=Mfe;var Wk="MenuPortal",[jfe,f4]=ql(Wk,{forceMount:void 0}),h4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Yl(Wk,t);return f.jsx(jfe,{scope:t,forceMount:n,children:f.jsx(an,{present:n||i.open,children:f.jsx(Du,{asChild:!0,container:o,children:r})})})};h4.displayName=Wk;var so="MenuContent",[Rfe,Kk]=ql(so),p4=g.forwardRef((e,t)=>{const n=f4(so,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Yl(so,e.__scopeMenu),s=yp(so,e.__scopeMenu);return f.jsx(Ph.Provider,{scope:e.__scopeMenu,children:f.jsx(an,{present:r||i.open,children:f.jsx(Ph.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(Ife,{...o,ref:t}):f.jsx(Afe,{...o,ref:t})})})})}),Ife=g.forwardRef((e,t)=>{const n=Yl(so,e.__scopeMenu),r=g.useRef(null),o=$e(t,r);return g.useEffect(()=>{const i=r.current;if(i)return Xv(i)},[]),f.jsx(Gk,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Afe=g.forwardRef((e,t)=>{const n=Yl(so,e.__scopeMenu);return f.jsx(Gk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Gk=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...v}=e,x=Yl(so,n),b=yp(so,n),w=Ly(n),S=u4(n),C=Pfe(n),[_,P]=g.useState(null),O=g.useRef(null),M=$e(t,O,x.onContentChange),I=g.useRef(0),L=g.useRef(""),U=g.useRef(0),$=g.useRef(null),K=g.useRef("right"),W=g.useRef(0),B=m?tp:g.Fragment,A=m?{as:ns,allowPinchZoom:!0}:void 0,R=D=>{var Y,ce;const z=L.current+D,V=C().filter(Ee=>!Ee.disabled),G=document.activeElement,_e=(Y=V.find(Ee=>Ee.ref.current===G))==null?void 0:Y.textValue,Se=V.map(Ee=>Ee.textValue),Be=Gfe(Se,z,_e),Z=(ce=V.find(Ee=>Ee.textValue===Be))==null?void 0:ce.ref.current;(function Ee(fe){L.current=fe,window.clearTimeout(I.current),fe!==""&&(I.current=window.setTimeout(()=>Ee(""),1e3))})(z),Z&&setTimeout(()=>Z.focus())};g.useEffect(()=>()=>window.clearTimeout(I.current),[]),Jv();const N=g.useCallback(D=>{var V,G;return K.current===((V=$.current)==null?void 0:V.side)&&Yfe(D,(G=$.current)==null?void 0:G.area)},[]);return f.jsx(Rfe,{scope:n,searchRef:L,onItemEnter:g.useCallback(D=>{N(D)&&D.preventDefault()},[N]),onItemLeave:g.useCallback(D=>{var z;N(D)||((z=O.current)==null||z.focus(),P(null))},[N]),onTriggerLeave:g.useCallback(D=>{N(D)&&D.preventDefault()},[N]),pointerGraceTimerRef:U,onPointerGraceIntentChange:g.useCallback(D=>{$.current=D},[]),children:f.jsx(B,{...A,children:f.jsx(ep,{asChild:!0,trapped:o,onMountAutoFocus:ne(i,D=>{var z;D.preventDefault(),(z=O.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(Hl,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:f.jsx(wfe,{asChild:!0,...S,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:P,onEntryFocus:ne(l,D=>{b.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Kh,{role:"menu","aria-orientation":"vertical","data-state":O4(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...v,ref:M,style:{outline:"none",...v.style},onKeyDown:ne(v.onKeyDown,D=>{const V=D.target.closest("[data-radix-menu-content]")===D.currentTarget,G=D.ctrlKey||D.altKey||D.metaKey,_e=D.key.length===1;V&&(D.key==="Tab"&&D.preventDefault(),!G&&_e&&R(D.key));const Se=O.current;if(D.target!==Se||!Efe.includes(D.key))return;D.preventDefault();const Z=C().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);l4.includes(D.key)&&Z.reverse(),Wfe(Z)}),onBlur:ne(e.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),L.current="")}),onPointerMove:ne(e.onPointerMove,Nh(D=>{const z=D.target,V=W.current!==D.clientX;if(D.currentTarget.contains(z)&&V){const G=D.clientX>W.current?"right":"left";K.current=G,W.current=D.clientX}}))})})})})})})});p4.displayName=so;var Dfe="MenuGroup",qk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Te.div,{role:"group",...r,ref:t})});qk.displayName=Dfe;var Lfe="MenuLabel",m4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Te.div,{...r,ref:t})});m4.displayName=Lfe;var cv="MenuItem",AN="menu.itemSelect",Fy=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=g.useRef(null),s=yp(cv,e.__scopeMenu),a=Kk(cv,e.__scopeMenu),l=$e(t,i),c=g.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const h=new CustomEvent(AN,{bubbles:!0,cancelable:!0});d.addEventListener(AN,p=>r==null?void 0:r(p),{once:!0}),Mj(d,h),h.defaultPrevented?c.current=!1:s.onClose()}};return f.jsx(g4,{...o,ref:l,disabled:n,onClick:ne(e.onClick,u),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),c.current=!0},onPointerUp:ne(e.onPointerUp,d=>{var h;c.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:ne(e.onKeyDown,d=>{const h=a.searchRef.current!=="";n||h&&d.key===" "||Iw.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Fy.displayName=cv;var g4=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=Kk(cv,n),a=u4(n),l=g.useRef(null),c=$e(t,l),[u,d]=g.useState(!1),[h,p]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[i.children]),f.jsx(Ph.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:f.jsx(Sfe,{asChild:!0,...a,focusable:!r,children:f.jsx(Te.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:ne(e.onPointerMove,Nh(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,Nh(m=>s.onItemLeave(m))),onFocus:ne(e.onFocus,()=>d(!0)),onBlur:ne(e.onBlur,()=>d(!1))})})})}),Ffe="MenuCheckboxItem",v4=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.jsx(S4,{scope:e.__scopeMenu,checked:n,children:f.jsx(Fy,{role:"menuitemcheckbox","aria-checked":uv(n)?"mixed":n,...o,ref:t,"data-state":Jk(n),onSelect:ne(o.onSelect,()=>r==null?void 0:r(uv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});v4.displayName=Ffe;var y4="MenuRadioGroup",[zfe,$fe]=ql(y4,{value:void 0,onValueChange:()=>{}}),x4=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=tn(r);return f.jsx(zfe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(qk,{...o,ref:t})})});x4.displayName=y4;var b4="MenuRadioItem",w4=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=$fe(b4,e.__scopeMenu),i=n===o.value;return f.jsx(S4,{scope:e.__scopeMenu,checked:i,children:f.jsx(Fy,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Jk(i),onSelect:ne(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});w4.displayName=b4;var Yk="MenuItemIndicator",[S4,Bfe]=ql(Yk,{checked:!1}),k4=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Bfe(Yk,n);return f.jsx(an,{present:r||uv(i.checked)||i.checked===!0,children:f.jsx(Te.span,{...o,ref:t,"data-state":Jk(i.checked)})})});k4.displayName=Yk;var Vfe="MenuSeparator",E4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});E4.displayName=Vfe;var Ufe="MenuArrow",C4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ly(n);return f.jsx(Gh,{...o,...r,ref:t})});C4.displayName=Ufe;var Hfe="MenuSub",[Bme,_4]=ql(Hfe),tf="MenuSubTrigger",P4=g.forwardRef((e,t)=>{const n=Yl(tf,e.__scopeMenu),r=yp(tf,e.__scopeMenu),o=_4(tf,e.__scopeMenu),i=Kk(tf,e.__scopeMenu),s=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),f.jsx(Hk,{asChild:!0,...c,children:f.jsx(g4,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":O4(n.open),...e,ref:Fv(t,o.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,Nh(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:ne(e.onPointerLeave,Nh(d=>{var p,m;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const v=(m=n.content)==null?void 0:m.dataset.side,x=v==="right",b=x?-5:5,w=h[x?"left":"right"],S=h[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+b,y:d.clientY},{x:w,y:h.top},{x:S,y:h.top},{x:S,y:h.bottom},{x:w,y:h.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,d=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&d.key===" "||Cfe[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});P4.displayName=tf;var N4="MenuSubContent",T4=g.forwardRef((e,t)=>{const n=f4(so,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Yl(so,e.__scopeMenu),s=yp(so,e.__scopeMenu),a=_4(N4,e.__scopeMenu),l=g.useRef(null),c=$e(t,l);return f.jsx(Ph.Provider,{scope:e.__scopeMenu,children:f.jsx(an,{present:r||i.open,children:f.jsx(Ph.Slot,{scope:e.__scopeMenu,children:f.jsx(Gk,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ne(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:ne(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),h=_fe[s.dir].includes(u.key);d&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});T4.displayName=N4;function O4(e){return e?"open":"closed"}function uv(e){return e==="indeterminate"}function Jk(e){return uv(e)?"indeterminate":e?"checked":"unchecked"}function Wfe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Kfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Gfe(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Kfe(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function qfe(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function Yfe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return qfe(n,t)}function Nh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Jfe=d4,Xfe=Hk,Zfe=h4,Qfe=p4,ehe=qk,the=m4,nhe=Fy,rhe=v4,ohe=x4,ihe=w4,she=k4,ahe=E4,lhe=C4,che=P4,uhe=T4,Xk="DropdownMenu",[dhe,Vme]=ho(Xk,[c4]),or=c4(),[fhe,M4]=dhe(Xk),j4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=or(t),c=g.useRef(null),[u=!1,d]=zr({prop:o,defaultProp:i,onChange:s});return f.jsx(fhe,{scope:t,triggerId:Ar(),triggerRef:c,contentId:Ar(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(h=>!h),[d]),modal:a,children:f.jsx(Jfe,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};j4.displayName=Xk;var R4="DropdownMenuTrigger",I4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=M4(R4,n),s=or(n);return f.jsx(Xfe,{asChild:!0,...s,children:f.jsx(Te.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Fv(t,i.triggerRef),onPointerDown:ne(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:ne(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});I4.displayName=R4;var hhe="DropdownMenuPortal",A4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=or(t);return f.jsx(Zfe,{...r,...n})};A4.displayName=hhe;var D4="DropdownMenuContent",L4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=M4(D4,n),i=or(n),s=g.useRef(!1);return f.jsx(Qfe,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});L4.displayName=D4;var phe="DropdownMenuGroup",mhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ehe,{...o,...r,ref:t})});mhe.displayName=phe;var ghe="DropdownMenuLabel",F4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(the,{...o,...r,ref:t})});F4.displayName=ghe;var vhe="DropdownMenuItem",z4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(nhe,{...o,...r,ref:t})});z4.displayName=vhe;var yhe="DropdownMenuCheckboxItem",$4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(rhe,{...o,...r,ref:t})});$4.displayName=yhe;var xhe="DropdownMenuRadioGroup",bhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ohe,{...o,...r,ref:t})});bhe.displayName=xhe;var whe="DropdownMenuRadioItem",B4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ihe,{...o,...r,ref:t})});B4.displayName=whe;var She="DropdownMenuItemIndicator",V4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(she,{...o,...r,ref:t})});V4.displayName=She;var khe="DropdownMenuSeparator",U4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ahe,{...o,...r,ref:t})});U4.displayName=khe;var Ehe="DropdownMenuArrow",Che=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(lhe,{...o,...r,ref:t})});Che.displayName=Ehe;var _he="DropdownMenuSubTrigger",H4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(che,{...o,...r,ref:t})});H4.displayName=_he;var Phe="DropdownMenuSubContent",W4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(uhe,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});W4.displayName=Phe;var Nhe=j4,The=I4,Ohe=A4,K4=L4,G4=F4,q4=z4,Y4=$4,J4=B4,X4=V4,Z4=U4,Q4=H4,e3=W4;const Mhe=Nhe,jhe=The,Rhe=g.forwardRef(({className:e,inset:t,children:n,...r},o)=>f.jsxs(Q4,{ref:o,className:ze("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-bg-brand-primary_alt data-[state=open]:bg-bg-brand-primary",t&&"pl-8",e),...r,children:[n,f.jsx(Gv,{className:"w-4 h-4 ml-auto"})]}));Rhe.displayName=Q4.displayName;const Ihe=g.forwardRef(({className:e,...t},n)=>f.jsx(e3,{ref:n,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Ihe.displayName=e3.displayName;const t3=g.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>f.jsx(Ohe,{container:n,children:f.jsx(K4,{ref:o,sideOffset:t,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));t3.displayName=K4.displayName;const Rs=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(q4,{ref:r,className:ze("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-bg-brand-solid focus:text-text-brand-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Rs.displayName=q4.displayName;const Ahe=g.forwardRef(({className:e,children:t,checked:n,...r},o)=>f.jsxs(Y4,{ref:o,className:ze("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(X4,{children:f.jsx(Bu,{className:"w-4 h-4"})})}),t]}));Ahe.displayName=Y4.displayName;const Dhe=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(J4,{ref:r,className:ze("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(X4,{children:f.jsx(b7,{className:"w-2 h-2 fill-current"})})}),t]}));Dhe.displayName=J4.displayName;const Lhe=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(G4,{ref:r,className:ze("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Lhe.displayName=G4.displayName;const Fhe=g.forwardRef(({className:e,...t},n)=>f.jsx(Z4,{ref:n,className:ze("-mx-1 my-1 h-px bg-muted",e),...t}));Fhe.displayName=Z4.displayName;var zhe=Object.defineProperty,$he=Object.getOwnPropertyDescriptor,xp=(e,t,n,r)=>{for(var o=r>1?void 0:r?$he(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&zhe(t,n,o),o},Bhe={icon:"bold",label:({t:e})=>e(pP.LABEL),description:({t:e})=>e(pP.DESCRIPTION)},zl=class extends mp{get name(){return"bold"}createTags(){return[He.FormattingMark,He.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>yi(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>Ae(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...t.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",e.dom(n),0]}}}createInputRules(){return[tv({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return bh({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=uo(e??t.selection,t.doc);return n==null||n(t.addMark(r,o,this.type.create())),!0}}removeBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=uo(e??t.selection,t.doc);return t.doc.rangeHasMark(r,o,this.type)?(n==null||n(t.removeMark(r,o,this.type)),!0):!1}}shortcut(e){return this.toggleBold()(e)}};xp([ye(Bhe)],zl.prototype,"toggleBold",1);xp([ye()],zl.prototype,"setBold",1);xp([ye()],zl.prototype,"removeBold",1);xp([qr({shortcut:oe.Bold,command:"toggleBold"})],zl.prototype,"shortcut",1);zl=xp([ot({defaultOptions:{weight:void 0},staticKeys:["weight"]})],zl);var Vhe=Object.defineProperty,Uhe=Object.getOwnPropertyDescriptor,Zk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Uhe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Vhe(t,n,o),o},Hhe={icon:"italic",label:({t:e})=>e(mP.LABEL),description:({t:e})=>e(mP.DESCRIPTION)},Th=class extends mp{get name(){return"italic"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"i",getAttrs:e.parse},{tag:"em",getAttrs:e.parse},{style:"font-style=italic"},...t.parseDOM??[]],toDOM:n=>["em",e.dom(n),0]}}createKeymap(){return{"Mod-i":bh({type:this.type})}}createInputRules(){return[tv({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),tv({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(e){return bh({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};Zk([ye(Hhe)],Th.prototype,"toggleItalic",1);Zk([qr({shortcut:oe.Italic,command:"toggleItalic"})],Th.prototype,"shortcut",1);Th=Zk([ot({})],Th);var Whe=Object.defineProperty,Khe=Object.getOwnPropertyDescriptor,Qk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Khe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Whe(t,n,o),o},Ghe={icon:"strikethrough",label:({t:e})=>e(gP.LABEL),description:({t:e})=>e(gP.DESCRIPTION)},Oh=class extends mp{get name(){return"strike"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"s",getAttrs:e.parse},{tag:"del",getAttrs:e.parse},{tag:"strike",getAttrs:e.parse},{style:"text-decoration",getAttrs:n=>n==="line-through"?{}:!1},...t.parseDOM??[]],toDOM:n=>["s",e.dom(n),0]}}toggleStrike(){return bh({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[tv({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};Qk([ye(Ghe)],Oh.prototype,"toggleStrike",1);Qk([qr({shortcut:oe.Strike,command:"toggleStrike"})],Oh.prototype,"shortcut",1);Oh=Qk([ot({})],Oh);var qhe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="rotate(90)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',Yhe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="matrix(0 1 1 0 0 0)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',Jhe=encodeURIComponent(qhe),Xhe=encodeURIComponent(Yhe),Gn,VN,Zhe=(VN=class{constructor(e){$t(this,"dom");Rn(this,Gn);$t(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,Xe(this,Gn,n),this.type=e,this.createHandle(e)}createHandle(e){switch(Ln(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),Ln(ue(this,Gn),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),ue(this,Gn).dataset.dragging="",e){case 0:Ln(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Ln(ue(this,Gn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 1:Ln(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Ln(ue(this,Gn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 2:Ln(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),Ln(ue(this,Gn),{width:" 42px",height:"4px",boxSizing:"content-box",maxWidth:"50%",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 3:Ln(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),Ln(ue(this,Gn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Xhe}") `});break;case 4:Ln(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),Ln(ue(this,Gn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Jhe}") `});break}this.dom.append(ue(this,Gn))}setHandleVisibility(e){const t=e||!!ue(this,Gn).dataset.dragging;ue(this,Gn).style.opacity=t?"1":"0"}dataSetDragging(e){ue(this,Gn).dataset.dragging=e?"true":""}},Gn=new WeakMap,VN),tm=50,n3=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(n3||{}),Us,Hs,Ws,ni,Ks,UN,Qhe=(UN=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){$t(this,"dom");Rn(this,Us);Rn(this,Hs);Rn(this,Ws,[]);$t(this,"aspectRatio");Rn(this,ni);Rn(this,Ks);const s=this.createWrapper(e,i),a=this.createElement({node:e,view:t,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(h=>new Zhe(h));for(const h of c){const p=m=>{this.startResizing(m,t,n,h)};h.dom.addEventListener("mousedown",p),ue(this,Ws).push(()=>h.dom.removeEventListener("mousedown",p)),s.append(h.dom)}const u=()=>{c.forEach(h=>h.setHandleVisibility(!0))},d=()=>{c.forEach(h=>h.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",d),ue(this,Ws).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",d)),s.append(a),this.dom=s,Xe(this,Hs,e),Xe(this,Us,a),this.aspectRatio=r}createWrapper(e,t){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",t?Ln(n,{width:DN(t.width),aspectRatio:`${t.width} / ${t.height}`}):Ln(n,{width:DN(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),Ln(n,{maxWidth:"100%",minWidth:`${tm}px`,verticalAlign:"bottom",display:"inline-block",lineHeight:"0",transition:"width 0.15s ease-out, height 0.15s ease-out"}),n}startResizing(e,t,n,r){var u,d;e.preventDefault(),r.dataSetDragging(!0),ue(this,Us).style.pointerEvents="none";const o=e.pageX,i=e.pageY,s=((u=ue(this,Us))==null?void 0:u.getBoundingClientRect().width)||0,a=((d=ue(this,Us))==null?void 0:d.getBoundingClientRect().height)||0,l=Jb(100,!1,h=>{const p=h.pageX,m=h.pageY,v=p-o,x=m-i;let b=null,w=null;if(this.aspectRatio===0&&s&&a)switch(r.type){case 0:case 3:b=s+v,w=a/s*b;break;case 1:case 4:b=s-v,w=a/s*b;break;case 2:w=a+x,b=s/a*w;break}else if(this.aspectRatio===1)switch(r.type){case 0:b=s+v;break;case 1:b=s-v;break;case 2:w=a+x;break;case 3:b=s+v,w=a+x;break;case 4:b=s-v,w=a+x;break}typeof b=="number"&&b<tm&&(this.aspectRatio===0&&s&&a?(b=tm,w=a/s*b):this.aspectRatio===1&&(b=tm)),b&&(Xe(this,ni,Math.round(b)),this.dom.style.width=`${ue(this,ni)}px`),w&&Xe(this,Ks,Math.round(w)),(b||w)&&(this.dom.style.aspectRatio=`${ue(this,ni)} / ${ue(this,Ks)}`)}),c=h=>{h.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),ue(this,Us).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const p=n(),m=t.state.tr.setNodeMarkup(p,void 0,{...ue(this,Hs).attrs,width:ue(this,ni),height:ue(this,Ks)});t.dispatch(m)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),ue(this,Ws).push(()=>document.removeEventListener("mousemove",l)),ue(this,Ws).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==ue(this,Hs).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==ue(this,ni)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==ue(this,ni)&&e.attrs.height!==ue(this,Ks)||!epe(ue(this,Hs),e,["width","height"])?!1:(Xe(this,Hs,e),Xe(this,ni,e.attrs.width),Xe(this,Ks,e.attrs.height),!0)}destroy(){ue(this,Ws).forEach(e=>e())}},Us=new WeakMap,Hs=new WeakMap,Ws=new WeakMap,ni=new WeakMap,Ks=new WeakMap,UN);function epe(e,t,n){return e===t||tpe(e,t,n)&&e.content.eq(t.content)}function tpe(e,t,n){const r=e.attrs,o=t.attrs,i={};for(const a of n)i[a]=null;e.attrs={...r,...i},t.attrs={...o,...i};const s=e.sameMarkup(t);return e.attrs=r,t.attrs=o,s}function DN(e){return typeof e=="number"?`${e}px`:e||void 0}var npe=Object.defineProperty,rpe=Object.getOwnPropertyDescriptor,eE=(e,t,n,r)=>{for(var o=r>1?void 0:r?rpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&npe(t,n,o),o},ope=class extends Qhe{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:n3.Fixed})}createElement({node:e}){const t=document.createElement("img");return t.setAttribute("src",e.attrs.src),Ln(t,{width:"100%",minWidth:"50px",objectFit:"contain"}),t}},Mh=class extends go{get name(){return"image"}createTags(){return[He.InlineNode,He.Media]}createNodeSpec(e,t){const{preferPastedTextContent:n}=this.options;return{inline:!0,draggable:!0,selectable:!1,...t,attrs:{...e.defaults(),alt:{default:""},crop:{default:null},height:{default:null},width:{default:null},rotate:{default:null},src:{default:null},title:{default:""},fileName:{default:null},resizable:{default:!1}},parseDOM:[{tag:"img[src]",getAttrs:r=>{var o;if(yi(r)){const i=spe({element:r,parse:e.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=tL(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:i}=uo(t??n.selection,n.doc),s=this.type.create(e);return r==null||r(n.replaceRangeWith(o,i,s)),!0}}uploadImage(e,t){const{updatePlaceholder:n,destroyPlaceholder:r,createPlaceholder:o}=this.options;return i=>{const{tr:s}=i;let a=s.selection.from;return this.store.createPlaceholderCommand({promise:e,placeholder:{type:"widget",get pos(){return a},createElement:(l,c)=>{const u=o(l,c);return t==null||t(u),u},onUpdate:(l,c,u,d)=>{n(l,c,u,d)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=J2(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(i)}}fileUploadFileHandler(e,t,n){var c;const{preferPastedTextContent:r,uploadHandler:o}=this.options;if(r&&cpe(t)&&((c=t.clipboardData)!=null&&c.getData("text/plain")))return!1;const{commands:i,chain:s}=this.store,a=e.map((u,d)=>({file:u,progress:h=>{i.updatePlaceholder(l[d],h)}})),l=o(a);Br(n)&&s.selectText(n);for(const u of l)s.uploadImage(u);return s.run(),!0}createPasteRules(){return[{type:"file",regexp:/image/i,fileHandler:e=>{const t=e.type==="drop"?e.pos:void 0;return this.fileUploadFileHandler(e.files,e.event,t)}}]}createNodeViews(){return this.options.enableResizing?(e,t,n)=>new ope(e,t,n):{}}};eE([ye()],Mh.prototype,"insertImage",1);eE([ye()],Mh.prototype,"uploadImage",1);Mh=eE([ot({defaultOptions:{createPlaceholder:ape,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:lpe,enableResizing:!1,preferPastedTextContent:!0}})],Mh);function ipe(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function spe({element:e,parse:t}){const{width:n,height:r}=ipe(e);return{...t(e),alt:e.getAttribute("alt")??"",height:Number.parseInt(r||"0",10)||null,src:e.getAttribute("src")??null,title:e.getAttribute("title")??"",width:Number.parseInt(n||"0",10)||null,fileName:e.getAttribute("data-file-name")??null}}function ape(e,t){const n=document.createElement("div");return n.classList.add(Tue.IMAGE_LOADER),n}function lpe(e){Pe(e.length>0,{code:re.EXTENSION,message:"The upload handler was applied for the image extension without any valid files"});let t=0;const n=[];for(const{file:r,progress:o}of e)n.push(()=>new Promise(i=>{const s=new FileReader;s.addEventListener("load",a=>{var l;t+=1,o(t/e.length),i({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),s.readAsDataURL(r)}));return n}function cpe(e){return e.clipboardData!==void 0}function upe(e={}){return new fs({view(t){return new dpe(t,e)}})}class dpe{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r;if(n){let a=t.nodeBefore,l=t.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=X2(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}}var fpe=Object.defineProperty,hpe=Object.getOwnPropertyDescriptor,ppe=(e,t,n,r)=>{for(var o=r>1?void 0:r?hpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&fpe(t,n,o),o},Aw=class extends Nt{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[upe({color:e,width:t})]}};Aw=ppe([ot({defaultOptions:{color:"black",width:1}})],Aw);var mpe=Object.defineProperty,gpe=Object.getOwnPropertyDescriptor,r3=(e,t,n,r)=>{for(var o=r>1?void 0:r?gpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&mpe(t,n,o),o},{LABEL:vpe}=xQ,ype={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({...vpe,values:{level:t==null?void 0:t.level}})},xpe=[oe.H1,oe.H2,oe.H3,oe.H4,oe.H5,oe.H6],dv=class extends go{get name(){return"heading"}createTags(){return[He.Block,He.TextBlock,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),level:{default:this.options.defaultLevel}},parseDOM:[...this.options.levels.map(n=>({tag:`h${n}`,getAttrs:r=>({...e.parse(r),level:n})})),...t.parseDOM??[]],toDOM:n=>this.options.levels.includes(n.attrs.level)?[`h${n.attrs.level}`,e.dom(n),0]:[`h${this.options.defaultLevel}`,e.dom(n),0]}}toggleHeading(e={}){return oL({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension(Ge),n=we(),r=[];for(const o of this.options.levels){const i=xpe[o-1]??oe.H1;n[i]=ev(this.type,{level:o}),r.push({attrs:{level:o},shortcut:e(i)[0]})}return t.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(e=>zQ(new RegExp(`^(#{1,${e}})\\s$`),this.type,()=>({level:e})))}createPasteRules(){return this.options.levels.map(e=>({type:"node",nodeType:this.type,regexp:new RegExp(`^#{${e}}\\s([\\s\\w]+)$`),getAttributes:()=>({level:e}),startOfTextBlock:!0}))}};r3([ye(ype)],dv.prototype,"toggleHeading",1);dv=r3([ot({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],dv);var o3={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:X3,function(){return function(n){function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var o={};return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)}([function(n,r,o){function i(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function s(c){typeof c!="string"&&i();for(var u=0,d=0,h=0,p=c.length,m=0;p--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,d=m);for(u=m,m=d;m--;)if(l.indexOf(c[m])!==-1){h=m+1;break}return 2>h?"":c.slice(h,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],d,h=0;for(d=c.length;h<d;h++)u.push(s(c[h]));return u}i()}}])})})(o3);var bpe=o3.exports;const wpe=Ma(bpe);var Spe=Object.defineProperty,kpe=Object.getOwnPropertyDescriptor,bp=(e,t,n,r)=>{for(var o=r>1?void 0:r?kpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Spe(t,n,o),o},Epe=["com","de","net","org","uk","cn","ga","nl","cf","ml","tk","ru","br","gq","xyz","fr","eu","info","co","au","ca","it","in","ch","pl","es","online","us","top","be","jp","biz","se","at","dk","cz","za","me","ir","icu","shop","kr","site","mx","hu","io","cc","club","no","cyou"],LN="updateLink",Cpe=/(?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)*(?:(?:\d(?!\.)|[a-z\u00A1-\uFFFF])(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)+[a-z\u00A1-\uFFFF]{2,}(?::\d{2,5})?(?:[#/?]\S*)?/gi,$l=class extends mp{constructor(){super(...arguments);$t(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[He.Link,He.ExcludeInputRules]}createMarkSpec(t,n){const r="data-link-auto",o=i=>{const{defaultTarget:s,supportedTargets:a}=this.options,l=s?[...a,s]:a;return i&&Go(l,i)?{target:i}:void 0};return{inclusive:!1,excludes:"_",...n,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:i=>{if(!yi(i))return!1;const s=i.getAttribute("href"),a=i.textContent,l=this.options.autoLink&&(i.hasAttribute(r)||s===a||(s==null?void 0:s.replace(`${this.options.defaultProtocol}//`,""))===a);return{...t.parse(i),href:s,auto:l,...o(i.getAttribute("target"))}}},...n.parseDOM??[]],toDOM:i=>{const{auto:s,target:a,...l}=tL(i.attrs,t),c=i.attrs.auto?{[r]:""}:{};return["a",{...t.dom(i),...l,rel:"noopener noreferrer nofollow",...c,...o(i.attrs.target)},0]}}}onCreate(){const{autoLinkRegex:t}=this.options;this._autoLinkRegexNonGlobal=new RegExp(`^${t.source}$`,t.flags.replace("g",""))}shortcut({tr:t}){let n="",{from:r,to:o,empty:i,$from:s}=t.selection,a=!1;const l=ls(s,this.type);if(i){const c=l??ZD(t);if(!c)return!1;({text:n,from:r,to:o}=c),a=!0}return r===o?!1:(a||(n=t.doc.textBetween(r,o)),this.options.onActivateLink(n),this.options.onShortcut({activeLink:l?{attrs:l.mark.attrs,from:l.from,to:l.to}:void 0,selectedText:n,from:r,to:o}),!0)}updateLink(t,n){return r=>{const{tr:o}=r;return!(Kl(o.selection)&&!Ck(o.selection)||sne(o.selection)||Qg({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:LN,attrs:t,range:n}),_ne({type:this.type,attrs:t,range:n})(r))}}selectLink(){return this.store.commands.selectMark.original(this.type)}removeLink(t){return n=>{const{tr:r}=n;return Qg({trState:r,type:this.type,...t})?sL({type:this.type,expand:!0,range:t})(n):!1}}createPasteRules(){return[{type:"mark",regexp:this.options.autoLinkRegex,markType:this.type,getAttributes:(t,n)=>({href:this.buildHref(wf(t)),auto:!n}),transformMatch:t=>{const n=wf(t);return!n||!this.isValidUrl(n)?!1:n}}]}createEventHandlers(){return{clickMark:(t,n)=>{const r=n.getMark(this.type);if(!r)return;const o=r.mark.attrs,i={...o,...r};if(this.options.onClick(t,i))return!0;if(!this.store.view.editable)return;let s=!1;if(this.options.openLinkOnClick){s=!0;const a=o.href;window.open(a,"_blank")}return this.options.selectTextOnClick&&(s=!0,this.store.commands.selectText(r)),s}}}createPlugin(){return{appendTransaction:(t,n,r)=>{if(t.filter(m=>!!m.getMeta(this.name)).forEach(m=>{const v=m.getMeta(this.name);if(v.command===LN){const{range:x,attrs:b}=v,{selection:w,doc:S}=r,C={range:x,selection:w,doc:S,attrs:b},{from:_,to:P}=x??w;this.options.onUpdateLink(S.textBetween(_,P),C)}}),!this.options.autoLink||Tw(n)-Tw(r)===1||!t.some(m=>m.docChanged))return;const a=Gte(t,n),l=dne(a,[Ht,hn]),{mapping:c}=a,{tr:u,doc:d}=r,{updateLink:h,removeLink:p}=this.store.chain(u);if(l.forEach(({prevFrom:m,prevTo:v,from:x,to:b})=>{const w=[],S=b-x===2,C=this.getLinkMarksInRange(n.doc,m,v,!0).filter(_=>_.mark.type===this.type).map(({from:_,to:P,text:O})=>({mappedFrom:c.map(_),mappedTo:c.map(P),text:O,from:_,to:P}));C.forEach(({mappedFrom:_,mappedTo:P,from:O,to:M},I)=>this.getLinkMarksInRange(d,_,P,!0).filter(L=>L.mark.type===this.type).forEach(L=>{const U=n.doc.textBetween(O,M,void 0," "),$=d.textBetween(L.from,L.to+1,void 0," ").trim(),K=this.isValidUrl(U);this.isValidUrl($)||(K&&(p({from:L.from,to:L.to}).tr(),C.splice(I,1)),!S&&x===b&&this.findAutoLinks($).map(B=>this.addLinkProperties({...B,from:_+B.start,to:_+B.end})).forEach(({attrs:B,range:A,text:R})=>{h(B,A).tr(),w.push({attrs:B,range:A,text:R})}))})),this.findTextBlocksInRange(d,{from:x,to:b}).forEach(({text:_,positionStart:P})=>{this.findAutoLinks(_).map(O=>this.addLinkProperties({...O,from:P+O.start+1,to:P+O.end+1})).filter(({range:O})=>{const M=x>=O.from&&x<=O.to,I=b>=O.from&&b<=O.to;return M||I||S}).filter(({range:O})=>this.getLinkMarksInRange(u.doc,O.from,O.to,!1).length===0).filter(({range:{from:O},text:M})=>!C.some(({text:I,mappedFrom:L})=>L===O&&I===M)).forEach(({attrs:O,text:M,range:I})=>{h(O,I).tr(),w.push({attrs:O,range:I,text:M})})}),window.requestAnimationFrame(()=>{w.forEach(({attrs:_,range:P,text:O})=>{const{doc:M,selection:I}=u;this.options.onUpdateLink(O,{attrs:_,doc:M,range:P,selection:I})})})}),u.steps.length!==0)return u}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,n,r,o){const i=[];if(n===r){const s=Math.max(n-1,0),a=t.resolve(s),l=ls(a,this.type);(l==null?void 0:l.mark.attrs.auto)===o&&i.push(l)}else t.nodesBetween(n,r,(s,a)=>{const c=(s.marks??[]).find(({type:u,attrs:d})=>u===this.type&&d.auto===o);c&&i.push({from:a,to:a+s.nodeSize,mark:c,text:s.textContent})});return i}findTextBlocksInRange(t,n){const r=[];return t.nodesBetween(n.from,n.to,(o,i)=>{!o.isTextblock||!o.type.allowsMarkType(this.type)||r.push({node:o,pos:i})}),r.map(o=>({text:t.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," "),positionStart:o.pos}))}addLinkProperties({from:t,to:n,href:r,...o}){return{...o,range:{from:t,to:n},attrs:{href:r,auto:!0}}}findAutoLinks(t){if(this.options.findAutoLinks)return this.options.findAutoLinks(t,this.options.defaultProtocol);const n=[];for(const r of xy(t,this.options.autoLinkRegex)){const o=wf(r);if(!o)continue;const i=this.buildHref(o);!this.isValidTLD(i)&&!i.startsWith("tel:")||n.push({text:o,href:i,start:r.index,end:r.index+o.length})}return n}isValidUrl(t){var n;return this.options.isValidUrl?this.options.isValidUrl(t,this.options.defaultProtocol):this.isValidTLD(this.buildHref(t))&&!!((n=this._autoLinkRegexNonGlobal)!=null&&n.test(t))}isValidTLD(t){const{autoLinkAllowedTLDs:n}=this.options;if(n.length===0)return!0;const r=wpe(t);if(r==="")return!0;const o=oZ(r.split("."));return n.includes(o)}};bp([qr({shortcut:oe.InsertLink})],$l.prototype,"shortcut",1);bp([ye()],$l.prototype,"updateLink",1);bp([ye()],$l.prototype,"selectLink",1);bp([ye()],$l.prototype,"removeLink",1);$l=bp([ot({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:Cpe,autoLinkAllowedTLDs:Epe,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:_pe},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:ht.Medium})],$l);function _pe({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var Ppe=Object.defineProperty,Npe=Object.getOwnPropertyDescriptor,i3=(e,t,n,r)=>{for(var o=r>1?void 0:r?Npe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ppe(t,n,o),o},fv=class extends go{get name(){return"hardBreak"}createTags(){return[He.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
|
|
489
|
-
`,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=Kte(bf(dL),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":e,"Shift-Enter":e}}insertHardBreak(){return e=>{const{tr:t,dispatch:n}=e;return n==null||n(t.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};i3([ye()],fv.prototype,"insertHardBreak",1);fv=i3([ot({defaultPriority:ht.Low})],fv);const Tpe=()=>[new zl({}),new Th,new Oh,new Mh({enableResizing:!1}),new Aw({}),new dv({levels:[1,2,3,4,5,6],defaultLevel:1}),new Ch({}),new _h,new $l({autoLink:!0}),new fv].slice();function Ope(e){const{manager:t,state:n,setState:r}=jde({extensions:Tpe,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function Mpe({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,disabled:a,autoFocus:l}){const c=r&&Object.entries(r).some(([,p])=>p),[u,d]=g.useState(c),h=g.useMemo(()=>[ve("p-4 outline-none focus:outline-none appearance-none bg-bg-primary rounded-b-md")],[u]);return f.jsx("div",{autoFocus:l,onFocus:()=>{i&&i(!0)},onBlur:()=>{i&&i(!1)},className:ve("relative text-base m-1 val-rich-text-editor focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 border border-input rounded-md"),children:f.jsxs(Ide,{manager:n,initialContent:e,state:t,classNames:h,onChange:o,editable:!a,children:[f.jsx(jpe,{hasOptions:c,options:r,debug:s,setShowToolbar:d}),f.jsx(Mw,{})]})})}const jpe=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,d,h,p,m,v,x,b,w,S,C,_,P,O,M,I,L,U,$,K,W,B,A,R,N,D;const o=GL(),i=Sde(),s=t||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();g.useEffect(()=>{r(s)},[s]);const a=g.useRef(null);return f.jsxs("div",{children:[f.jsx("div",{className:"h-0",ref:a}),f.jsxs("div",{className:ve("sticky top-0 flex flex-col py-2 z-[40] divide-y rounded-md rounded-b-none border-b border-input bg-primary-foreground",{hidden:!s}),children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[(((l=e==null?void 0:e.block)==null?void 0:l.h1)||((c=e==null?void 0:e.block)==null?void 0:c.h2)||((u=e==null?void 0:e.block)==null?void 0:u.h3)||((d=e==null?void 0:e.block)==null?void 0:d.h4)||((h=e==null?void 0:e.block)==null?void 0:h.h5)||((p=e==null?void 0:e.block)==null?void 0:p.h6)||i.heading())&&f.jsxs(Mhe,{children:[f.jsx(jhe,{asChild:!0,className:"pr-4",children:f.jsxs("button",{children:[i.heading({level:1})&&f.jsx(r_,{size:22}),i.heading({level:2})&&f.jsx(o_,{size:22}),i.heading({level:3})&&f.jsx(i_,{size:22}),i.heading({level:4})&&f.jsx(s_,{size:22}),i.heading({level:5})&&f.jsx(a_,{size:22}),i.heading({level:6})&&f.jsx(l_,{size:22}),!i.heading()&&"Normal"]})}),f.jsxs(t3,{container:a.current,children:[f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:f.jsx(r_,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:f.jsx(o_,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h3)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:f.jsx(i_,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h4)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:f.jsx(s_,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:f.jsx(a_,{size:16})}),((S=e==null?void 0:e.block)==null?void 0:S.h6)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:f.jsx(l_,{size:16})})]})]}),(((C=e==null?void 0:e.style)==null?void 0:C.bold)||i.bold())&&f.jsx(cc,{icon:f.jsx(g7,{size:18}),stroke:3,isOption:(_=e==null?void 0:e.style)==null?void 0:_.bold,isActive:((P=e==null?void 0:e.style)==null?void 0:P.bold)||i.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((O=e==null?void 0:e.style)==null?void 0:O.lineThrough)||i.strike())&&f.jsx(cc,{icon:f.jsx(U7,{size:18}),stroke:3,isOption:(M=e==null?void 0:e.style)==null?void 0:M.lineThrough,isActive:((I=e==null?void 0:e.style)==null?void 0:I.lineThrough)||i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((L=e==null?void 0:e.style)==null?void 0:L.italic)||i.italic())&&f.jsx(cc,{icon:f.jsx(_7,{size:18}),stroke:3,isOption:(U=e==null?void 0:e.style)==null?void 0:U.italic,isActive:(($=e==null?void 0:e.style)==null?void 0:$.italic)||i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((K=e==null?void 0:e.block)==null?void 0:K.ul)||i.bulletList())&&f.jsx(cc,{icon:f.jsx(NR,{size:18}),stroke:3,isActive:((W=e==null?void 0:e.block)==null?void 0:W.ul)||i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((B=e==null?void 0:e.block)==null?void 0:B.ol)||i.orderedList())&&f.jsx(cc,{icon:f.jsx(O7,{size:18}),stroke:3,isActive:((A=e==null?void 0:e.block)==null?void 0:A.ol)||i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((R=e==null?void 0:e.inline)==null?void 0:R.a)||i.link())&&f.jsx(cc,{icon:f.jsx(T7,{size:18}),stroke:3,isActive:((N=e==null?void 0:e.inline)==null?void 0:N.a)||i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((D=e==null?void 0:e.inline)==null?void 0:D.img)||i.image())&&f.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[f.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:z=>{o2(z).then(V=>{o.insertImage({src:V.src,width:V.width,height:V.height,fileName:X.createFilename(V.src,V.filename??null,{width:V.width,height:V.height,mimeType:V.mimeType},V.fileHash)??void 0}).focus().run(),z.target.value=""})}}),f.jsx(PR,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&f.jsx("button",{onMouseDown:z=>z.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),f.jsx(Rpe,{})]})]})};function Rpe(){const e=GL(),[t,n]=g.useState(),r=kde().link();return g.useEffect(()=>{const i=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(i)},[r==null?void 0:r.href]),r!==void 0?f.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[f.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:t,placeholder:"https://"}),f.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:f.jsx(Bu,{size:14})}),f.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:f.jsx(X7,{size:13})})]}):null}function cc({stroke:e,isActive:t,onToggle:n,icon:r}){return f.jsx("button",{className:ve({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function Ipe({path:e,autoFocus:t}){const n="richtext",r=Fu(),o=Dt(e),i=at(e,n),s=vS(),a=yS(),l="data"in i?i.data:void 0,{manager:c}=Ope(l&&zp(l)),u=g.useRef(!1),{patchPath:d,addPatch:h,addAndUploadPatchWithFileOps:p}=On(e),[m,v]=g.useState(c.createState({content:l&&zp(l)})),x="data"in i&&i.data,b="clientSideOnly"in i&&i.clientSideOnly;g.useEffect(()=>{b===!1&&v(C=>{try{const _=x?zp(x):void 0,P=c.createState({content:_,selection:C.selection});return P.doc.eq(C.doc)?C:P}catch(_){return console.error("Error (re)creating editor state with selection, retrying without...",_),c.createState({content:x?zp(x):void 0})}})},[x,b]);const w=g.useMemo(()=>{var _,P;if(!("data"in o&&o.data.type==="richtext"))return null;const C=o.data;return typeof((P=(_=C.options)==null?void 0:_.inline)==null?void 0:P.img)=="object"&&C.options.inline.img.remote&&s.status==="ready"&&(r!=null&&r.remoteHost)&&a?{publicProjectId:s.publicProjectId,bucket:a,coreVersion:s.coreVersion,schema:C.options.inline.img,remoteHost:r==null?void 0:r.remoteHost}:null},[o,s,r,a]);if(o.status==="error")return f.jsx(Jt,{path:e,error:o.error,type:n});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:n});if(i.status=="not-found"||o.status==="not-found")return f.jsx(Pn,{path:e,type:n});if(o.status==="loading")return f.jsx(gt,{path:e,type:n});if(!("data"in i)||i.data===void 0)return f.jsx(gt,{path:e,type:n});if(o.data.type!==n)return f.jsx(vr,{path:e,expectedType:n,actualType:o.data.type});const S=o.data;return r!=null&&r.remoteHost||console.warn("RichTextField: config.remoteHost is not set. Remote images will not work."),f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(Mpe,{autoFocus:t,disabled:u.current,state:m,options:S.options,manager:c,onChange:async C=>{var P;const _=m==null?void 0:m.doc;if(!u.current&&(v(C.state),_&&!C.state.doc.eq(_))){const O=Ape(d,((P=r==null?void 0:r.files)==null?void 0:P.directory)??"/public/val",C.state.doc.toJSON(),w);O.some(M=>M.op==="file")?(u.current=!0,await p(O,"image",M=>{alert("Error uploading image. Please try again later."),console.error("Error uploading image",M)},(M,I,L,U)=>{console.log(`Uploading ${M}/${I} (${L}/${U})`)}).finally(()=>{u.current=!1})):h(O,"richtext")}}})]})}function Ape(e,t,n,r){const{blocks:o,files:i}=n?gU(n,t,r):{blocks:[],files:{}};return[{op:"replace",path:e,value:o},...Object.values(i).flatMap(({value:s,filePathOrRef:a,metadata:l,patchPaths:c})=>c.map(u=>({op:"file",path:e,filePath:a,value:s,metadata:l,nestedFilePath:u,remote:!!r})))]}function Dpe({path:e}){const t=at(e,"richtext");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"richtext"});if(t.status=="not-found")return f.jsx(Pn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=Lpe(t.data);return n.status==="error"?f.jsx(nt,{path:e,error:n.error,type:"richtext"}):f.jsx("div",{className:"truncate",children:n.value})}function Lpe(e){let t;function n(o){if(t)return t;if(typeof o=="string")return o;if(typeof o=="object"&&o){if("children"in o&&Array.isArray(o.children))return o.children.map(n).join(" ");if("tag"in o&&typeof o.tag=="string")return""}return t="Invalid richtext node: "+JSON.stringify(o),JSON.stringify(o)}const r=e.map(n).join(" ");return t?{status:"error",error:t}:{status:"ok",value:r}}function tE({path:e}){const t=Dt(e),n=at(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return f.jsx(gr,{path:e});if(r==="string")return f.jsx(tJ,{path:e});if(r==="array")return f.jsx(Hpe,{path:e});if(r==="boolean")return f.jsx(oJ,{path:e});if(r==="number")return f.jsx(sJ,{path:e});if(r==="union")return f.jsx(QJ,{path:e});if(r==="object")return f.jsx(qJ,{path:e});if(r==="image")return f.jsx(aX,{path:e});if(r==="keyOf")return f.jsx(uX,{path:e});if(r==="date")return f.jsx(fX,{path:e});if(r==="literal")return f.jsx(hX,{path:e});if(r==="record")return f.jsx(yX,{path:e});if(r==="richtext")return f.jsx(Dpe,{path:e});if(r==="file")return f.jsx(oX,{path:e});{const o=r;return f.jsxs("div",{children:["Cannot preview: ",o]})}}function mr({path:e}){return f.jsx("div",{id:e,children:f.jsx(co,{size:12,className:"animate-spin"})},e+"-loading")}function gr({path:e}){return f.jsx("div",{id:e,className:"text-text-quartenary",children:"null"},e+"-null")}function Fpe({source:e,preview:t,path:n,schema:r,disabled:o,onClick:i,onMove:s,onDelete:a}){const[l,c]=g.useState([]);g.useEffect(()=>{const h=[];let p=1;for(const m of e)h.push({path:m,id:p}),p++;c(h)},[e,n]);const u=Oq(Wx(lA),Wx(cA),Wx(JS,{coordinateGetter:QY})),d=g.useCallback(h=>{const{active:p,over:m}=h;if((p==null?void 0:p.id)!==(m==null?void 0:m.id)){const v=l.findIndex(b=>b.id===Number(p==null?void 0:p.id)),x=l.findIndex(b=>b.id===Number(m==null?void 0:m.id));c(b=>ZS(b,v,x)),s(v,x)}},[l]);return f.jsx(OY,{sensors:u,collisionDetection:jq,onDragEnd:d,children:f.jsx(UY,{items:l,strategy:BY,disabled:o,children:f.jsx("div",{className:"flex flex-col w-full gap-y-4",children:l.map(({path:h,id:p})=>f.jsx(zpe,{id:p,schema:r,disabled:o,previewLayout:t==null?void 0:t.layout,preview:t==null?void 0:t.items[p-1],path:h,onClick:i,onDelete:m=>{a(m-1)}},p))})})})}const FN=170;function zpe({id:e,path:t,schema:n,disabled:r,preview:o,onClick:i,onDelete:s}){var w,S;const a=g.useRef(null),[l,c]=g.useState(!1);g.useEffect(()=>{a.current&&(a.current.getBoundingClientRect().height>=FN?c(!0):c(!1))},[e,t]);const{attributes:u,listeners:d,setNodeRef:h,transform:p,transition:m}=JY({id:e,disabled:r===!0}),v=Da()||{},x={transform:lh.Transform.toString(p),transition:m},b=!0;return f.jsxs("div",{"touch-action":"manipulation",ref:h,style:x,className:ve("flex disabled:opacity-55 flex-1",{"items-start":!b,"items-center":b}),children:[f.jsx("button",{...u,...d,className:ve("pt-2 my-1",{"opacity-30":r}),disabled:r,onClick:()=>{i(t)},children:f.jsx(E7,{})}),f.jsx("button",{className:"pt-2 my-1 mr-2 -ml-1 font-serif text-accent",disabled:r,onClick:()=>{i(t)},children:Vpe(e)}),!o&&((w=n==null?void 0:n.item)==null?void 0:w.type)==="string"&&f.jsx("div",{className:"flex-grow w-full",children:f.jsx(xA,{path:t})}),(o||((S=n==null?void 0:n.item)==null?void 0:S.type)!=="string")&&f.jsxs("button",{className:ve("flex-grow","relative flex text-left border rounded-lg border-border bg-card gap-y-2 bg-bg-primary","hover:bg-bg-secondary_subtle"),style:{maxHeight:FN},ref:a,disabled:r,onClick:()=>{i(t)},children:[o&&f.jsx($pe,{...o}),!o&&f.jsx("div",{className:"flex-grow w-full p-4",children:f.jsx(tE,{path:t})}),l&&f.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-b via-50% from-transparent via-card/90 to-card",style:{height:40}})]}),f.jsxs("button",{className:ve("flex gap-x-2",{"items-start pt-4":!b,"items-center":b}),onClick:()=>{s(e)},children:[a2(t,v)?f.jsx(l2,{}):f.jsx("div",{className:"w-2 h-2"}),f.jsx(G7,{className:"w-4 h-4 mr-2"})]})]})}function $pe({title:e,image:t,subtitle:n}){return f.jsxs("div",{className:ve("flex w-full items-center justify-between pl-4 flex-grow"),children:[f.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[f.jsx("div",{className:"text-lg font-medium",children:e}),n&&f.jsx("div",{className:"flex-shrink block overflow-hidden text-sm text-gray-500 text-ellipsis max-h-5",children:n})]}),t&&f.jsx(Bpe,{src:t,alt:e})]})}function Bpe({src:e,alt:t}){var i;const[n,r]=g.useState(!1);if(e==null)return f.jsx("div",{className:"flex-shrink-0 w-20 h-20 ml-4 opacity-25 bg-bg-brand-secondary"});const o=X.convertFileSource(e).url;return f.jsxs("div",{className:"relative flex-shrink-0 w-20 h-20 ml-4",children:[!n&&f.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),f.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(i=e.metadata)!=null&&i.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function Vpe(e){return(e-1).toString()}function Upe({path:e}){const t="array",{navigate:n}=Mn(),r=Dt(e),o=xR(e),i=at(e,t),{addPatch:s,patchPath:a}=On(e);if(r.status==="error")return f.jsx(Jt,{path:e,error:r.error,type:t});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:t});if(i.status=="not-found"||r.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(r.status==="loading")return f.jsx(gt,{path:e,type:t});if(r.data.type!=="array")return f.jsx(vr,{path:e,expectedType:"array",actualType:r.data.type});const l=r.data,c=o&&"data"in o?o.data:void 0,u=c&&(i.status==="success"&&i.clientSideOnly||i.status==="loading");return f.jsxs("div",{id:e,className:"relative w-full",children:[f.jsx($r,{path:e}),(o==null?void 0:o.status)==="error"&&f.jsx(c2,{error:o.message,path:e}),u&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-bg-disabled z-[40] opacity-40",children:f.jsx(co,{className:"animate-spin"})}),f.jsx(Fpe,{path:e,disabled:u,onClick:d=>{n(d)},onDelete:async d=>{s([{op:"remove",path:a.concat(d.toString())}],l.type)},onMove:async(d,h)=>{s([{op:"move",from:a.concat(d.toString()),path:a.concat(h.toString())}],l.type)},schema:l,preview:(c==null?void 0:c.layout)==="list"&&c.parent==="array"?c:void 0,source:i.data||[]})]})}function Hpe({path:e}){const t=at(e,"array");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"array"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{children:`${t.data.length} items`})}function zy({path:e,schema:t,autoFocus:n}){if(t.type==="string")return f.jsx(xA,{path:e,autoFocus:n},e);if(t.type==="number")return f.jsx(iJ,{path:e},e);if(t.type==="boolean")return f.jsx(nJ,{path:e},e);if(t.type==="image")return f.jsx(iX,{path:e},e);if(t.type==="object")return f.jsx(GJ,{path:e},e);if(t.type==="array")return f.jsx(Upe,{path:e},e);if(t.type==="record")return f.jsx(pX,{path:e},e);if(t.type==="union")return f.jsx(JJ,{path:e},e);if(t.type==="keyOf")return f.jsx(lX,{path:e},e);if(t.type==="richtext")return f.jsx(Ipe,{path:e,autoFocus:n},e);if(t.type==="date")return f.jsx(dX,{path:e},e);if(t.type==="file")return f.jsx(rX,{path:e},e);if(t.type==="literal")return f.jsx(Jt,{path:e,error:"Literal fields are not editable"});{const r=t;return f.jsx(Jt,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function Wpe({path:e}){const t=Dt(e),{path:n,schema:r}=XA(e),{navigate:o}=Mn(),i=SS(),s=Xh(),a=g.useCallback(p=>{if("data"in s){const m=s.data,v=HI(p,i,m);v?o(v):(o(p),console.error(`Error navigating to path: ${p} - no schemas found`))}else console.warn("Schemas not loaded yet"),o(p)},[s,i,o]);if(t.status==="error")return f.jsx(Jt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return f.jsx(gt,{path:e,type:"module"});if(t.status==="not-found")return f.jsx(Pn,{path:e,type:"module"});const l=t.data,c=e2(e),u=c.slice(0,-1),d=c[c.length-1],h=DJ(e,n,r);return f.jsxs("div",{className:"flex flex-col gap-6 pt-4 pb-40",children:[f.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[c.length>1&&f.jsx("div",{className:"inline-flex items-center text-sm text-text-quartenary",children:u.map((p,m)=>m<u.length-1?f.jsxs(g.Fragment,{children:[f.jsx("button",{onClick:()=>{a(p.sourcePath)},children:p.text}),f.jsx("span",{children:f.jsx(Gv,{size:16})})]},m):f.jsx("button",{onClick:()=>{a(p.sourcePath)},children:p.text},m))}),f.jsx("div",{children:f.jsxs("div",{className:"flex items-center justify-between h-6 gap-4 text-xl",children:[!h&&f.jsx("span",{children:d.text}),h&&f.jsxs("span",{children:["#",Number(d.text)]}),f.jsx(QA,{path:e,variant:"module"})]})})]}),f.jsx(zy,{path:e,schema:l},e)]})}function Kpe(){const e=YW(),t=l7();return f.jsxs(f.Fragment,{children:[f.jsx(Gpe,{}),f.jsxs(Io,{viewportId:"val-content-area",children:[t!==null&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"w-full h-16"}),f.jsxs("div",{className:"absolute w-full h-16 top-0 p-4 text-center text-white bg-bg-error-primary z-[50]",children:[t.type==="network-error"&&"Network error - retrying...",t.type==="remote-files-error"&&t.error]})]}),f.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[800px] px-4 mx-auto",children:e==="service-unavailable"?f.jsxs("div",{className:"p-8 mt-20 text-center text-text-error-primary bg-bg-error-primary",children:[f.jsx("p",{children:"Could not connect to the content service."}),f.jsx("p",{children:"Please try again later"})]}):f.jsx(qpe,{})})]})]})}function Gpe(){const{navMenu:e,toolsMenu:t}=$y();return f.jsxs("div",{className:"flex items-center justify-between w-full h-16 px-4 border-b border-border-primary",children:[f.jsx("button",{className:ve({"ml-[calc(320px+0.5rem)] xl:ml-0":e.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>e.setOpen(!e.isOpen),children:f.jsx(Eg,{size:16,className:ve("transform",{"rotate-180":!e.isOpen})})}),f.jsx("button",{className:ve({"mr-[calc(320px+0.5rem)] xl:mr-0":t.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>t.setOpen(!t.isOpen),children:f.jsx(Eg,{size:16,className:ve("transform",{"rotate-180":t.isOpen})})})]})}function qpe(){const{currentSourcePath:e}=Mn(),t=e;return f.jsx(Wpe,{path:t})}var nE="Dialog",[s3,Ume]=ho(nE),[Ype,Jo]=s3(nE),a3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=g.useRef(null),l=g.useRef(null),[c=!1,u]=zr({prop:r,defaultProp:o,onChange:i});return f.jsx(Ype,{scope:t,triggerRef:a,contentRef:l,contentId:Ar(),titleId:Ar(),descriptionId:Ar(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};a3.displayName=nE;var l3="DialogTrigger",Jpe=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(l3,n),i=$e(t,o.triggerRef);return f.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":sE(o.open),...r,ref:i,onClick:ne(e.onClick,o.onOpenToggle)})});Jpe.displayName=l3;var rE="DialogPortal",[Xpe,c3]=s3(rE,{forceMount:void 0}),u3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Jo(rE,t);return f.jsx(Xpe,{scope:t,forceMount:n,children:g.Children.map(r,s=>f.jsx(an,{present:n||i.open,children:f.jsx(Du,{asChild:!0,container:o,children:s})}))})};u3.displayName=rE;var hv="DialogOverlay",d3=g.forwardRef((e,t)=>{const n=c3(hv,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Jo(hv,e.__scopeDialog);return i.modal?f.jsx(an,{present:r||i.open,children:f.jsx(Zpe,{...o,ref:t})}):null});d3.displayName=hv;var Zpe=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(hv,n);return f.jsx(tp,{as:ns,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(Te.div,{"data-state":sE(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Bl="DialogContent",f3=g.forwardRef((e,t)=>{const n=c3(Bl,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Jo(Bl,e.__scopeDialog);return f.jsx(an,{present:r||i.open,children:i.modal?f.jsx(Qpe,{...o,ref:t}):f.jsx(eme,{...o,ref:t})})});f3.displayName=Bl;var Qpe=g.forwardRef((e,t)=>{const n=Jo(Bl,e.__scopeDialog),r=g.useRef(null),o=$e(t,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return Xv(i)},[]),f.jsx(h3,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,i=>i.preventDefault())})}),eme=g.forwardRef((e,t)=>{const n=Jo(Bl,e.__scopeDialog),r=g.useRef(!1),o=g.useRef(!1);return f.jsx(h3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),h3=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=Jo(Bl,n),l=g.useRef(null),c=$e(t,l);return Jv(),f.jsxs(f.Fragment,{children:[f.jsx(ep,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx(Hl,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":sE(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(tme,{titleId:a.titleId}),f.jsx(rme,{contentRef:l,descriptionId:a.descriptionId})]})]})}),oE="DialogTitle",iE=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(oE,n);return f.jsx(Te.h2,{id:o.titleId,...r,ref:t})});iE.displayName=oE;var p3="DialogDescription",m3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(p3,n);return f.jsx(Te.p,{id:o.descriptionId,...r,ref:t})});m3.displayName=p3;var g3="DialogClose",v3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(g3,n);return f.jsx(Te.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});v3.displayName=g3;function sE(e){return e?"open":"closed"}var y3="DialogTitleWarning",[Hme,x3]=b9(y3,{contentName:Bl,titleName:oE,docsSlug:"dialog"}),tme=({titleId:e})=>{const t=x3(y3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
486
|
+
`,Js)}getHTML(e=this.store.getState()){return Sne(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};me([zt()],fo.prototype,"isSelectionEmpty",1);me([zt()],fo.prototype,"isViewEditable",1);me([zt()],fo.prototype,"getStateJSON",1);me([zt()],fo.prototype,"getJSON",1);me([zt()],fo.prototype,"getRemirrorJSON",1);me([ye()],fo.prototype,"insertHtml",1);me([zt()],fo.prototype,"getText",1);me([zt()],fo.prototype,"getTextBetween",1);me([zt()],fo.prototype,"getHTML",1);fo=me([ot({})],fo);var xw=class extends Nt{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var e,t;const n=[],r=this.store.markTags[He.ExcludeInputRules];for(const o of this.store.extensions)if(!((e=this.store.managerSettings.exclude)!=null&&e.inputRules||!o.createInputRules||(t=o.options.exclude)!=null&&t.inputRules))for(const i of o.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return LQ({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};xw=me([ot({defaultPriority:ht.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],xw);var Mo=class extends Nt{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:e})=>{var t,n;if(e)return this.extraKeyBindings=[...this.extraKeyBindings,e],(n=(t=this.store).rebuildKeymap)==null||n.call(t),()=>{var r,o;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==e),(o=(r=this.store).rebuildKeymap)==null||o.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:e}=this.options;return De(e)?Lre[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new fs({props:{handleKeyDown:(t,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,t,n)}}})])}setupKeydownHandler(){const e=this.generateKeymapBindings();this.keydownHandler=mL(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension(Ge),o=a=>l=>km({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((e=a.options.exclude)!=null&&e.keymap)){a.createKeymap&&t.push(Are(a.createKeymap(o(a)),n));for(const[c,u]of rn(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),h=km({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),p=Pt(u.priority)?u.priority(a.options,this.store):u.priority??ht.Low,m=we();for(const v of h)m[v]=d;t.push([p,m]),u.command&&r.updateDecorated(u.command,{shortcut:h})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...t]);return Qte(i)}arrowRightShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return Zg(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return Zg(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=we();if(!n)for(const[o,i]of rn(c0))r[o]=bf(i);return t&&c0.Backspace&&(r.Backspace=bf(Ty(FQ,c0.Backspace))),e&&(r.Escape=bf(Wne)),[ht.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?km({shortcut:e,map:this.shortcutMap,store:this.store,options:t}):[e]}onSetOptions(e){var t,n;const{changes:r}=e;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(t=this.store).rebuildKeymap)==null||n.call(t))}sortKeymaps(e){return jl(e.map(t=>on(t)?t:[ht.Default,t]),(t,n)=>n[0]-t[0]).map(t=>t[1])}exitMarkForwards(e,t){return n=>{const{tr:r,dispatch:o}=n;if(!Cne(r.selection)||yh({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(_a(a))return!1;if(!o)return!0;for(const l of a)r.removeStoredMark(l);return o(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(e,t=!1){return n=>{const{tr:r}=n;if(!(t?aN:gw)(r.selection))return!1;const i=r.selection.$anchor.node();return!Tk(i)||cne(i)||e.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(e,t,n=!1){return r=>{const{tr:o,dispatch:i}=r;if(!(n?aN:gw)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(yh({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(_a(l))return!1;if(!i)return!0;for(const c of l)o.removeStoredMark(c);return this.backwardMarkExitTracker.set(o.selection.anchor,!0),i(o),!0}}};me([qr({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],Mo.prototype,"arrowRightShortcut",1);me([qr({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],Mo.prototype,"arrowLeftShortcut",1);me([qr({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],Mo.prototype,"backspace",1);me([zt()],Mo.prototype,"getNamedShortcut",1);Mo=me([ot({defaultPriority:ht.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],Mo);function Ire(e){return Go(vy(oe),e)}function km({shortcut:e,map:t,options:n,store:r}){return De(e)?[bw(e,t)]:on(e)?e.map(o=>bw(o,t)):(e=e(n,r),km({shortcut:e,map:t,options:n,store:r}))}function bw(e,t){return Ire(e)?t[e]:e}function Are(e,t){const n={};let r,o;on(e)?[o,r]=e:r=e;for(const[i,s]of rn(r))n[bw(i,t)]=s;return yy(o)?n:[o,n]}var bL={[oe.Copy]:"Mod-c",[oe.Cut]:"Mod-x",[oe.Paste]:"Mod-v",[oe.PastePlain]:"Mod-Shift-v",[oe.SelectAll]:"Mod-a",[oe.Undo]:"Mod-z",[oe.Redo]:Oo.isMac?"Shift-Mod-z":"Mod-y",[oe.Bold]:"Mod-b",[oe.Italic]:"Mod-i",[oe.Underline]:"Mod-u",[oe.Strike]:"Mod-d",[oe.Code]:"Mod-`",[oe.Paragraph]:"Mod-Shift-0",[oe.H1]:"Mod-Shift-1",[oe.H2]:"Mod-Shift-2",[oe.H3]:"Mod-Shift-3",[oe.H4]:"Mod-Shift-4",[oe.H5]:"Mod-Shift-5",[oe.H6]:"Mod-Shift-6",[oe.TaskList]:"Mod-Shift-7",[oe.BulletList]:"Mod-Shift-8",[oe.OrderedList]:"Mod-Shift-9",[oe.Quote]:"Mod->",[oe.Divider]:"Mod-Shift-|",[oe.Codeblock]:"Mod-Shift-~",[oe.ClearFormatting]:"Mod-Shift-C",[oe.Superscript]:"Mod-.",[oe.Subscript]:"Mod-,",[oe.LeftAlignment]:"Mod-Shift-L",[oe.CenterAlignment]:"Mod-Shift-E",[oe.RightAlignment]:"Mod-Shift-R",[oe.JustifyAlignment]:"Mod-Shift-J",[oe.InsertLink]:"Mod-k",[oe.Find]:"Mod-f",[oe.FindBackwards]:"Mod-Shift-f",[oe.FindReplace]:"Mod-Shift-H",[oe.AddFootnote]:"Mod-Alt-f",[oe.AddComment]:"Mod-Alt-m",[oe.ContextMenu]:"Mod-Shift-\\",[oe.IncreaseFontSize]:"Mod-Shift-.",[oe.DecreaseFontSize]:"Mod-Shift-,",[oe.IncreaseIndent]:"Tab",[oe.DecreaseIndent]:"Shift-Tab",[oe.Shortcuts]:"Mod-/",[oe.Format]:Oo.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},Dre={...bL,[oe.Strike]:"Mod-Shift-S",[oe.Code]:"Mod-Shift-M",[oe.Paragraph]:"Mod-Alt-0",[oe.H1]:"Mod-Alt-1",[oe.H2]:"Mod-Alt-2",[oe.H3]:"Mod-Alt-3",[oe.H4]:"Mod-Alt-4",[oe.H5]:"Mod-Alt-5",[oe.H6]:"Mod-Alt-6",[oe.OrderedList]:"Mod-Alt-7",[oe.BulletList]:"Mod-Alt-8",[oe.Quote]:"Mod-Alt-9",[oe.ClearFormatting]:"Mod-\\",[oe.IncreaseIndent]:"Mod-[",[oe.DecreaseIndent]:"Mod-]"},Lre={default:bL,googleDoc:Dre},Fre=class extends Nt{get name(){return"nodeViews"}createPlugin(){const e=[],t=we();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(Pt(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},zre=class extends Nt{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.pasteRules||!r.createPasteRules||(t=r.options.exclude)!=null&&t.pasteRules)continue;const o=r.createPasteRules(),i=on(o)?o:[o];n.push(...i)}return ire(n)}},ww=class extends Nt{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=we(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return Pe(t,{message:"No plugin exists for the requested extension name."}),t()}}get name(){return"plugins"}onCreate(){const{setStoreKey:e,setExtensionStore:t,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:o=[]}=n;this.updatePlugins(o,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=o,this.store.setStoreKey("plugins",this.plugins),e("pluginKeys",this.pluginKeys),e("getPluginState",this.getStateByName),t("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr,o={previousState:t,tr:r,transactions:e,state:n};for(const i of this.appendTransactionHandlers)i(o);return this.options.appendTransaction(o),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(e,t)=>{for(const n of this.initStateHandlers)n(t)},apply:(e,t,n,r)=>{const o={previousState:n,state:r,tr:e};for(const i of this.applyStateHandlers)i(o);this.options.applyState(o)}}}}extractExtensionPlugins(e){var t,n;if(!(!e.createPlugin&&!e.createExternalPlugins||(t=this.store.managerSettings.exclude)!=null&&t.plugins||(n=e.options.exclude)!=null&&n.plugins)){if(e.createPlugin){const o=new Ju(e.name);this.pluginKeys[e.name]=o;const i=this.getPluginStateCreator(o);e.pluginKey=o,e.getPluginState=i,this.stateGetters.set(e.name,i),this.stateGetters.set(e.constructor,i);const s={...e.createPlugin(),key:o},a=new fs(s);this.updatePlugins([a],e.plugin?[e.plugin]:void 0),e.plugin=a}if(e.createExternalPlugins){const o=e.createExternalPlugins();this.updatePlugins(o,e.externalPlugins),e.externalPlugins=o}}}updatePlugins(e,t){if(!t||_a(t)){this.plugins=[...this.plugins,...e];return}if(e.length!==t.length){this.plugins=[...this.plugins.filter(r=>!t.includes(r)),...e];return}const n=new Map;for(const[r,o]of e.entries())n.set(Rt(t,r),o);this.plugins=this.plugins.map(r=>t.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:e}=this.store;e("updatePlugins",this.updatePlugins.bind(this)),e("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),e("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(e){const t=yL(e)?e:Ere(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);Pe(t,{code:re.INVALID_MANAGER_EXTENSION,message:`The extension ${e} does not exist within the editor.`}),this.extractExtensionPlugins(t),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){Pe(this.store.phase>=ir.EditorView,{code:re.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:e,updateState:t}=this.store,n=e.state.reconfigure({plugins:this.plugins});t(n)}};ww=me([ot({defaultPriority:ht.Highest,handlerKeys:["applyState","appendTransaction"]})],ww);var Sw=class extends Nt{constructor(){super(...arguments),this.dynamicAttributes={marks:we(),nodes:we()}}get name(){return"schema"}onCreate(){const{managerSettings:e,tags:t,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:i,disableExtraAttributes:s,nodeOverride:a,markOverride:l}=e,c=m=>!!(m&&t[He.Block].includes(m));if(e.schema){const{nodes:m,marks:v}=Gre(e.schema);this.addSchema(e.schema,m,v);return}const u=c(i)?{doc:we(),[i]:we()}:we(),d=we(),h=$re({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const m of o){h[m.name]={...h[m.name],...m.options.extraAttributes};const v=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(gp(m)){const{spec:x,dynamic:b}=fN({createExtensionSpec:(w,S)=>m.createNodeSpec(w,S),extraAttributes:Rt(h,m.name),override:{...a,...m.options.nodeOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags});m.spec=x,u[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.nodes[m.name]=b)}if(My(m)){const{spec:x,dynamic:b}=fN({createExtensionSpec:(w,S)=>m.createMarkSpec(w,S),extraAttributes:Rt(h,m.name),override:{...l,...m.options.markOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags??[]});m.spec=x,d[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.marks[m.name]=b)}}const p=new PZ({nodes:u,marks:d,topNode:"doc"});this.addSchema(p,u,d)}createPlugin(){return{appendTransaction:(e,t,n)=>{const{tr:r}=n;return!e.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,s)=>(this.checkAndUpdateDynamicNodes(i,s,r),this.checkAndUpdateDynamicMarks(i,s,r),!0)),r.steps.length>0?r:null)}}}addSchema(e,t,n){this.store.setStoreKey("nodes",t),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",e),this.store.setExtensionStore("schema",e),this.store.setStoreKey("defaultBlockNode",Py(e).name);for(const r of Object.values(e.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(e,t,n){for(const[r,o]of rn(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[i,s]of rn(o)){if(!Ca(e.attrs[i]))continue;const a={...e.attrs,[i]:s(e)};n.setNodeMarkup(t,void 0,a),rN(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of rn(this.dynamicAttributes.marks)){const i=Rt(this.store.schema.marks,r),s=e.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of rn(o)){if(!Ca(s.attrs[a]))continue;const c=ls(n.doc.resolve(t),i);if(!c)continue;const{from:u,to:d}=c,h=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,d,i).addMark(u,d,h),rN(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};Sw=me([ot({defaultPriority:ht.Highest})],Sw);function $re(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=e,s=we();if(t.disableExtraAttributes)return s;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=Vre({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:i});for(const u of c){const d=s[u]??{};s[u]={...d,...l.attributes}}}return s}function Bre(e){return Wl(e)&&on(e.tags)}function Vre(e){const{identifiers:t,nodeNames:n,markNames:r,tags:o}=e;if(t==="nodes")return n;if(t==="marks")return r;if(t==="all")return[...n,...r];if(on(t))return t;Pe(Bre(t),{code:re.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:s=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=t,d=new Set,h=u==="mark"?r:u==="node"?n:[...r,...n],p=v=>h.includes(v)&&!(l!=null&&l.includes(v));for(const v of s)p(v)&&d.add(v);const m=new Map;for(const v of i)if(!(c!=null&&c.includes(v)))for(const x of o[v]){if(!p(x))continue;if(a==="any"){d.add(x);continue}const b=m.get(x)??new Set;b.add(v),m.set(x,b)}for(const[v,x]of m)x.size===i.length&&d.add(v);return[...d]}function fN(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=e,l=we();function c(x,b){l[x]=b}let u=!1;function d(){u=!0}const h=Ure(r,o,d,c),p=Hre(r,o),m=Wre(r,o),v=n({defaults:h,parse:p,dom:m},a);return Pe(o||u,{code:re.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),v.group=[...((t=v.group)==null?void 0:t.split(" "))??[],...s].join(" ")||void 0,{spec:v,dynamic:l}}function Mk(e){return De(e)||Pt(e)?{default:e}:(Pe(e,{message:`${y2(e)} is not supported`,code:re.EXTENSION_EXTRA_ATTRIBUTES}),e)}function Ure(e,t,n,r){return()=>{n();const o=we();if(t)return o;for(const[i,s]of rn(e)){let l=Mk(s).default;Pt(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function Hre(e,t){return n=>{const r=we();if(t)return r;for(const[o,i]of rn(e)){const{parseDOM:s,...a}=Mk(i);if(yi(n)){if(Ca(s)){r[o]=n.getAttribute(o)??a.default;continue}if(Pt(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function Wre(e,t){return n=>{const r=we();if(t)return r;function o(i,s){if(i){if(De(i)){r[s]=i;return}if(on(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of rn(i))r[a]=l}}for(const[i,s]of rn(e)){const{toDOM:a,parseDOM:l}=Mk(s);if(Ca(a)){const c=De(l)?l:i;r[c]=n.attrs[i];continue}if(Pt(a)){o(a(n.attrs,Kre(n)),i);continue}o(a,i)}return r}}function Kre(e){return Cy(e)?{node:e}:ine(e)?{mark:e}:{}}function Gre(e){const t=we(),n=we();for(const[r,o]of Object.entries(e.nodes))t[r]=o.spec;for(const[r,o]of Object.entries(e.marks))n[r]=o.spec;return{nodes:t,marks:n}}var Cu=class extends Nt{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return nN(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>nN(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>Hte(this.store.getState(),e))}createExternalPlugins(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.suggesters)break;if(!r.createSuggesters||(t=r.options.exclude)!=null&&t.suggesters)continue;const o=r.createSuggesters(),i=on(o)?o:[o];n.push(...i)}return[Wte(...n)]}getSuggestState(e){return Sk(e??this.store.getState())}getSuggestMethods(){const{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return Go(on(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};me([zt()],Cu.prototype,"getSuggestState",1);me([zt()],Cu.prototype,"getSuggestMethods",1);me([zt()],Cu.prototype,"isSuggesterActive",1);Cu=me([ot({customHandlerKeys:["suggester"]})],Cu);var kw=class extends Nt{constructor(){super(...arguments),this.allTags=we(),this.plainTags=we(),this.markTags=we(),this.nodeTags=we()}get name(){return"tags"}onCreate(){this.resetTags();for(const e of this.store.extensions)this.updateTagForExtension(e);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const e=we(),t=we(),n=we(),r=we();for(const o of vy(He))e[o]=[],t[o]=[],n[o]=[],r[o]=[];this.allTags=e,this.plainTags=t,this.markTags=n,this.nodeTags=r}updateTagForExtension(e){var t,n;const r=new Set([...e.tags??[],...((t=e.createTags)==null?void 0:t.call(e))??[],...e.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[e.name])??[]]);for(const o of r)Pe(qre(o),{code:re.EXTENSION,message:`The tag provided by the extension: ${e.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[o].push(e.name),xL(e)&&this.plainTags[o].push(e.name),My(e)&&this.markTags[o].push(e.name),gp(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};kw=me([ot({defaultPriority:ht.Highest})],kw);function qre(e){return Go(vy(He),e)}var Yre=new Ju("remirrorFilePlaceholderPlugin");function Jre(){const e=new fs({key:Yre,state:{init(){return{set:it.empty,payloads:new Map}},apply(t,{set:n,payloads:r}){n=n.map(t.mapping,t.doc);const o=t.getMeta(e);if(o)if(o.type===0){const i=document.createElement("placeholder"),s=Ct.widget(o.pos,i,{id:o.id});n=n.add(t.doc,[s]),r.set(o.id,o.payload)}else o.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===o.id)),r.delete(o.id));return{set:n,payloads:r}}},props:{decorations(t){var n;return((n=e.getState(t))==null?void 0:n.set)??null}}});return e}var Xre=class extends Nt{get name(){return"upload"}createExternalPlugins(){return[Jre()]}};function Zre(e={}){e={...{exitMarksOnArrowPress:Mo.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:Mo.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:Mo.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:Mo.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:Yo.defaultOptions.persistentSelectionClass},...e};const n=Yb(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=Yb(e,["persistentSelectionClass"]);return[new kw,new Sw,new Cre,new ww,new xw,new zre,new Fre,new Cu,new Ge,new fo,new Mo(n),new yw,new Xre,new Yo(r)]}var hN=class extends Nt{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const e of this.store.extensions)this.captureCommands(e),this.captureKeybindings(e)}createPlugin(){return{}}captureCommands(e){const t=e.decoratedCommands??{},n=e.createCommands;for(const r of Object.keys(t)){const o=e[r];e[r]=(...i)=>s=>{var a;const l=o(...i)(s);return s.dispatch&&l&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==((a=s.view)==null?void 0:a.dispatch),name:r,extension:e.name,decorated:!0}),l}}n&&(e.createCommands=()=>{const r=n();for(const[o,i]of Object.entries(r))r[o]=(...s)=>a=>{var l;const c=i(...s)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:o,extension:e.name,decorated:!1}),c};return r})}captureKeybindings(e){}getCommandMeta(e){return e.getMeta(this.pluginKey)??[]}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,[...n,t])}};hN=me([ot({defaultOptions:{capture:Oo.isDevelopment},staticKeys:["capture"],defaultPriority:ht.Highest})],hN);var Em,Ad,Cm,mc,Ms,_m,Pm,Qre=class{constructor(e){qt(this,Em,Fg()),qt(this,Ad,void 0),qt(this,Cm,void 0),qt(this,mc,!0),qt(this,Ms,gy()),qt(this,_m,void 0),qt(this,Pm,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;Pe(!this.manager.destroyed,{code:re.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(s=this.props).onDispatchTransaction)==null?void 0:a.call(s,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);cn(this,Cm,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);_a(d)||this.updateViewProps(...d)},this.onChange=(i=we())=>{var s,a;const l=this.eventListenerProps(i);le(this,mc)&&cn(this,mc,!1),(a=(s=this.props).onChange)==null||a.call(s,l)},this.onBlur=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onBlur)==null||a.call(s,l,i),le(this,Ms).emit("blur",l,i)},this.onFocus=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onFocus)==null||a.call(s,l,i),le(this,Ms).emit("focus",l,i)},this.setContent=(i,{triggerChange:s=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(s)return this.updateState({state:c,triggerChange:s});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,s)=>this.manager.createState({content:i,selection:s}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:t,initialEditorState:n,element:r}=e;if(cn(this,Ad,t),cn(this,Pm,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const o=this.createView(n,r);this.manager.addView(o)}get addHandler(){return le(this,_m)??cn(this,_m,le(this,Ms).on.bind(le(this,Ms)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return le(this,mc)}get props(){return le(this,Ad).call(this)}get previousState(){return this.previousStateOverride??le(this,Cm)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return le(this,Em)}get initialEditorState(){return le(this,Pm)}updateListener(e){const{state:t,tr:n}=e;return le(this,Ms).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return cn(this,Ad,t),this}updateViewProps(...e){const t=Yb(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;const{attributes:n,autoFocus:r,classNames:o=[],label:i,editable:s}=this.props,a=(t=this.manager.store)==null?void 0:t.attributes,l=Pt(n)?n(this.eventListenerProps()):n;let c={};(r||Br(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=fh(vw(e&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...s??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return eZ({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){le(this,Ms).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=we()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:le(this,mc),state:t??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:le(this,Em),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Em=new WeakMap;Ad=new WeakMap;Cm=new WeakMap;mc=new WeakMap;Ms=new WeakMap;_m=new WeakMap;Pm=new WeakMap;function eoe(e,t){const n=[],r=new WeakMap,o=[],i=new WeakMap;let s=[];const a={duplicateMap:i,parentExtensions:o,gatheredExtensions:s,settings:t};for(const d of e)wL(a,{extension:d});s=jl(s,(d,h)=>h.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of s){const h=d.constructor,p=d.name,m=i.get(h);Pe(m,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:re.INTERNAL}),!(l.has(h)||c.has(p))&&(l.add(h),c.add(p),n.push(d),r.set(h,d),m.forEach(v=>v==null?void 0:v.replaceChildExtension(h,d)))}const u=[];for(const d of n)toe({extension:d,found:l,missing:u});return Pe(_a(u),{code:re.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:h})=>`The extension '${h.name}' requires '${d.name} in order to run correctly.`).join(`
|
|
487
|
+
`)}),{extensions:n,extensionMap:r}}function wL(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;Pe(yL(a),{code:re.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=s.priority)==null?void 0:n[a.name]),r.push(a),noe({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)wL(e,{names:c,extension:d,parentExtension:a})}}function toe(e){const{extension:t,found:n,missing:r}=e;if(t.requiredExtensions)for(const o of t.requiredExtensions??[])n.has(o)||r.push({Constructor:o,extension:t})}function noe(e){const{duplicateMap:t,extension:n,parentExtension:r}=e,o=n.constructor,i=t.get(o),s=r?[r]:[];t.set(o,i?[...i,...s]:s)}function roe(e){var t,n,r,o;const{extension:i,nodeNames:s,markNames:a,plainNames:l,store:c,handlers:u}=e;i.setStore(c);const d=(t=i.onCreate)==null?void 0:t.bind(i),h=(n=i.onView)==null?void 0:n.bind(i),p=(r=i.onStateUpdate)==null?void 0:r.bind(i),m=(o=i.onDestroy)==null?void 0:o.bind(i);d&&u.create.push(d),h&&u.view.push(h),p&&u.update.push(p),m&&u.destroy.push(m),My(i)&&a.push(i.name),gp(i)&&i.name!=="doc"&&s.push(i.name),xL(i)&&l.push(i.name)}var js,Dd,wo,Oi,Ld,Er,Ya,Fd,Ja,zd,Xa,So,$d,Nm=class{constructor(e,t={}){qt(this,js,void 0),qt(this,Dd,we()),qt(this,wo,we()),qt(this,Oi,void 0),qt(this,Ld,void 0),qt(this,Er,ir.None),qt(this,Ya,void 0),qt(this,Fd,!0),qt(this,Ja,{create:[],view:[],update:[],destroy:[]}),qt(this,zd,[]),qt(this,Xa,gy()),qt(this,So,void 0),qt(this,$d,void 0),this.getState=()=>{var o;return le(this,Er)>=ir.EditorView?this.view.state:(Pe(le(this,So),{code:re.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(o=le(this,So))==null?void 0:o.initialEditorState)},this.updateState=o=>{const i=this.getState();this.view.updateState(o),this.onStateUpdate({previousState:i,state:o})};const{extensions:n,extensionMap:r}=eoe(e,t);cn(this,Ya,t),cn(this,Oi,rl(n)),cn(this,Ld,r),cn(this,js,this.createExtensionStore()),cn(this,Er,ir.Create),this.setupLifecycleHandlers();for(const o of le(this,Ja).create){const i=o();i&&le(this,zd).push(i)}}static create(e,t={}){return new Nm([...k2(e),...Zre(t.builtin)],t)}get[as](){return mn.Manager}get destroyed(){return le(this,Er)===ir.Destroy}get mounted(){return le(this,Er)>=ir.EditorView&&le(this,Er)<ir.Destroy}get output(){var e;return(e=le(this,So))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!le(this,So)}get extensions(){return le(this,Oi)}get stringHandlers(){return le(this,Dd)}get store(){return rl(le(this,wo))}get extensionStore(){return rl(le(this,js))}get tr(){return this.getExtension(Ge).transaction}get nodes(){return le(this,wo).nodes}get marks(){return le(this,wo).marks}get schema(){return le(this,wo).schema}get extensionTags(){return le(this,wo).tags}get view(){return le(this,wo).view}get settings(){return le(this,Ya)}get document(){return le(this,Ya).document??Ny()}setupLifecycleHandlers(){const e=le(this,js),t=le(this,Ja),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const i of le(this,Oi))roe({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){le(this,Dd)[e]=t}setStoreKey(e,t){le(this,wo)[e]=t}getStoreKey(e){const t=le(this,wo)[e];return Pe(!Ca(t),{code:re.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){Pe(le(this,Er)<=ir.EditorView,{code:re.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),le(this,js)[e]=t}createExtensionStore(){const e=we(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>le(this,Oi),enumerable:t},phase:{get:()=>le(this,Er),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>rl(le(this,Ya)),enumerable:t},getState:{value:this.getState,enumerable:t},updateState:{value:this.updateState,enumerable:t},isMounted:{value:()=>this.mounted,enumerable:t},getExtension:{value:this.getExtension.bind(this),enumerable:t},manager:{get:()=>this,enumerable:t},document:{get:()=>this.document,enumerable:t},stringHandlers:{get:()=>le(this,Dd),enumerable:t},currentState:{get:()=>n??(n=this.getState()),set:o=>{n=o},enumerable:t},previousState:{get:()=>r,set:o=>{r=o},enumerable:t}}),e.getStoreKey=this.getStoreKey.bind(this),e.setStoreKey=this.setStoreKey.bind(this),e.setExtensionStore=this.setExtensionStore.bind(this),e.setStringHandler=this.setStringHandler.bind(this),e}addView(e){if(le(this,Er)>=ir.EditorView)return this;cn(this,Fd,!0),cn(this,Er,ir.EditorView),le(this,wo).view=e;for(const t of le(this,Ja).view){const n=t(e);n&&le(this,zd).push(n)}return this}attachFramework(e,t){var n;le(this,So)!==e&&(le(this,So)&&(le(this,So).destroy(),(n=le(this,$d))==null||n.call(this)),cn(this,So,e),cn(this,$d,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return Pe(t,{code:re.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),t}createState(e={}){const{onError:t,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:o=n,stringHandler:i=this.settings.stringHandler}=e,{schema:s,plugins:a}=this.store,l=QD({stringHandler:De(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:s,selection:o});return ol.create({schema:s,doc:l,plugins:a,selection:uo(o,l)})}addHandler(e,t){return le(this,Xa).on(e,t)}onStateUpdate(e){const t=le(this,Fd);le(this,js).currentState=e.state,le(this,js).previousState=e.previousState,t&&(cn(this,Er,ir.Runtime),cn(this,Fd,!1));const n={...e,firstUpdate:t};for(const r of le(this,Ja).update)r(n);le(this,Xa).emit("stateUpdate",n)}getExtension(e){const t=le(this,Ld).get(e);return Pe(t,{code:re.INVALID_MANAGER_EXTENSION,message:`'${e.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),t}hasExtension(e){return!!le(this,Ld).get(e)}clone(){const e=le(this,Oi).map(n=>n.clone(n.options)),t=Nm.create(()=>e,le(this,Ya));return le(this,Xa).emit("clone",t),t}recreate(e=[],t={}){const n=le(this,Oi).map(o=>o.clone(o.initialOptions)),r=Nm.create(()=>[...n,...e],t);return le(this,Xa).emit("recreate",r),r}destroy(){var e,t,n,r,o,i;cn(this,Er,ir.Destroy);for(const s of((e=this.view)==null?void 0:e.state.plugins)??[])(n=(t=s.getState(this.view.state))==null?void 0:t.destroy)==null||n.call(t);(r=le(this,So))==null||r.destroy(),(o=le(this,$d))==null||o.call(this);for(const s of le(this,zd))s();for(const s of le(this,Ja).destroy)s();(i=this.view)==null||i.destroy(),le(this,Xa).emit("destroy")}includes(e){const t=[],n=[];for(const r of le(this,Oi))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>De(r)?Go(t,r):Go(n,r))}},ooe=Nm;js=new WeakMap;Dd=new WeakMap;wo=new WeakMap;Oi=new WeakMap;Ld=new WeakMap;Er=new WeakMap;Ya=new WeakMap;Fd=new WeakMap;Ja=new WeakMap;zd=new WeakMap;Xa=new WeakMap;So=new WeakMap;$d=new WeakMap;function ioe(e,t){return!(!Xu(e)||!Zu(e,mn.Manager))}var soe=Object.defineProperty,aoe=Object.getOwnPropertyDescriptor,loe=(e,t,n,r)=>{for(var o=r>1?void 0:r?aoe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&soe(t,n,o),o},SL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},xe=(e,t,n)=>(SL(e,t,"read from private field"),n?n.call(e):t.get(e)),Cr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},kr=(e,t,n,r)=>(SL(e,t,"write to private field"),t.set(e,n),n),Bd,coe=class{constructor(){this.portals=new Map,Cr(this,Bd,gy()),this.on=e=>xe(this,Bd).on("update",e),this.once=e=>{const t=xe(this,Bd).on("update",n=>{t(),e(n)});return t}}update(){xe(this,Bd).emit("update",this.portals)}render({Component:e,container:t}){const n=this.portals.get(t);this.portals.set(t,{Component:e,key:(n==null?void 0:n.key)??Fg()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:Fg()})}remove(e){this.portals.delete(e),this.update()}};Bd=new WeakMap;var uoe=e=>{const{portals:t}=e;return ke.createElement(ke.Fragment,null,t.map(([n,{Component:r,key:o}])=>jr.createPortal(ke.createElement(r,null),n,o)))};function doe(e){const[t,n]=g.useState(()=>Array.from(e.portals.entries()));return g.useEffect(()=>e.on(r=>{n(Array.from(r.entries()))}),[e]),g.useMemo(()=>t,[t])}var Ot,Vd,Za,Ud,Tm,Hd,gc,Wd,Om,Mi,Kn,Ew,kL=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:i}){Cr(this,Ot,void 0),Cr(this,Vd,[]),Cr(this,Za,void 0),Cr(this,Ud,void 0),Cr(this,Tm,void 0),Cr(this,Hd,void 0),Cr(this,gc,void 0),Cr(this,Wd,!1),Cr(this,Om,void 0),Cr(this,Mi,void 0),Cr(this,Kn,void 0),Cr(this,Ew,l=>{l&&(Pe(xe(this,Mi),{code:re.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${xe(this,Ot).type.name}' which doesn't support content.`}),l.append(xe(this,Mi)))}),this.Component=()=>{const l=xe(this,Tm);return Pe(l,{code:re.REACT_NODE_VIEW,message:`The custom react node view provided for ${xe(this,Ot).type.name} doesn't have a valid ReactComponent`}),ke.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:xe(this,Za),getPosition:xe(this,Hd),node:xe(this,Ot),forwardRef:xe(this,Ew),decorations:xe(this,Vd)})},this.updateAttributes=l=>{if(!xe(this,Za).editable)return;const c=xe(this,Hd).call(this);if(c==null)return;const u=xe(this,Za).state.tr.setNodeMarkup(c,void 0,{...xe(this,Ot).attrs,...l});xe(this,Za).dispatch(u)},Pe(Pt(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),kr(this,Ot,t),kr(this,Za,r),kr(this,Ud,n),kr(this,Tm,o),kr(this,Hd,e),kr(this,gc,i),kr(this,Kn,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};kr(this,Om,s??void 0),kr(this,Mi,a),xe(this,Mi)&&xe(this,Kn).append(xe(this,Mi)),this.setDomAttributes(xe(this,Ot),xe(this,Kn)),this.Component.displayName=g2(`${xe(this,Ot).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,i,s)=>new kL({options:r,node:o,view:i,getPosition:s,portalContainer:t,ReactComponent:n})}get selected(){return xe(this,Wd)}get contentDOM(){return xe(this,Om)}get dom(){return xe(this,Kn)}renderComponent(){xe(this,Ud).render({Component:this.Component,container:xe(this,Kn)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=xe(this,gc),n=xe(this,Ot).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${G_(xe(this,Ot).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(xe(this,Ot).isLeaf)return;const n=(t=(e=xe(this,Ot).type.spec).toDOM)==null?void 0:t.call(e,xe(this,Ot));if(!n)return;const{contentDOM:r,dom:o}=$a.renderSpec(document,n);let i;if(yi(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${G_(xe(this,Ot).type.name)}-node-view-content-wrapper`),i.append(r)),yi(r),{wrapper:i,contentDOM:r}}update(e,t){return Ek({types:xe(this,Ot).type,node:e})?(xe(this,Ot)===e&&xe(this,Vd)===t||(xe(this,Ot).sameMarkup(e)||this.setDomAttributes(e,xe(this,Kn)),kr(this,Ot,e),kr(this,Vd,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=xe(this,Ot).type.spec;let r=e.attrs;if(n){const o=n(e);if(De(o)||foe(o))return;Wl(o[1])&&(r=o[1])}for(const[o,i]of rn(r))t.setAttribute(o,i)}selectNode(){kr(this,Wd,!0),xe(this,Kn)&&xe(this,Kn).classList.add(U_),this.renderComponent()}deselectNode(){kr(this,Wd,!1),xe(this,Kn)&&xe(this,Kn).classList.remove(U_),this.renderComponent()}destroy(){xe(this,Ud).remove(xe(this,Kn))}ignoreMutation(e){return e.type==="selection"?!xe(this,Ot).type.spec.selectable:xe(this,Mi)?!xe(this,Mi).contains(e.target):!0}stopEvent(e){var t;if(!xe(this,Kn))return!1;if(Pt(xe(this,gc).stopEvent))return xe(this,gc).stopEvent({event:e});const n=e.target;if(!(xe(this,Kn).contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o)return!0;const s=!!xe(this,Ot).type.spec.draggable,a=Oe.isSelectable(xe(this,Ot)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",d=e.type==="mousedown",h=e.type.startsWith("drag");return!s&&a&&h&&e.preventDefault(),!(h||o||l||c||u||d&&a)}},pN=kL;Ot=new WeakMap;Vd=new WeakMap;Za=new WeakMap;Ud=new WeakMap;Tm=new WeakMap;Hd=new WeakMap;gc=new WeakMap;Wd=new WeakMap;Om=new WeakMap;Mi=new WeakMap;Kn=new WeakMap;Ew=new WeakMap;function foe(e){return pw(e)||Wl(e)&&pw(e.dom)}var wh=class extends Nt{constructor(){super(...arguments),this.portalContainer=new coe}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=we(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!gp(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=pN.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=rn({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=pN.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};wh=loe([ot({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],wh);var hoe=Object.defineProperty,mN=Object.getOwnPropertySymbols,poe=Object.prototype.hasOwnProperty,moe=Object.prototype.propertyIsEnumerable,gN=(e,t,n)=>t in e?hoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vN=(e,t)=>{for(var n in t||(t={}))poe.call(t,n)&&gN(e,n,t[n]);if(mN)for(var n of mN(t))moe.call(t,n)&&gN(e,n,t[n]);return e};function goe(e){const t=g.createContext(null),n=voe(t);return[o=>{const i=e(o);return ke.createElement(t.Provider,{value:i},o.children)},n,t]}function voe(e){return(t,n)=>{const r=g.useContext(e),o=yoe(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!t)return r;if(typeof t!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=t(r);if(!o||!n)return i;const s=t(o);return n(s,i)?s:i}}function yoe(e){const t=g.useRef();return xoe(()=>{t.current=e}),t.current}var xoe=typeof document<"u"?g.useLayoutEffect:g.useEffect;function boe(e,t){return goe(n=>{const r=g.useRef(null),o=g.useRef(),i=void 0,[s,a]=g.useState(()=>e({get:yN(r),set:xN(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return g.useEffect(()=>{l.length!==0&&a(c=>e({get:yN(r),set:xN(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function yN(e){return t=>{if(!e.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!t)return e.current;if(typeof t!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return t(e.current)}}function xN(e){return t=>{if(!e.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");e.current(n=>vN(vN({},n),typeof t=="function"?t(n):t))}}var EL={},CL={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorMessages=e.ErrorType=void 0;var t;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(t=e.ErrorType||(e.ErrorType={})),e.errorMessages=new Map([[t.MalformedUnicode,"malformed Unicode character escape sequence"],[t.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[t.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[t.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[t.EndOfString,"malformed escape sequence at end of string"]])})(CL);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=CL;Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return t.ErrorType}}),Object.defineProperty(e,"errorMessages",{enumerable:!0,get:function(){return t.errorMessages}});function n(p){return!p.match(/[^a-f0-9]/i)?parseInt(p,16):NaN}function r(p,m,v){const x=n(p);if(Number.isNaN(x)||v!==void 0&&v!==p.length)throw new SyntaxError(t.errorMessages.get(m));return x}function o(p){const m=r(p,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(p,m){const v=r(p,t.ErrorType.MalformedUnicode,4);if(m!==void 0){const x=r(m,t.ErrorType.MalformedUnicode,4);return String.fromCharCode(v,x)}return String.fromCharCode(v)}function s(p){return p.charAt(0)==="{"&&p.charAt(p.length-1)==="}"}function a(p){if(!s(p))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const m=p.slice(1,-1),v=r(m,t.ErrorType.MalformedUnicode);try{return String.fromCodePoint(v)}catch(x){throw x instanceof RangeError?new SyntaxError(t.errorMessages.get(t.ErrorType.CodePointLimit)):x}}function l(p,m=!1){if(m)throw new SyntaxError(t.errorMessages.get(t.ErrorType.OctalDeprecation));const v=parseInt(p,8);return String.fromCharCode(v)}const c=new Map([["b","\b"],["f","\f"],["n",`
|
|
488
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(p){return c.get(p)||p}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function h(p,m=!1){return p.replace(d,function(v,x,b,w,S,C,_,P,O){if(x!==void 0)return"\\";if(b!==void 0)return o(b);if(w!==void 0)return a(w);if(S!==void 0)return i(S,C);if(_!==void 0)return i(_);if(P==="0")return"\0";if(P!==void 0)return l(P,!m);if(O!==void 0)return u(O);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=h,e.default=h})(EL);const xl=e=>typeof e=="string",woe=e=>typeof e=="function",bN=new Map,_L="en";function jk(e){return[...Array.isArray(e)?e:[e],_L]}function PL(e,t,n){const r=jk(e);return rv(()=>ov("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(xl(t)?new Date(t):t)}function Cw(e,t,n){const r=jk(e);return rv(()=>ov("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function wN(e,t,n,{offset:r=0,...o}){const i=jk(e),s=t?rv(()=>ov("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):rv(()=>ov("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function rv(e,t){const n=e();let r=bN.get(n);return r||(r=t(),bN.set(n,r)),r}function ov(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const NL=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,TL="%__lingui_octothorpe__%",Soe=(e,t,n={})=>{const r=t||e,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=Cw(r,s,l);return a.replace(new RegExp(TL,"g"),c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=wN(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=wN(r,!0,s,a);return i(s-l,c)},select:koe,number:(s,a)=>Cw(r,s,o(a)),date:(s,a)=>PL(r,s,o(a))}},koe=(e,t)=>t[e]??t.other;function Eoe(e,t,n){return(r={},o)=>{const i=Soe(t,n,o),s=(l,c=!1)=>Array.isArray(l)?l.reduce((u,d)=>{if(d==="#"&&c)return u+TL;if(xl(d))return u+d;const[h,p,m]=d;let v={};p==="plural"||p==="selectordinal"||p==="select"?Object.entries(m).forEach(([b,w])=>{v[b]=s(w,p==="plural"||p==="selectordinal")}):v=m;let x;if(p){const b=i[p];x=b(r[h],v)}else x=r[h];return x==null?u:u+x},""):l,a=s(e);return xl(a)&&NL.test(a)?EL.unraw(a.trim()):xl(a)?a.trim():a?String(a):""}}var Coe=Object.defineProperty,_oe=(e,t,n)=>t in e?Coe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Poe=(e,t,n)=>(_oe(e,t+"",n),n);class Noe{constructor(){Poe(this,"_events",{})}on(t,n){var r;return(r=this._events)[t]??(r[t]=[]),this._events[t].push(n),()=>this.removeListener(t,n)}removeListener(t,n){const r=this._getListeners(t);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(t,...n){const r=this._getListeners(t);r&&r.map(o=>o.apply(this,n))}_getListeners(t){const n=this._events[t];return Array.isArray(n)?n:!1}}var Toe=Object.defineProperty,Ooe=(e,t,n)=>t in e?Toe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lc=(e,t,n)=>(Ooe(e,typeof t!="symbol"?t+"":t,n),n);class Moe extends Noe{constructor(t){super(),lc(this,"_locale",""),lc(this,"_locales"),lc(this,"_localeData",{}),lc(this,"_messages",{}),lc(this,"_missing"),lc(this,"t",this._.bind(this)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate(t.locale??_L,t.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(t,n){const r=this._localeData[t];r?Object.assign(r,n):this._localeData[t]=n}loadLocaleData(t,n){n!=null?this._loadLocaleData(t,n):Object.keys(t).forEach(r=>this._loadLocaleData(r,t[r])),this.emit("change")}_load(t,n){const r=this._messages[t];r?Object.assign(r,n):this._messages[t]=n}load(t,n){typeof t=="string"&&typeof n=="object"?this._load(t,n):Object.entries(t).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:t,locales:n,messages:r}){this._locale=t,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(t,n){this._locale=t,this._locales=n,this.emit("change")}_(t,n,r){let o=r==null?void 0:r.message;t||(t=""),xl(t)||(n=t.values||n,o=t.message,t=t.id);const i=this.messages[t],s=i===void 0,a=this._missing;if(a&&s)return woe(a)?a(this._locale,t):a;s&&this.emit("missing",{id:t,locale:this._locale});let l=i||o||t;return xl(l)&&NL.test(l)?JSON.parse(`"${l}"`):xl(l)?l:Eoe(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return PL(this._locales||this._locale,t,n)}number(t,n){return Cw(this._locales||this._locale,t,n)}}function joe(e={}){return new Moe(e)}const jy=joe();function ie(e,t){return t?"other":e==1?"one":"other"}function hs(e,t){return t?"other":e==0||e==1?"one":"other"}function xr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function lt(e,t){return"other"}function Va(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const Roe=lt,Ioe=ie,Aoe=hs;function Doe(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Loe=ie;function Foe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function zoe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function $oe(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Boe=ie,Voe=xr;function Uoe(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return t?o==1||o==2||o==5||o==7||o==8||i==20||i==50||i==70||i==80?"one":o==3||o==4||s==100||s==200||s==300||s==400||s==500||s==600||s==700||s==800||s==900?"few":r==0||o==6||i==40||i==60||i==90?"many":"other":e==1?"one":"other"}function Hoe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?(o==2||o==3)&&i!=12&&i!=13?"few":"other":o==1&&i!=11?"one":o>=2&&o<=4&&(i<12||i>14)?"few":r&&o==0||o>=5&&o<=9||i>=11&&i<=14?"many":"other"}const Woe=ie,Koe=ie,Goe=ie,qoe=hs,Yoe=lt;function Joe(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Xoe=lt;function Zoe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return t?"other":o==1&&i!=11&&i!=71&&i!=91?"one":o==2&&i!=12&&i!=72&&i!=92?"two":(o==3||o==4||o==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":e!=0&&r&&s==0?"many":"other"}const Qoe=ie;function eie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function tie(e,t){var n=String(e).split("."),r=!n[1];return t?e==1||e==3?"one":e==2?"two":e==4?"few":"other":e==1&&r?"one":"other"}const nie=ie;function rie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const oie=ie,iie=ie,sie=ie;function aie(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function lie(e,t){return t?e==0||e==7||e==8||e==9?"zero":e==1?"one":e==2?"two":e==3||e==4?"few":e==5||e==6?"many":"other":e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"}function cie(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e;return t?"other":e==1||!o&&(r==0||r==1)?"one":"other"}const uie=xr;function die(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}const fie=ie,hie=lt,pie=ie,mie=ie;function gie(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":e==1&&r?"one":"other"}const vie=ie,yie=ie,xie=xr,bie=ie;function wie(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function Sie(e,t){return t?"other":e>=0&&e<2?"one":"other"}const kie=xr;function Eie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Cie=ie;function _ie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Pie=ie,Nie=xr;function Tie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1?"one":"other":e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"}function Oie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==11?"one":e==2||e==12?"two":e==3||e==13?"few":"other":e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"}const Mie=xr,jie=ie;function Rie(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Iie=hs;function Aie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(s==0||s==20||s==40||s==60||s==80)?"few":o?"other":"many"}const Die=ie,Lie=ie;function Fie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}function zie(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}function $ie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Bie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}function Vie(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function Uie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Hie=xr,Wie=lt,Kie=lt,Gie=lt,qie=xr;function Yie(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e,i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11||!o?"one":"other"}function Jie(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const Xie=Va;function Zie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}const Qie=lt,ese=lt,tse=ie,nse=xr,rse=ie,ose=lt,ise=lt;function sse(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-2);return t?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":e==1?"one":"other"}function ase(e,t){return t?"other":e>=0&&e<2?"one":"other"}const lse=ie,cse=ie,use=lt,dse=lt;function fse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||r&&o==0&&e!=0?"many":"other":e==1?"one":"other"}const hse=ie,pse=ie,mse=lt;function gse(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const vse=lt,yse=ie,xse=ie;function bse(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const wse=ie;function Sse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2),i=r&&n[0].slice(-3),s=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return t?r&&e>=1&&e<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":e==5||o==5?"many":"other":e==0?"zero":e==1?"one":o==2||o==22||o==42||o==62||o==82||r&&i==0&&(s>=1e3&&s<=2e4||s==4e4||s==6e4||s==8e4)||e!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":e!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const kse=ie;function Ese(e,t){var n=String(e).split("."),r=n[0];return t?"other":e==0?"zero":(r==0||r==1)&&e!=0?"one":"other"}const Cse=ie,_se=ie,Pse=lt,Nse=hs;function Tse(e,t){return t&&e==1?"one":"other"}function Ose(e,t){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function Mse(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const jse=ie,Rse=hs,Ise=ie;function Ase(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?s==1&&a!=11?"one":s==2&&a!=12?"two":(s==7||s==8)&&a!=17&&a!=18?"many":"other":i&&s==1&&a!=11||l==1&&c!=11?"one":"other"}const Dse=ie,Lse=ie;function Fse(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}function zse(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function $se(e,t){return t&&e==1?"one":"other"}function Bse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==1?"one":e==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const Vse=lt,Use=ie,Hse=Va,Wse=ie,Kse=ie;function Gse(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?r&&e>=1&&e<=4?"one":"other":e==1?"one":"other"}const qse=xr,Yse=ie,Jse=ie,Xse=ie,Zse=lt,Qse=ie,eae=hs,tae=ie,nae=ie,rae=ie;function oae(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==5||r&&e>=7&&e<=9?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e==1?"one":"other"}const iae=ie,sae=lt,aae=hs,lae=ie;function cae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":e==1&&o?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&r!=1&&(i==0||i==1)||o&&i>=5&&i<=9||o&&s>=12&&s<=14?"many":"other"}function uae(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const dae=ie;function fae(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const hae=xr,pae=ie;function mae(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}const gae=ie,vae=lt;function yae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&i==0||o&&i>=5&&i<=9||o&&s>=11&&s<=14?"many":"other"}const xae=ie,bae=lt,wae=ie;function Sae(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}function kae(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const Eae=ie,Cae=ie,_ae=Va,Pae=ie,Nae=lt,Tae=lt;function Oae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Mae(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e>=0&&e<=1?"one":r&&e>=2&&e<=10?"few":"other"}function jae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"";return t?"other":e==0||e==1||r==0&&o==1?"one":"other"}function Rae(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function Iae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const Aae=Va,Dae=Va,Lae=Va,Fae=Va,zae=Va,$ae=ie,Bae=ie;function Vae(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?e==1?"one":o==4&&i!=14?"many":"other":e==1?"one":"other"}function Uae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const Hae=ie,Wae=ie,Kae=ie,Gae=lt;function qae(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?(i==1||i==2)&&s!=11&&s!=12?"one":"other":e==1&&r?"one":"other"}const Yae=xr,Jae=ie,Xae=ie,Zae=ie,Qae=ie,ele=lt,tle=hs,nle=ie;function rle(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||e==10?"few":"other":e==1?"one":"other"}function ole(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const ile=ie,sle=lt,ale=ie,lle=ie;function cle(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e==0||e==1||r&&e>=11&&e<=99?"one":"other"}const ule=ie;function dle(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return t?s==3&&a!=13?"few":"other":o&&l==1&&c!=11?"one":o&&l>=2&&l<=4&&(c<12||c>14)?"few":o&&l==0||o&&l>=5&&l<=9||o&&c>=11&&c<=14?"many":"other"}const fle=xr,hle=ie,ple=ie;function mle(e,t){return t&&e==1?"one":"other"}const gle=ie,vle=ie,yle=hs,xle=ie,ble=lt,wle=ie,Sle=ie,kle=xr,Ele=lt,Cle=lt,_le=lt;function Ple(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Nle=Object.freeze(Object.defineProperty({__proto__:null,_in:Roe,af:Ioe,ak:Aoe,am:Doe,an:Loe,ar:Foe,ars:zoe,as:$oe,asa:Boe,ast:Voe,az:Uoe,be:Hoe,bem:Woe,bez:Koe,bg:Goe,bho:qoe,bm:Yoe,bn:Joe,bo:Xoe,br:Zoe,brx:Qoe,bs:eie,ca:tie,ce:nie,ceb:rie,cgg:oie,chr:iie,ckb:sie,cs:aie,cy:lie,da:cie,de:uie,dsb:die,dv:fie,dz:hie,ee:pie,el:mie,en:gie,eo:vie,es:yie,et:xie,eu:bie,fa:wie,ff:Sie,fi:kie,fil:Eie,fo:Cie,fr:_ie,fur:Pie,fy:Nie,ga:Tie,gd:Oie,gl:Mie,gsw:jie,gu:Rie,guw:Iie,gv:Aie,ha:Die,haw:Lie,he:Fie,hi:zie,hr:$ie,hsb:Bie,hu:Vie,hy:Uie,ia:Hie,id:Wie,ig:Kie,ii:Gie,io:qie,is:Yie,it:Jie,iu:Xie,iw:Zie,ja:Qie,jbo:ese,jgo:tse,ji:nse,jmc:rse,jv:ose,jw:ise,ka:sse,kab:ase,kaj:lse,kcg:cse,kde:use,kea:dse,kk:fse,kkj:hse,kl:pse,km:mse,kn:gse,ko:vse,ks:yse,ksb:xse,ksh:bse,ku:wse,kw:Sse,ky:kse,lag:Ese,lb:Cse,lg:_se,lkt:Pse,ln:Nse,lo:Tse,lt:Ose,lv:Mse,mas:jse,mg:Rse,mgo:Ise,mk:Ase,ml:Dse,mn:Lse,mo:Fse,mr:zse,ms:$se,mt:Bse,my:Vse,nah:Use,naq:Hse,nb:Wse,nd:Kse,ne:Gse,nl:qse,nn:Yse,nnh:Jse,no:Xse,nqo:Zse,nr:Qse,nso:eae,ny:tae,nyn:nae,om:rae,or:oae,os:iae,osa:sae,pa:aae,pap:lae,pl:cae,prg:uae,ps:dae,pt:fae,pt_PT:hae,rm:pae,ro:mae,rof:gae,root:vae,ru:yae,rwk:xae,sah:bae,saq:wae,sc:Sae,scn:kae,sd:Eae,sdh:Cae,se:_ae,seh:Pae,ses:Nae,sg:Tae,sh:Oae,shi:Mae,si:jae,sk:Rae,sl:Iae,sma:Aae,smi:Dae,smj:Lae,smn:Fae,sms:zae,sn:$ae,so:Bae,sq:Vae,sr:Uae,ss:Hae,ssy:Wae,st:Kae,su:Gae,sv:qae,sw:Yae,syr:Jae,ta:Xae,te:Zae,teo:Qae,th:ele,ti:tle,tig:nle,tk:rle,tl:ole,tn:ile,to:sle,tr:ale,ts:lle,tzm:cle,ug:ule,uk:dle,ur:fle,uz:hle,ve:ple,vi:mle,vo:gle,vun:vle,wa:yle,wae:xle,wo:ble,xh:wle,xog:Sle,yi:kle,yo:Ele,yue:Cle,zh:_le,zu:Ple},Symbol.toStringTag,{value:"Module"}));var Tle=Object.defineProperty,Ole=Object.getOwnPropertyDescriptor,Mle=Object.getOwnPropertyNames,jle=Object.prototype.hasOwnProperty,Rle=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Mle(t))!jle.call(e,o)&&o!==n&&Tle(e,o,{get:()=>t[o],enumerable:!(r=Ole(t,o))||r.enumerable});return e},Ile=(e,t,n)=>(Rle(e,t,"default"),n),Ale=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),OL={};Ile(OL,Nle);jy.loadLocaleData("en",{plurals:OL.en});jy.load("en",Ale);jy.activate("en");var Dle=Object.defineProperty,Lle=Object.getOwnPropertyDescriptor,Rk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lle(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Dle(t,n,o),o},_u=class extends go{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=we();if(Wl(n))for(const[i,s]of rn(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...t}}setDocAttributes(e){return({tr:t,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(e))t.step(new _w(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return Nk(e.doc,t)}};Rk([ye()],_u.prototype,"setDocAttributes",1);Rk([zt()],_u.prototype,"isDefaultDocNode",1);_u=Rk([ot({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:ht.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],_u);var ML="SetDocAttribute",jL="RevertSetDocAttribute",_w=class Pw extends sn{constructor(n,r,o=ML){super();$t(this,"key");$t(this,"stepType");$t(this,"value");$t(this,"previous");this.stepType=o,this.key=n,this.value=r}static fromJSON(n,r){return new Pw(r.key,r.value,r.stepType)}apply(n){this.previous=n.attrs[this.key];const r={...n.attrs,[this.key]:this.value};return Ut.ok(n.type.create(r,n.content,n.marks))}invert(){return new Pw(this.key,this.previous,jL)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{sn.jsonID(ML,_w),sn.jsonID(jL,_w)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var Fle=Object.defineProperty,zle=Object.getOwnPropertyDescriptor,RL=(e,t,n,r)=>{for(var o=r>1?void 0:r?zle(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Fle(t,n,o),o};function $le(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function Ble(e,t){const n=t.target;if(n){const r=$le(e,n,0);if(r!==null){const o=e.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return e.posAtCoords({left:t.clientX,top:t.clientY})??void 0}var iv=class extends Nt{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=Ble(t,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=t.state.doc.resolve(l),u=c.depth+1;for(const d of S2(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const h=ls(c,d);h&&s.push(h)}return e(r,{view:t,nodes:i,marks:s,getMark:d=>{const h=De(d)?t.state.schema.marks[d]:d;return Pe(h,{code:re.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(p=>p.mark.type===h)},getNode:d=>{var h;const p=De(d)?t.state.schema.nodes[d]:d;Pe(p,{code:re.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:v})=>v.type===p);if(m)return{...m,isRoot:!!((h=i[0])!=null&&h.node.eq(m.node))}}})}}get name(){return"events"}onView(){var e,t;if(!((e=this.store.managerSettings.exclude)!=null&&e.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(t=n.options.exclude)!=null&&t.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of rn(r))this.addHandler(o,i)}}createPlugin(){const e=new WeakMap,t=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:h}=u,p=h.resolve(i),m=e.has(l),v=Vle({$pos:p,handled:m,view:o,state:u});let x=!1;m||(x=n(l,v)||x);const b={...v,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:w=>{const S=De(w)?d.nodes[w]:w;return Pe(S,{code:re.EXTENSION,message:"The node being checked does not exist"}),S===s.type?{node:s,pos:a}:void 0}};return e.set(l,!0),r(l,b)||x};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,o,i)=>this.options.textInput({from:r,to:o,text:i})||!1,handleClickOn:(n,r,o,i,s,a)=>t(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>t(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>t(this.options.tripleClickMark,this.options.tripleClick,n,r,o,i,s,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!1};return this.options.hover(n,o)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!0};return this.options.hover(n,o)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const o=this.options;return{update(i){const s=i.editable;s!==r&&(o.editable(s),r=s)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};RL([zt()],iv.prototype,"isInteracting",1);iv=RL([ot({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:ht.High})],iv);function Vle(e){const{handled:t,view:n,$pos:r,state:o}=e,i={getMark:b2,markRanges:[],view:n,state:o};if(t)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=ls(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=De(s)?o.schema.marks[s]:s;return Pe(a,{code:re.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class Ft extends Ke{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Ft.valid(r)?new Ft(r):Ke.near(r)}content(){return se.empty}eq(t){return t instanceof Ft&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ft(t.resolve(n.pos))}getBookmark(){return new Ik(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!Ule(t)||!Hle(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&Ft.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let l=t.doc.resolve(o);if(Ft.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Oe.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=t.doc.resolve(o);if(Ft.valid(a))return a}return null}}}Ft.prototype.visible=!1;Ft.findFrom=Ft.findGapCursorFrom;Ke.jsonID("gapcursor",Ft);class Ik{constructor(t){this.pos=t}map(t){return new Ik(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Ft.valid(n)?new Ft(n):Ke.near(n)}}function Ule(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Hle(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Wle(){return new fs({props:{decorations:Yle,createSelectionBetween(e,t,n){return t.pos==n.pos&&Ft.valid(n)?new Ft(n):null},handleClick:Gle,handleKeyDown:Kle,handleDOMEvents:{beforeinput:qle}}})}const Kle=mL({ArrowLeft:em("horiz",-1),ArrowRight:em("horiz",1),ArrowUp:em("vert",-1),ArrowDown:em("vert",1)});function em(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof Le){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=Ft.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new Ft(c))),!0):!1}}function Gle(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Ft.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Oe.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Ft(r))),!0)}function qle(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Ft))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=q.empty;for(let s=r.length-1;s>=0;s--)o=q.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new se(o,0,0));return i.setSelection(Le.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Yle(e){if(!(e.selection instanceof Ft))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",it.create(e.doc,[Ct.widget(e.selection.head,t,{key:"gapcursor"})])}var Jle=Object.defineProperty,Xle=Object.getOwnPropertyDescriptor,Zle=(e,t,n,r)=>{for(var o=r>1?void 0:r?Xle(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Jle(t,n,o),o},Nw=class extends Nt{get name(){return"gapCursor"}createExternalPlugins(){return[Wle()]}};Nw=Zle([ot({})],Nw);var sv=200,gn=function(){};gn.prototype.append=function(t){return t.length?(t=gn.from(t),!this.length&&t||t.length<sv&&this.leafAppend(t)||this.length<sv&&t.leafPrepend(this)||this.appendInner(t)):this};gn.prototype.prepend=function(t){return t.length?gn.from(t).append(this):this};gn.prototype.appendInner=function(t){return new Qle(this,t)};gn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?gn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};gn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};gn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};gn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};gn.from=function(t){return t instanceof gn?t:t&&t.length?new IL(t):gn.empty};var IL=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=sv)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=sv)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(gn);gn.empty=new IL([]);var Qle=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(gn);const ece=500;class jo{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){o||(o=this.remapping(r,h+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new _s(d.map));let p=d.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new _s(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new jo(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),h=new _s(t.mapping.maps[u],d,n),p;(p=l&&l.merge(h))&&(h=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(s++,n=void 0),o||(l=h)}let c=s-r.depth;return c>nce&&(a=tce(a,c),s-=c),new jo(a.append(i),s)}remapping(t,n){let r=new Kc;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new jo(this.items.append(t.map(n=>new _s(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},o);let l=n;this.items.forEach(h=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(h.step){let v=t.steps[p].invert(t.docs[p]),x=h.selection&&h.selection.map(i.slice(l+1,p));x&&a++,r.push(new _s(m,v,x))}else r.push(new _s(m))},o);let c=[];for(let h=n;h<s;h++)c.push(new _s(i.maps[h]));let u=this.items.slice(0,o).append(c).append(r),d=new jo(u,a);return d.emptyItemCount()>ece&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=t)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new _s(c.invert(),l,u),h,p=o.length-1;(h=o.length&&o[p].merge(d))?o[p]=h:o.push(d)}}else s.map&&r--},this.items.length,0),new jo(gn.from(o.reverse()),i)}}jo.empty=new jo(gn.empty,0);function tce(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let _s=class AL{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new AL(n.getMap().invert(),n,this.selection)}}};class Fs{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const nce=20;function rce(e,t,n,r){let o=n.getMeta(Ji),i;if(o)return o.historyState;n.getMeta(sce)&&(e=new Fs(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(Ji))return s.getMeta(Ji).redo?new Fs(e.done.addTransform(n,void 0,r,Mm(t)),e.undone,SN(n.mapping.maps),e.prevTime,e.prevComposition):new Fs(e.done,e.undone.addTransform(n,void 0,r,Mm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!oce(n,e.prevRanges)),c=s?h0(e.prevRanges,n.mapping):SN(n.mapping.maps);return new Fs(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Mm(t)),jo.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new Fs(e.done.rebased(n,i),e.undone.rebased(n,i),h0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Fs(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),h0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function oce(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function SN(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function h0(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function ice(e,t,n){let r=Mm(t),o=Ji.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Fs(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Ji,{redo:n,historyState:l})}let p0=!1,kN=null;function Mm(e){let t=e.plugins;if(kN!=t){p0=!1,kN=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){p0=!0;break}}return p0}const Ji=new Ju("history"),sce=new Ju("closeHistory");function ace(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new fs({key:Ji,state:{init(){return new Fs(jo.empty,jo.empty,null,0,-1)},apply(t,n,r){return rce(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?jm:r=="historyRedo"?Kd:null;return o?(n.preventDefault(),o(t.state,t.dispatch)):!1}}}})}function DL(e,t){return(n,r)=>{let o=Ji.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=ice(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const jm=DL(!1,!0),Kd=DL(!0,!0);function Tw(e){let t=Ji.getState(e);return t?t.done.eventCount:0}function lce(e){let t=Ji.getState(e);return t?t.undone.eventCount:0}var cce=Object.defineProperty,uce=Object.getOwnPropertyDescriptor,Gl=(e,t,n,r)=>{for(var o=r>1?void 0:r?uce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&cce(t,n,o),o},xi=class extends Nt{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=Pt(i)?i():n,l=Pt(s)&&r?s():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":Oo.isMac?()=>!1:this.wrapMethod(Kd,this.options.onRedo),"Mod-z":this.wrapMethod(jm,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(Kd,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(jm,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(Kd,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[ace({depth:e,newGroupDelay:t})]}undo(){return oN(this.wrapMethod(jm,this.options.onUndo))}redo(){return oN(this.wrapMethod(Kd,this.options.onRedo))}undoDepth(e=this.store.getState()){return Tw(e)}redoDepth(e=this.store.getState()){return lce(e)}};Gl([qr({shortcut:oe.Undo,command:"undo"})],xi.prototype,"undoShortcut",1);Gl([qr({shortcut:oe.Redo,command:"redo"})],xi.prototype,"redoShortcut",1);Gl([ye({disableChaining:!0,description:({t:e})=>e(Wg.UNDO_DESCRIPTION),label:({t:e})=>e(Wg.UNDO_LABEL),icon:"arrowGoBackFill"})],xi.prototype,"undo",1);Gl([ye({disableChaining:!0,description:({t:e})=>e(Wg.REDO_DESCRIPTION),label:({t:e})=>e(Wg.REDO_LABEL),icon:"arrowGoForwardFill"})],xi.prototype,"redo",1);Gl([zt()],xi.prototype,"undoDepth",1);Gl([zt()],xi.prototype,"redoDepth",1);xi=Gl([ot({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],xi);var dce=Object.defineProperty,fce=Object.getOwnPropertyDescriptor,Ry=(e,t,n,r)=>{for(var o=r>1?void 0:r?fce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&dce(t,n,o),o},hce={icon:"paragraph",label:({t:e})=>e(Kg.INSERT_LABEL),description:({t:e})=>e(Kg.INSERT_DESCRIPTION)},pce={icon:"paragraph",label:({t:e})=>e(Kg.CONVERT_LABEL),description:({t:e})=>e(Kg.CONVERT_DESCRIPTION)},Ll=class extends go{get name(){return"paragraph"}createTags(){return[He.LastNodeCompatible,He.TextBlock,He.Block,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",draggable:!1,...t,attrs:{...e.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...e.parse(n)})},...t.parseDOM??[]],toDOM:n=>["p",e.dom(n),0]}}convertParagraph(e={}){const{attrs:t,selection:n,preserveAttrs:r}=e;return this.store.commands.setBlockNodeType.original(this.type,t,n,r)}insertParagraph(e,t={}){const{selection:n,attrs:r}=t;return this.store.commands.insertNode.original(this.type,{content:e,selection:n,attrs:r})}shortcut(e){return this.convertParagraph()(e)}};Ry([ye(pce)],Ll.prototype,"convertParagraph",1);Ry([ye(hce)],Ll.prototype,"insertParagraph",1);Ry([qr({shortcut:oe.Paragraph,command:"convertParagraph"})],Ll.prototype,"shortcut",1);Ll=Ry([ot({defaultPriority:ht.Medium})],Ll);function Ui(e,t,n){return Math.min(Math.max(e,n),t)}class mce extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Gd=mce;function Ak(e){if(typeof e!="string")throw new Gd(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=kce.test(e)?yce(e):e;const n=xce.exec(t);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(Sh(a,2),16)),parseInt(Sh(s[3]||"f",2),16)/255]}const r=bce.exec(t);if(r){const s=Array.from(r).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,16)),parseInt(s[3]||"ff",16)/255]}const o=wce.exec(t);if(o){const s=Array.from(o).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,10)),parseFloat(s[3]||"1")]}const i=Sce.exec(t);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Ui(0,100,a)!==a)throw new Gd(e);if(Ui(0,100,l)!==l)throw new Gd(e);return[...Ece(s,a,l),Number.isNaN(c)?1:c]}throw new Gd(e)}function gce(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const EN=e=>parseInt(e.replace(/_/g,""),36),vce="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=EN(t.substring(0,3)),r=EN(t.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return e[n]=`${o}${r}`,e},{});function yce(e){const t=e.toLowerCase().trim(),n=vce[gce(t)];if(!n)throw new Gd(e);return`#${n}`}const Sh=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),xce=new RegExp(`^#${Sh("([a-f0-9])",3)}([a-f0-9])?$`,"i"),bce=new RegExp(`^#${Sh("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),wce=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Sh(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Sce=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,kce=/^[a-z]+$/i,CN=e=>Math.round(e*255),Ece=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(CN);const o=(e%360+360)%360/60,i=(1-Math.abs(2*r-1))*(t/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,d=a+u,h=l+u,p=c+u;return[d,h,p].map(CN)};function Cce(e){const[t,n,r,o]=Ak(e).map((d,h)=>h===3?d:d/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2;if(i===s)return[0,0,a,o];const l=i-s,c=a>.5?l/(2-i-s):l/(i+s);return[60*(t===i?(n-r)/l+(n<r?6:0):n===i?(r-t)/l+2:(t-n)/l+4),c,a,o]}function _ce(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${Ui(0,100,t*100).toFixed()}%, ${Ui(0,100,n*100).toFixed()}%, ${parseFloat(Ui(0,1,r).toFixed(3))})`}function Tr(e,t){const[n,r,o,i]=Cce(e);return _ce(n,r,o-t,i)}function Pce(e){if(e==="transparent")return 0;function t(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=Ak(e);return .2126*t(n)+.7152*t(r)+.0722*t(o)}function Nce(e,t,n,r){return`rgba(${Ui(0,255,e).toFixed()}, ${Ui(0,255,t).toFixed()}, ${Ui(0,255,n).toFixed()}, ${parseFloat(Ui(0,1,r).toFixed(3))})`}function Rm(e,t){return Tr(e,-t)}function av(e,t){const[n,r,o,i]=Ak(e);return Nce(n,r,o,i-t)}function Tce(e){return Pce(e)>.179}function Jc(e){return Tce(e)?"#000":"#fff"}const Oce="remirror-editor-wrapper",Mce="remirror-button-active",jce="remirror-button",Rce="remirror-composite",Ice="remirror-dialog",Ace="remirror-dialog-backdrop",Dce="remirror-form",Lce="remirror-form-message",Fce="remirror-form-label",zce="remirror-form-group",$ce="remirror-group",Bce="remirror-input",Vce="remirror-menu",Uce="remirror-menu-pane",Hce="remirror-menu-pane-active",Wce="remirror-menu-dropdown-label",Kce="remirror-menu-pane-icon",Gce="remirror-menu-pane-label",qce="remirror-menu-pane-shortcut",Yce="remirror-menu-button-left",Jce="remirror-menu-button-right",Xce="remirror-menu-button-nested-left",Zce="remirror-menu-button-nested-right",Qce="remirror-menu-button",eue="remirror-menu-bar",tue="remirror-flex-column",nue="remirror-flex-row",rue="remirror-menu-item",oue="remirror-menu-item-row",iue="remirror-menu-item-column",sue="remirror-menu-item-checkbox",aue="remirror-menu-item-radio",lue="remirror-menu-group",cue="remirror-floating-popover",uue="remirror-popover",due="remirror-animated-popover",fue="remirror-role",hue="remirror-separator",pue="remirror-tab",mue="remirror-tab-list",gue="remirror-tabbable",vue="remirror-toolbar",yue="remirror-tooltip",xue="remirror-table-size-editor",bue="remirror-table-size-editor-body",wue="remirror-table-size-editor-cell",Sue="remirror-table-size-editor-cell-selected",kue="remirror-table-size-editor-footer",Eue="remirror-color-picker",Cue="remirror-color-picker-cell",_ue="remirror-color-picker-cell-selected";var Pue=Object.freeze({__proto__:null,ANIMATED_POPOVER:due,BUTTON:jce,BUTTON_ACTIVE:Mce,COLOR_PICKER:Eue,COLOR_PICKER_CELL:Cue,COLOR_PICKER_CELL_SELECTED:_ue,COMPOSITE:Rce,DIALOG:Ice,DIALOG_BACKDROP:Ace,EDITOR_WRAPPER:Oce,FLEX_COLUMN:tue,FLEX_ROW:nue,FLOATING_POPOVER:cue,FORM:Dce,FORM_GROUP:zce,FORM_LABEL:Fce,FORM_MESSAGE:Lce,GROUP:$ce,INPUT:Bce,MENU:Vce,MENU_BAR:eue,MENU_BUTTON:Qce,MENU_BUTTON_LEFT:Yce,MENU_BUTTON_NESTED_LEFT:Xce,MENU_BUTTON_NESTED_RIGHT:Zce,MENU_BUTTON_RIGHT:Jce,MENU_DROPDOWN_LABEL:Wce,MENU_GROUP:lue,MENU_ITEM:rue,MENU_ITEM_CHECKBOX:sue,MENU_ITEM_COLUMN:iue,MENU_ITEM_RADIO:aue,MENU_ITEM_ROW:oue,MENU_PANE:Uce,MENU_PANE_ACTIVE:Hce,MENU_PANE_ICON:Kce,MENU_PANE_LABEL:Gce,MENU_PANE_SHORTCUT:qce,POPOVER:uue,ROLE:fue,SEPARATOR:hue,TAB:pue,TABBABLE:gue,TABLE_SIZE_EDITOR:xue,TABLE_SIZE_EDITOR_BODY:bue,TABLE_SIZE_EDITOR_CELL:wue,TABLE_SIZE_EDITOR_CELL_SELECTED:Sue,TABLE_SIZE_EDITOR_FOOTER:kue,TAB_LIST:mue,TOOLBAR:vue,TOOLTIP:yue});const Nue="remirror-image-loader";var Tue=Object.freeze({__proto__:null,IMAGE_LOADER:Nue});const Oue="remirror-list-item-with-custom-mark",Mue="remirror-ul-list-content",jue="remirror-editor",Rue="remirror-list-item-marker-container",Iue="remirror-list-item-checkbox",Aue="remirror-collapsible-list-item-closed",Due="remirror-collapsible-list-item-button",Lue="remirror-list-spine";var Ta=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:Due,COLLAPSIBLE_LIST_ITEM_CLOSED:Aue,EDITOR:jue,LIST_ITEM_CHECKBOX:Iue,LIST_ITEM_MARKER_CONTAINER:Rue,LIST_ITEM_WITH_CUSTOM_MARKER:Oue,LIST_SPINE:Lue,UL_LIST_CONTENT:Mue});const Fue="remirror-is-empty";var zue=Object.freeze({__proto__:null,IS_EMPTY:Fue});const $ue="remirror-editor",Bue="remirror-positioner",Vue="remirror-positioner-widget";var Uue=Object.freeze({__proto__:null,EDITOR:$ue,POSITIONER:Bue,POSITIONER_WIDGET:Vue});const ko={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},Hi="#000000",Dk="#ffffff",Hue="#252103",Lk=av(Hi,.75),Iy="#7963d2",Fk="#bcd263",Wue="#fff",Kue="#fff",zk=ko.gray[1],_N="rgba(10,31,68,0.08)",PN="rgba(10,31,68,0.10)",NN="rgba(10,31,68,0.12)",Gue=Rm(av(Hi,.1),.13),$k={background:Dk,border:Lk,foreground:Hi,muted:zk,primary:Iy,secondary:Fk,primaryText:Wue,secondaryText:Kue,text:Hue,faded:Gue},que={...$k,background:Tr(Dk,.15),border:Tr(Lk,.15),foreground:Tr(Hi,.15),muted:Tr(zk,.15),primary:Tr(Iy,.15),secondary:Tr(Fk,.15),get text(){return Jc(this.background)},get primaryText(){return Jc(this.primary)},get secondaryText(){return Jc(this.secondary)}},Yue={...$k,background:Tr(Dk,.075),border:Tr(Lk,.075),foreground:Tr(Hi,.075),muted:Tr(zk,.075),primary:Tr(Iy,.075),secondary:Tr(Fk,.075),get text(){return Jc(this.background)},get primaryText(){return Jc(this.primary)},get secondaryText(){return Jc(this.secondary)}};({...$k,backdrop:av(Hi,.1),outline:av(Iy,.6),table:(Rm(Hi,.8),Rm(Hi,.4),ko.gray[3],ko.blue[7],ko.blue[1],ko.blue[5],ko.blue[7],Rm(Hi,.4),ko.blue[5],ko.red[7],ko.red[1],ko.red[5])},`${_N}`,`${PN}`,`${NN}`);var Jue=Object.defineProperty,Xue=Object.getOwnPropertyDescriptor,Bk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Xue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Jue(t,n,o),o},LL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Xt=(e,t,n)=>(LL(e,t,"read from private field"),n?n.call(e):t.get(e)),Ni=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ps=(e,t,n,r)=>(LL(e,t,"write to private field"),t.set(e,n),n),qd,Yd,vc,Jd,Im,Xd,Zd,Qd,ef,Am=class{constructor(e){Ni(this,qd,gy()),Ni(this,Yd,[]),Ni(this,vc,new Map),Ni(this,Jd,[]),Ni(this,Im,!1),Ni(this,Xd,void 0),Ni(this,Zd,void 0),Ni(this,Qd,void 0),Ni(this,ef,void 0),this.addListener=(t,n)=>Xt(this,qd).on(t,n),Ps(this,Xd,e),Ps(this,Zd,e.getActive),Ps(this,ef,e.getPosition),Ps(this,Qd,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new Am(e)}static fromPositioner(e,t){return Am.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:Xt(this,Zd),getPosition:Xt(this,ef),hasChanged:this.hasChanged,events:this.events,getID:Xt(this,Qd)}}onActiveChanged(e){this.recentUpdate=e;const t=Xt(this,Zd).call(this,e);Ps(this,Yd,t),Ps(this,vc,new Map),Ps(this,Im,!1),Ps(this,Jd,[]);const n=[];for(const[r,o]of t.entries()){const i=this.getID(o,r);Xt(this,Jd).push(i),n.push({setElement:s=>this.addProps({...e,data:o,element:s},r),id:i,data:o})}Xt(this,qd).emit("update",n)}getID(e,t){var n;return((n=Xt(this,Qd))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(Xt(this,Im)||(Xt(this,vc).set(t,e),Xt(this,vc).size<Xt(this,Yd).length))return;const n=[];for(const r of Xt(this,Yd).keys()){const o=Xt(this,vc).get(r);Pe(o,{code:re.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=Xt(this,Jd)[r];if(!i)return;n.push({position:Xt(this,ef).call(this,o),element:o.element,id:i})}Xt(this,qd).emit("done",n)}clone(e){return Am.create({...Xt(this,Xd),...Pt(e)?e(Xt(this,Xd)):e})}active(e){const t=Pt(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},zo=Am;qd=new WeakMap;Yd=new WeakMap;vc=new WeakMap;Jd=new WeakMap;Im=new WeakMap;Xd=new WeakMap;Zd=new WeakMap;Qd=new WeakMap;ef=new WeakMap;zo.EMPTY=[];function Zue(e,t=BL){const{key:n}=(e==null?void 0:e.getMeta($L))??{};return n===t}function FL(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&Zue(t)?!0:t?Jte(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function zL(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(yi(t)&&o){const u=Number.parseFloat(Cs(t,"padding-left").replace("px","")),d=Number.parseFloat(Cs(t,"padding-right").replace("px","")),h=Number.parseFloat(Cs(t,"padding-top").replace("px","")),p=Number.parseFloat(Cs(t,"padding-bottom").replace("px","")),m=Number.parseFloat(Cs(t,"border-left").replace("px","")),v=Number.parseFloat(Cs(t,"border-right").replace("px","")),x=Number.parseFloat(Cs(t,"border-top").replace("px","")),b=Number.parseFloat(Cs(t,"border-bottom").replace("px","")),w=t.offsetWidth-t.clientWidth,S=t.offsetHeight-t.clientHeight;i+=u+m+(t.dir==="rtl"?w:0),s+=d+v+(t.dir==="rtl"?0:w),a+=h+x,l+=p+b+S}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,d]of[[e.top,e.left],[e.top,e.right],[e.bottom,e.left],[e.bottom,e.right]])if(Y_(u,c.top,c.bottom)&&Y_(d,c.left,c.right))return!0;return!1}var Que="remirror-positioner-widget",$L="positionerUpdate",BL="__all_positioners__",VL={y:-999999,x:-999999,width:0,height:0},TN={...VL,left:-999999,top:-999999,bottom:-999999,right:-999999},ede={...VL,rect:{...TN,toJSON:()=>TN},visible:!1},tde=zo.create({hasChanged:FL,getActive(e){const{state:t}=e;if(!Ck(t)||t.selection.$anchor.depth>2)return zo.EMPTY;const n=Ey({predicate:r=>r.type.isBlock,selection:t});return n?[n]:zo.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!yi(r))return ede;const o=r.getBoundingClientRect(),i=t.dom.getBoundingClientRect(),s=o.height,a=o.width,l=t.dom.scrollLeft+o.left-i.left,c=t.dom.scrollTop+o.top-i.top,u=zL(o,t.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),UL=tde.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&Tk(n.node)&&n.node.type===Py(t.state.schema)?[n]:zo.EMPTY}}));UL.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));UL.clone(({getPosition:e})=>({getPosition:t=>{const{width:n,x:r,y:o,height:i}=e(t);return{...e(t),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function Vk(e){return zo.create({hasChanged:FL,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!Kl(n.selection))return zo.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return zo.EMPTY}},getPosition(t){const{element:n,data:r,view:o}=t,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,s.left),h=Math.min(i.top,s.top),p=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+h-l.top,v=u?1:Math.abs(i.left-s.right),x=new DOMRect(u?s.left:d,h,v,c),b=zL(x,o.dom);return{rect:x,y:m,x:p,height:c,width:v,visible:b}}})}var nde=Vk(e=>!e.selection.empty);Vk(e=>e.selection.empty);Vk(()=>!0);nde.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return zo.EMPTY;const r=ZD(t);if(!r)return zo.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return zo.EMPTY}}}));var kh=class extends Nt{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:e})=>{if(e)return this.positioners=[...this.positioners,e],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(t=>t!==e)}}}get name(){return"positioner"}createAttributes(){return{class:Uue.EDITOR}}init(){this.onScroll=KX(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(e,t)=>(this.positioner(this.getBaseProps("hover",{hover:t})),!1),contextmenu:(e,t)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:t})),!1)}}onStateUpdate(e){this.positioner({...e,previousState:e.firstUpdate?void 0:e.previousState,event:"state",helpers:this.store.helpers})}createDecorations(e){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return it.empty;const t=Ct.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return it.create(e.doc,[t])}forceUpdatePositioners(e=BL){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta($L,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=Que,e.setAttribute("role","presentation"),e}triggerPositioner(e,t){e.hasChanged(t)&&e.onActiveChanged({...t,view:this.store.view})}positioner(e){for(const t of this.positioners)t.events.includes(e.event)&&this.triggerPositioner(t,e)}getBaseProps(e,t){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:e,firstUpdate:!1,previousState:r,state:n,...t}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};Bk([ye()],kh.prototype,"forceUpdatePositioners",1);Bk([zt()],kh.prototype,"getPositionerWidget",1);kh=Bk([ot({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],kh);var rde=Object.defineProperty,ode=Object.getOwnPropertyDescriptor,ide=(e,t,n,r)=>{for(var o=r>1?void 0:r?ode(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&rde(t,n,o),o},Ow=class extends go{get name(){return"text"}createTags(){return[He.InlineNode]}createNodeSpec(){return{}}};Ow=ide([ot({disableExtraAttributes:!0,defaultPriority:ht.Medium})],Ow);var sde={..._u.defaultOptions,...Ll.defaultOptions,...xi.defaultOptions,excludeExtensions:[]};function ade(e={}){e={...sde,...e};const{content:t,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=e,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new xi({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new _u({content:t})),a.text||l.push(new Ow),a.paragraph||l.push(new Ll),a.positioner||l.push(new kh),a.gapCursor||l.push(new Nw),a.events||l.push(new iv),l}var lde=Object.defineProperty,cde=Object.getOwnPropertyDescriptor,ude=(e,t,n,r)=>{for(var o=r>1?void 0:r?cde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&lde(t,n,o),o},Fl=class extends Nt{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:Nk(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>dde({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>fde({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=ir.EditorView&&this.store.updateAttributes()}};Fl=ude([ot({defaultOptions:{emptyNodeClass:zue.IS_EMPTY,placeholder:""}})],Fl);function dde(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:Nk(o.doc)}:t}function fde(e){const{extension:t,state:n}=e,{empty:r}=t.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=t.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=Ct.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),it.create(n.doc,s)}var hde=Object.defineProperty,pde=Object.getOwnPropertyDescriptor,mde=(e,t,n,r)=>{for(var o=r>1?void 0:r?pde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&hde(t,n,o),o},gde={...Fl.defaultOptions,...wh.defaultOptions},vde=[...Fl.staticKeys,...wh.staticKeys],Eh=class extends Nt{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(Fl).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Fl({emptyNodeClass:e,placeholder:t,priority:ht.Low}),new wh({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};Eh=mde([ot({defaultOptions:gde,staticKeys:vde})],Eh);var HL={};Object.defineProperty(HL,"__esModule",{value:!0});function yde(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return MN(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return MN(r,o)},e[0]);return n||null}var Sd=HL.default=yde,ON=new WeakMap;function MN(e,t){if(e&&t){var n=ON.get(e)||new WeakMap;ON.set(e,n);var r=n.get(t)||function(o){jN(e,o),jN(t,o)};return n.set(t,r),r}return e||t}function jN(e,t){typeof e=="function"?e(t):e.current=t}var WL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},m0=(e,t,n)=>(WL(e,t,"read from private field"),t.get(e)),xde=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},bde=(e,t,n,r)=>(WL(e,t,"write to private field"),t.set(e,n),n);function wde(){const[,e]=g.useState(we());return g.useCallback(()=>{e(we())},[])}var KL=g.createContext(null);function Ay(e){const t=g.useContext(KL),n=g.useRef(wde());Pe(t,{code:re.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return g.useEffect(()=>{let o=e;if(o){if(Wl(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(Pt(o))return r("updated",o)}},[r,e]),t}function Sde(e=!0){return Ay({autoUpdate:e}).active}function kde(e=!1){return Ay(e?{autoUpdate:!0}:void 0).attrs}function GL(){return Ay().chain.new()}var[Ede,$me]=boe(({props:e})=>{const t=e.locale??"en",n=e.i18n??jy,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function RN(e,t={}){const{core:n,react:r,...o}=t;return ioe(e)?e:ooe.create(()=>[...k2(e),new Eh(r),...ade(n)],o)}function Cde(e,t={}){const n=g.useRef(e),r=g.useRef(t),[o,i]=g.useState(()=>RN(e,t));return n.current=e,r.current=t,g.useEffect(()=>o.addHandler("destroy",()=>{i(()=>RN(n.current,r.current))}),[o]),o}var _de=typeof Sd=="object"&&Sd.__esModule&&Sd.default?Sd.default:Sd,yc,Pde=class extends Qre{constructor(e){if(super(e),xde(this,yc,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=t=>this.internalGetRootProps(t,null),this.internalGetRootProps=(t,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=t??we();return{[r]:_de(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,Pe(this.rootPropsConfig.count<=1,{code:re.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),bde(this,yc,t),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(Fl).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new vte(null,{state:e,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:e,...t}){const{triggerChange:n=!0,tr:r,transactions:o}=t;if(this.props.state){const{onChange:i}=this.props;Pe(i,{code:re.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),Pe(n,{code:re.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:e,tr:r,transactions:o});return}!r&&!o&&(e=e.apply(e.tr.setMeta(H_,{}))),this.view.updateState(e),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:e,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:e,tr:r,transactions:o})}updateControlledState(e,t){this.previousStateOverride=t,e=e.apply(e.tr.setMeta(H_,{})),this.view.updateState(e),this.manager.onStateUpdate({previousState:this.previousState,state:e}),this.previousStateOverride=void 0}addProsemirrorViewToDom(e,t){this.props.insertPosition==="start"?e.insertBefore(t,e.firstChild):e.append(t)}onRefLoad(){Pe(m0(this,yc),{code:re.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:e}=this.props;this.addProsemirrorViewToDom(m0(this,yc),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&m0(this,yc)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};yc=new WeakMap;var qL=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Nde(e){const t=g.useRef();return qL(()=>{t.current=e}),t.current}function Tde(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;g.useRef(!0).current&&!Ca(r)&&t.getExtension(Eh).setOptions({placeholder:r}),g.useEffect(()=>{r!=null&&t.getExtension(Eh).setOptions({placeholder:r})},[r,t]);const[s]=g.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=on(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=Ode({initialEditorState:s,getProps:()=>e});return g.useEffect(()=>()=>{a.destroy()},[a]),g.useEffect(()=>{a.onUpdate()},[o,a]),Mde(a),a.frameworkOutput}function Ode(e){const t=g.useRef(e);t.current=e;const n=g.useMemo(()=>new Pde(t.current),[]);return n.update(e),n}function Mde(e){const{state:t}=e.props,n=g.useRef(!!t),r=Nde(t);qL(()=>{const o=t?n.current===!0:n.current===!1;Pe(o,{code:re.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!t||t===r)&&e.updateControlledState(t,r??void 0)},[t,r,e])}function jde(e={}){const{content:t,document:n,selection:r,extensions:o,...i}=e,s=Cde(o??(()=>[]),i),[a,l]=g.useState(()=>s.createState({selection:r,content:t??s.createEmptyDoc()})),c=g.useCallback(({state:d})=>{l(d)},[]),u=g.useCallback(()=>s.output,[s]);return g.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var Mw=()=>ke.createElement("div",{className:Pue.EDITOR_WRAPPER,...Ay().getRootProps()}),Rde=e=>(e.hook(),null);function Ide(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=e,l=Tde(a),c=doe(l.portalContainer),u=n==="start"||n===!0||!t&&Ca(n),d=n==="end";return ke.createElement(Ede,{i18n:r,locale:o,supportedLocales:i},ke.createElement(KL.Provider,{value:l},ke.createElement(uoe,{portals:c}),s.map((h,p)=>ke.createElement(Rde,{hook:h,key:p})),u&&ke.createElement(Mw,null),t,d&&ke.createElement(Mw,null)))}function Ade(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return Dde(a,s,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function Dde(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=s.resolve(t.start-2);i=new Rl(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new Rl(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=ck(i,n,r,t);return a?(e&&Lde(e,t,a,o,n),!0):!1}function Lde(e,t,n,r,o){let i=q.empty;for(let u=n.length-1;u>=0;u--)i=q.from(n[u].type.create(n[u].attrs,i));e.step(new Ht(t.start-(r?2:0),t.end,t.start,t.end,new se(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,h=!0;u<d;u++,h=!1)!h&&Gc(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function Fde(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?zde(t,n,e,i):$de(t,n,i):!0:!1}}function zde(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Ht(i-1,s,i,s,new se(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Rl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Yu(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return dp(o.doc,l)&&o.join(l),t(o.scrollIntoView()),!0}function $de(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?q.empty:q.from(o))))return!1;let d=i.pos,h=d+s.nodeSize;return r.step(new Ht(d-(a?1:0),h+(l?1:0),d+1,h-1,new se((a?q.empty:q.from(o.copy(q.empty))).append(l?q.empty:q.from(o.copy(q.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var Bde=Object.defineProperty,Vde=Object.getOwnPropertyDescriptor,vo=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Bde(t,n,o),o};function jw(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListContainerNode))}function Ude(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListItemNode))}function Oa(e){return jw(e.type)}function pa(e){return Ude(e.type)}function Uk(e,t){return n=>{const{dispatch:r,tr:o}=n,i=kk(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Ey({predicate:u=>jw(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return XL(t)(n);if(jw(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):Hde(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return Ade(e)(i,r)}}function YL(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var p,m;const i=nne(e,o.schema),{$from:s,$to:a}=n.selection;if(_y(n.selection)&&n.selection.node.isBlock||s.depth<2||!s.sameParent(a))return!1;const l=s.node(-1);if(l.type!==i)return!1;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==i||s.index(-2)!==s.node(-2).childCount-1)return!1;if(r){const v=s.index(-1)>0;let x=q.empty;for(let S=s.depth-(v?1:2);S>=s.depth-3;S--)x=q.from(s.node(S).copy(x));const b=((p=i.contentMatch.defaultType)==null?void 0:p.createAndFill())||void 0;x=x.append(q.from(i.createAndFill(null,b)||void 0));const w=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;n.replace(s.before(v?void 0:-1),s.after(-w),new se(x,v?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(s.pos+(v?3:2)))),r(n.scrollIntoView())}return!0}if(l.attrs.closed&&s.sameParent(a)&&a.pos===a.end()){if(r){const v=s.after(-1),x=((m=i.contentMatch.defaultType)==null?void 0:m.createAndFill())||void 0,b=i.createAndFill(null,x);b&&(n.insert(v,b),n.setSelection(Le.near(n.doc.resolve(v+1)))),n.delete(s.pos,a.pos),r(n.scrollIntoView())}return!0}const c=Object.fromEntries(Object.entries(l.attrs).filter(([v])=>!t.includes(v))),u=a.pos===s.end()?l.contentMatchAt(0).defaultType:null,d={...s.node().attrs};n.delete(s.pos,a.pos);const h=u?[{type:i,attrs:c},{type:u,attrs:d}]:[{type:i,attrs:c}];return Gc(n.doc,s.pos,2)?(r&&r(n.split(s.pos,2,h).scrollIntoView()),!0):!1}}function Hde(e,t,n,r){const o=t.node,i=e.doc.resolve(t.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,q.from(n.create())))return!1;const l=[];for(let p=0;p<o.childCount;p++){const m=o.child(p);if(!r.validContent(m.content))return!1;const v=r.createChecked(null,m.content);l.push(v)}const c=n.createChecked(null,l),u=t.pos,d=u+o.nodeSize,h=e.selection.from;return e.replaceRangeWith(u,d,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(h))),!0}function Wde({listType:e,itemType:t,tr:n,range:r}){var l;const o=r.parent,i=n.doc.slice(r.start,r.end);if(o.type===e&&((l=i.content.firstChild)==null?void 0:l.type)===t)return!1;const s=[];for(let c=0;c<i.content.childCount;c++){const u=i.content.child(c);if(!t.validContent(u.content))return!1;const d=t.createChecked(null,u.content);s.push(d)}const a=e.createChecked(null,s);return n.replaceRange(r.start,r.end,new se(q.from(a),0,0)),!0}function Pu({listType:e,itemType:t,tr:n}){const r=lv(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return Wde({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(Le.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function Kde(e,t,n){const r=e.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,v=n.endIndex-1,x=n.startIndex;v>x;v--)m-=o.child(v).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?q.empty:q.from(o))))return!1;const h=s.pos,p=h+a.nodeSize;return r.step(new Ht(h-(l?1:0),p+(c?1:0),h+1,p-1,new se((l?q.empty:q.from(o.copy(q.empty))).append(c?q.empty:q.from(o.copy(q.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function JL(e,t){const n=t||e.selection.$from;let r=[],o,i,s,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),o=n.index(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Oa(s)){const u=n.before(c+1);r.push(u)}if(o=n.indexAfter(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Oa(s)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)dp(e.doc,c)&&(e.join(c),l=!0);return l}function XL(e){return t=>{const{dispatch:n,tr:r}=t,o=kk(r,t.state),i=Gde(e,r.selection);return i?(n&&Kde(o,n,i),!0):!1}}function Gde(e,t){const{$from:n,$to:r}=t;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===e})}function lv(e){const{$from:t,$to:n}=e;return t.blockRange(n,Oa)}function qde(e){const t=e.selection.$from,n=t.blockRange();if(!n||!pa(n.parent)||n.startIndex!==0)return!1;const r=t.node(n.depth-2),o=t.index(n.depth),i=t.index(n.depth-1),s=t.index(n.depth-2),a=r.maybeChild(s-1),l=a==null?void 0:a.lastChild;if(o!==0||i!==0)return!1;if(a&&Oa(a)&&l&&pa(l))return Pu({listType:a.type,itemType:l.type,tr:e});if(pa(r)){const c=r,u=t.node(n.depth-3);if(Oa(u))return Pu({listType:u.type,itemType:c.type,tr:e})}return!1}function IN({view:e}){if(!e)return!1;{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!pa(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;qde(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!pa(n.parent)||n.startIndex!==0)return!1;const r=t.index(n.depth),o=t.index(n.depth-1),i=t.index(n.depth-2),s=n.depth-2>=1&&pa(t.node(n.depth-2));r===0&&o===0&&i<=1&&s&&Fde(n.parent.type)(e.state,e.dispatch)}return lL(e.state,e.dispatch,e),!0}function ZL({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(Ta.LIST_ITEM_MARKER_CONTAINER),o.append(t);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(Ta.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==e.type?!1:(e=l,n(e,s),r(e,t),!0);return a(e),{dom:s,contentDOM:i,update:a}}function Yde(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!pa(n)||!Oa(r)?!1:{parentItem:n,parentList:r}}function Jde(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth);return o<i?(e.step(new Ht(o-1,i,o,i,new se(q.from(r.type.create(null,n.copy())),1,0),1,!0)),new Rl(e.doc.resolve(t.$from.pos),e.doc.resolve(i),t.depth)):t}function Xde(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth-1);return o+1<i?(e.step(new Ht(o-1,i,o+1,i,new se(q.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Rl(e.selection.$from,e.selection.$to,t.depth)):t}function Zde(e,t,n,r){return Pu({listType:n.type,itemType:r.type,tr:e})?new Rl(e.selection.$from,e.selection.$to,t.depth):t}function Qde(e){let t=lv(e.selection);if(!t)return!1;const n=Yde(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=Jde(e,t),t=Xde(e,t),t=Zde(e,t,o,r);const i=Yu(t);return typeof i!="number"||(e.lift(t,i),t=lv(e.selection),t&&JL(e,e.doc.resolve(t.end-2))),!0}var efe=({tr:e,dispatch:t})=>Qde(e)?(t==null||t(e.scrollIntoView()),!0):!1;function tfe(e,t,n){let r,o,i,s;const a=t.doc;if(n.startIndex>=1){r=e.child(n.startIndex-1),o=e,s=a.resolve(n.start).start(n.depth),i=s+1;for(let l=0;l<n.startIndex-1;l++)i+=o.child(l).nodeSize}else{const l=t.index(n.depth-1);if(l>=1){const c=t.node(n.depth-1),u=t.start(n.depth-1);if(o=c.child(l-1),!Oa(o))return!1;s=u+1;for(let d=0;d<l-1;d++)s+=c.child(d).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!pa(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function nfe(e,t,n){let r,o;const i=n.start,s=t.depth>=n.depth+2?t.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=e.slice(i,a),o=null):(r=e.slice(i,s),o=e.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function rfe(e){const{$from:t,$to:n}=e.selection,r=lv(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!Oa(o))return!1;const i=tfe(o,t,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=nfe(e.doc,n,r),d=s.content.append(q.fromArray([o.copy(c.content)])).append(u?u.content:q.empty);e.deleteRange(r.start,r.end);const h=l+s.nodeSize-2,p=s.copy(d);return p.check(),e.replaceRangeWith(l-1,h+1,p),e.setSelection(a===o?Le.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):Le.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var ofe=({tr:e,dispatch:t})=>rfe(e)?(t==null||t(e.scrollIntoView()),!0):!1,QL=class extends Nt{get name(){return"listItemShared"}createKeymap(){const e={Tab:ofe,"Shift-Tab":efe,Backspace:IN,"Mod-Backspace":IN};if(Oo.isMac){const t={"Ctrl-h":e.Backspace,"Alt-Backspace":e["Mod-Backspace"]};return{...e,...t}}return e}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr;return JL(r)?r:null}}}},Nu=class extends go{get name(){return"listItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:e.parse,priority:ht.Lowest},...t.parseDOM??[]],toDOM:n=>["li",e.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(e,t,n)=>{const r=document.createElement("div");return r.classList.add(Ta.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=Oe.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),ZL({mark:r,node:e,updateDOM:ife,updateMark:sfe})}:{}}createKeymap(){return{Enter:YL(this.type)}}createExtensions(){return[new QL]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!_y(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return e=YX(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(i,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return XL(e??this.type)}};vo([ye()],Nu.prototype,"toggleListItemClosed",1);vo([ye()],Nu.prototype,"liftListItemOutOfList",1);Nu=vo([ot({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],Nu);function ife(e,t){e.attrs.closed?t.classList.add(Ta.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(Ta.COLLAPSIBLE_LIST_ITEM_CLOSED)}function sfe(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var Ch=class extends go{get name(){return"bulletList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["ul",e.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(e,t,n)=>{var c;const r=document.createElement("div");r.style.position="relative";const o=n(),i=t.state.doc.resolve(o+1),s=i.node(i.depth-1);if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(Ta.LIST_SPINE),u.addEventListener("click",d=>{const h=n(),p=t.state.doc.resolve(h+1),m=p.start(p.depth-1),v=Oe.create(t.state.doc,m-1);t.dispatch(t.state.tr.setSelection(v)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),r.append(u)}const l=document.createElement("ul");return l.classList.add(Ta.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new Nu({priority:ht.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return Uk(this.type,Rt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[hk(e,this.type),new mo(e,(t,n,r,o)=>{const i=t.tr;return i.deleteRange(r,o),Pu({listType:this.type,itemType:Rt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};vo([ye({icon:"listUnordered",label:({t:e})=>e(fk.BULLET_LIST_LABEL)})],Ch.prototype,"toggleBulletList",1);vo([qr({shortcut:oe.BulletList,command:"toggleBulletList"})],Ch.prototype,"listShortcut",1);Ch=vo([ot({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],Ch);var _h=class extends go{get name(){return"orderedList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>yi(n)?{...e.parse(n),order:+(n.getAttribute("start")??1)}:{}},...t.parseDOM??[]],toDOM:n=>{const r=e.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new Nu({priority:ht.Low})]}toggleOrderedList(){return Uk(this.type,Rt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[hk(e,this.type,t=>({order:+Rt(t,1)}),(t,n)=>n.childCount+n.attrs.order===+Rt(t,1)),new mo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Pu({listType:this.type,itemType:Rt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+Rt(n,1);if(a!==1){const l=yh({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};vo([ye({icon:"listOrdered",label:({t:e})=>e(fk.ORDERED_LIST_LABEL)})],_h.prototype,"toggleOrderedList",1);vo([qr({shortcut:oe.OrderedList,command:"toggleOrderedList"})],_h.prototype,"listShortcut",1);_h=vo([ot({})],_h);var e4=class extends go{get name(){return"taskListItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return yi(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...e.parse(n)}},priority:ht.Medium},...t.parseDOM??[]],toDOM:n=>["li",{...e.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(e,t,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(Ta.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{t.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=t.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=e.attrs.checked,ZL({node:e,mark:r,updateDOM:afe,updateMark:lfe})}}createKeymap(){return{Enter:YL(this.type)}}createExtensions(){return[new QL]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const i=yh({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:t??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const e=/^\s*(\[( ?|x|X)]\s)$/;return[hk(e,this.type,t=>({checked:["x","X"].includes(wf(t,2))})),new mo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Pu({listType:Rt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(wf(n,2));if(a){const l=yh({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};vo([ye()],e4.prototype,"toggleCheckboxChecked",1);function afe(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function lfe(e,t){t.checked=!!e.attrs.checked}var t4=class extends go{get name(){return"taskList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"taskListItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:e.parse,priority:ht.Medium},...t.parseDOM??[]],toDOM:n=>["ul",{...e.dom(n),"data-task-list":""},0]}}createExtensions(){return[new e4({})]}toggleTaskList(){return Uk(this.type,Rt(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};vo([ye({icon:"checkboxMultipleLine",label:({t:e})=>e(fk.TASK_LIST_LABEL)})],t4.prototype,"toggleTaskList",1);vo([qr({shortcut:oe.TaskList,command:"toggleTaskList"})],t4.prototype,"listShortcut",1);function cfe(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:h,children:p,...m}=d,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:x,children:p})}function u(d,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,ufe(o,...t)]}function ufe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var g0="rovingFocusGroup.onEntryFocus",dfe={bubbles:!1,cancelable:!0},Dy="RovingFocusGroup",[Rw,n4,ffe]=ty(Dy),[hfe,r4]=cfe(Dy,[ffe]),[pfe,mfe]=hfe(Dy),o4=g.forwardRef((e,t)=>f.jsx(Rw.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Rw.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(gfe,{...e,ref:t})})}));o4.displayName=Dy;var gfe=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=g.useRef(null),p=$e(t,h),m=Qh(i),[v=null,x]=zr({prop:s,defaultProp:a,onChange:l}),[b,w]=g.useState(!1),S=tn(c),C=n4(n),_=g.useRef(!1),[P,O]=g.useState(0);return g.useEffect(()=>{const M=h.current;if(M)return M.addEventListener(g0,S),()=>M.removeEventListener(g0,S)},[S]),f.jsx(pfe,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:v,onItemFocus:g.useCallback(M=>x(M),[x]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>O(M=>M+1),[]),onFocusableItemRemove:g.useCallback(()=>O(M=>M-1),[]),children:f.jsx(Te.div,{tabIndex:b||P===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{_.current=!0}),onFocus:ne(e.onFocus,M=>{const I=!_.current;if(M.target===M.currentTarget&&I&&!b){const L=new CustomEvent(g0,dfe);if(M.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=C().filter(A=>A.focusable),$=U.find(A=>A.active),K=U.find(A=>A.id===v),B=[$,K,...U].filter(Boolean).map(A=>A.ref.current);a4(B,u)}}_.current=!1}),onBlur:ne(e.onBlur,()=>w(!1))})})}),i4="RovingFocusGroupItem",s4=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Ar(),l=i||a,c=mfe(i4,n),u=c.currentTabStopId===l,d=n4(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return g.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),f.jsx(Rw.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(Te.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:ne(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:ne(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:ne(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=xfe(m,c.orientation,c.dir);if(v!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let b=d().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const w=b.indexOf(m.currentTarget);b=c.loop?bfe(b,w+1):b.slice(w+1)}setTimeout(()=>a4(b))}})})})});s4.displayName=i4;var vfe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function yfe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function xfe(e,t,n){const r=yfe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return vfe[r]}function a4(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function bfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wfe=o4,Sfe=s4,Iw=["Enter"," "],kfe=["ArrowDown","PageUp","Home"],l4=["ArrowUp","PageDown","End"],Efe=[...kfe,...l4],Cfe={ltr:[...Iw,"ArrowRight"],rtl:[...Iw,"ArrowLeft"]},_fe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},vp="Menu",[Ph,Pfe,Nfe]=ty(vp),[ql,c4]=ho(vp,[Nfe,wi,r4]),Ly=wi(),u4=r4(),[Tfe,Yl]=ql(vp),[Ofe,yp]=ql(vp),d4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=Ly(t),[l,c]=g.useState(null),u=g.useRef(!1),d=tn(i),h=Qh(o);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),f.jsx(Wh,{...a,children:f.jsx(Tfe,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:f.jsx(Ofe,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};d4.displayName=vp;var Mfe="MenuAnchor",Hk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ly(n);return f.jsx(Au,{...o,...r,ref:t})});Hk.displayName=Mfe;var Wk="MenuPortal",[jfe,f4]=ql(Wk,{forceMount:void 0}),h4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Yl(Wk,t);return f.jsx(jfe,{scope:t,forceMount:n,children:f.jsx(an,{present:n||i.open,children:f.jsx(Du,{asChild:!0,container:o,children:r})})})};h4.displayName=Wk;var so="MenuContent",[Rfe,Kk]=ql(so),p4=g.forwardRef((e,t)=>{const n=f4(so,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Yl(so,e.__scopeMenu),s=yp(so,e.__scopeMenu);return f.jsx(Ph.Provider,{scope:e.__scopeMenu,children:f.jsx(an,{present:r||i.open,children:f.jsx(Ph.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(Ife,{...o,ref:t}):f.jsx(Afe,{...o,ref:t})})})})}),Ife=g.forwardRef((e,t)=>{const n=Yl(so,e.__scopeMenu),r=g.useRef(null),o=$e(t,r);return g.useEffect(()=>{const i=r.current;if(i)return Xv(i)},[]),f.jsx(Gk,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Afe=g.forwardRef((e,t)=>{const n=Yl(so,e.__scopeMenu);return f.jsx(Gk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Gk=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...v}=e,x=Yl(so,n),b=yp(so,n),w=Ly(n),S=u4(n),C=Pfe(n),[_,P]=g.useState(null),O=g.useRef(null),M=$e(t,O,x.onContentChange),I=g.useRef(0),L=g.useRef(""),U=g.useRef(0),$=g.useRef(null),K=g.useRef("right"),W=g.useRef(0),B=m?tp:g.Fragment,A=m?{as:ns,allowPinchZoom:!0}:void 0,R=D=>{var Y,ce;const z=L.current+D,V=C().filter(Ee=>!Ee.disabled),G=document.activeElement,_e=(Y=V.find(Ee=>Ee.ref.current===G))==null?void 0:Y.textValue,Se=V.map(Ee=>Ee.textValue),Be=Gfe(Se,z,_e),Z=(ce=V.find(Ee=>Ee.textValue===Be))==null?void 0:ce.ref.current;(function Ee(fe){L.current=fe,window.clearTimeout(I.current),fe!==""&&(I.current=window.setTimeout(()=>Ee(""),1e3))})(z),Z&&setTimeout(()=>Z.focus())};g.useEffect(()=>()=>window.clearTimeout(I.current),[]),Jv();const N=g.useCallback(D=>{var V,G;return K.current===((V=$.current)==null?void 0:V.side)&&Yfe(D,(G=$.current)==null?void 0:G.area)},[]);return f.jsx(Rfe,{scope:n,searchRef:L,onItemEnter:g.useCallback(D=>{N(D)&&D.preventDefault()},[N]),onItemLeave:g.useCallback(D=>{var z;N(D)||((z=O.current)==null||z.focus(),P(null))},[N]),onTriggerLeave:g.useCallback(D=>{N(D)&&D.preventDefault()},[N]),pointerGraceTimerRef:U,onPointerGraceIntentChange:g.useCallback(D=>{$.current=D},[]),children:f.jsx(B,{...A,children:f.jsx(ep,{asChild:!0,trapped:o,onMountAutoFocus:ne(i,D=>{var z;D.preventDefault(),(z=O.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(Hl,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:f.jsx(wfe,{asChild:!0,...S,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:P,onEntryFocus:ne(l,D=>{b.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Kh,{role:"menu","aria-orientation":"vertical","data-state":O4(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...v,ref:M,style:{outline:"none",...v.style},onKeyDown:ne(v.onKeyDown,D=>{const V=D.target.closest("[data-radix-menu-content]")===D.currentTarget,G=D.ctrlKey||D.altKey||D.metaKey,_e=D.key.length===1;V&&(D.key==="Tab"&&D.preventDefault(),!G&&_e&&R(D.key));const Se=O.current;if(D.target!==Se||!Efe.includes(D.key))return;D.preventDefault();const Z=C().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);l4.includes(D.key)&&Z.reverse(),Wfe(Z)}),onBlur:ne(e.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),L.current="")}),onPointerMove:ne(e.onPointerMove,Nh(D=>{const z=D.target,V=W.current!==D.clientX;if(D.currentTarget.contains(z)&&V){const G=D.clientX>W.current?"right":"left";K.current=G,W.current=D.clientX}}))})})})})})})});p4.displayName=so;var Dfe="MenuGroup",qk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Te.div,{role:"group",...r,ref:t})});qk.displayName=Dfe;var Lfe="MenuLabel",m4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Te.div,{...r,ref:t})});m4.displayName=Lfe;var cv="MenuItem",AN="menu.itemSelect",Fy=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=g.useRef(null),s=yp(cv,e.__scopeMenu),a=Kk(cv,e.__scopeMenu),l=$e(t,i),c=g.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const h=new CustomEvent(AN,{bubbles:!0,cancelable:!0});d.addEventListener(AN,p=>r==null?void 0:r(p),{once:!0}),Mj(d,h),h.defaultPrevented?c.current=!1:s.onClose()}};return f.jsx(g4,{...o,ref:l,disabled:n,onClick:ne(e.onClick,u),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),c.current=!0},onPointerUp:ne(e.onPointerUp,d=>{var h;c.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:ne(e.onKeyDown,d=>{const h=a.searchRef.current!=="";n||h&&d.key===" "||Iw.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Fy.displayName=cv;var g4=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=Kk(cv,n),a=u4(n),l=g.useRef(null),c=$e(t,l),[u,d]=g.useState(!1),[h,p]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[i.children]),f.jsx(Ph.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:f.jsx(Sfe,{asChild:!0,...a,focusable:!r,children:f.jsx(Te.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:ne(e.onPointerMove,Nh(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,Nh(m=>s.onItemLeave(m))),onFocus:ne(e.onFocus,()=>d(!0)),onBlur:ne(e.onBlur,()=>d(!1))})})})}),Ffe="MenuCheckboxItem",v4=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.jsx(S4,{scope:e.__scopeMenu,checked:n,children:f.jsx(Fy,{role:"menuitemcheckbox","aria-checked":uv(n)?"mixed":n,...o,ref:t,"data-state":Jk(n),onSelect:ne(o.onSelect,()=>r==null?void 0:r(uv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});v4.displayName=Ffe;var y4="MenuRadioGroup",[zfe,$fe]=ql(y4,{value:void 0,onValueChange:()=>{}}),x4=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=tn(r);return f.jsx(zfe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(qk,{...o,ref:t})})});x4.displayName=y4;var b4="MenuRadioItem",w4=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=$fe(b4,e.__scopeMenu),i=n===o.value;return f.jsx(S4,{scope:e.__scopeMenu,checked:i,children:f.jsx(Fy,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Jk(i),onSelect:ne(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});w4.displayName=b4;var Yk="MenuItemIndicator",[S4,Bfe]=ql(Yk,{checked:!1}),k4=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Bfe(Yk,n);return f.jsx(an,{present:r||uv(i.checked)||i.checked===!0,children:f.jsx(Te.span,{...o,ref:t,"data-state":Jk(i.checked)})})});k4.displayName=Yk;var Vfe="MenuSeparator",E4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});E4.displayName=Vfe;var Ufe="MenuArrow",C4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ly(n);return f.jsx(Gh,{...o,...r,ref:t})});C4.displayName=Ufe;var Hfe="MenuSub",[Bme,_4]=ql(Hfe),tf="MenuSubTrigger",P4=g.forwardRef((e,t)=>{const n=Yl(tf,e.__scopeMenu),r=yp(tf,e.__scopeMenu),o=_4(tf,e.__scopeMenu),i=Kk(tf,e.__scopeMenu),s=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),f.jsx(Hk,{asChild:!0,...c,children:f.jsx(g4,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":O4(n.open),...e,ref:Fv(t,o.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,Nh(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:ne(e.onPointerLeave,Nh(d=>{var p,m;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const v=(m=n.content)==null?void 0:m.dataset.side,x=v==="right",b=x?-5:5,w=h[x?"left":"right"],S=h[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+b,y:d.clientY},{x:w,y:h.top},{x:S,y:h.top},{x:S,y:h.bottom},{x:w,y:h.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,d=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&d.key===" "||Cfe[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});P4.displayName=tf;var N4="MenuSubContent",T4=g.forwardRef((e,t)=>{const n=f4(so,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Yl(so,e.__scopeMenu),s=yp(so,e.__scopeMenu),a=_4(N4,e.__scopeMenu),l=g.useRef(null),c=$e(t,l);return f.jsx(Ph.Provider,{scope:e.__scopeMenu,children:f.jsx(an,{present:r||i.open,children:f.jsx(Ph.Slot,{scope:e.__scopeMenu,children:f.jsx(Gk,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ne(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:ne(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),h=_fe[s.dir].includes(u.key);d&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});T4.displayName=N4;function O4(e){return e?"open":"closed"}function uv(e){return e==="indeterminate"}function Jk(e){return uv(e)?"indeterminate":e?"checked":"unchecked"}function Wfe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Kfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Gfe(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Kfe(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function qfe(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function Yfe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return qfe(n,t)}function Nh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Jfe=d4,Xfe=Hk,Zfe=h4,Qfe=p4,ehe=qk,the=m4,nhe=Fy,rhe=v4,ohe=x4,ihe=w4,she=k4,ahe=E4,lhe=C4,che=P4,uhe=T4,Xk="DropdownMenu",[dhe,Vme]=ho(Xk,[c4]),or=c4(),[fhe,M4]=dhe(Xk),j4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=or(t),c=g.useRef(null),[u=!1,d]=zr({prop:o,defaultProp:i,onChange:s});return f.jsx(fhe,{scope:t,triggerId:Ar(),triggerRef:c,contentId:Ar(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(h=>!h),[d]),modal:a,children:f.jsx(Jfe,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};j4.displayName=Xk;var R4="DropdownMenuTrigger",I4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=M4(R4,n),s=or(n);return f.jsx(Xfe,{asChild:!0,...s,children:f.jsx(Te.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Fv(t,i.triggerRef),onPointerDown:ne(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:ne(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});I4.displayName=R4;var hhe="DropdownMenuPortal",A4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=or(t);return f.jsx(Zfe,{...r,...n})};A4.displayName=hhe;var D4="DropdownMenuContent",L4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=M4(D4,n),i=or(n),s=g.useRef(!1);return f.jsx(Qfe,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});L4.displayName=D4;var phe="DropdownMenuGroup",mhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ehe,{...o,...r,ref:t})});mhe.displayName=phe;var ghe="DropdownMenuLabel",F4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(the,{...o,...r,ref:t})});F4.displayName=ghe;var vhe="DropdownMenuItem",z4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(nhe,{...o,...r,ref:t})});z4.displayName=vhe;var yhe="DropdownMenuCheckboxItem",$4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(rhe,{...o,...r,ref:t})});$4.displayName=yhe;var xhe="DropdownMenuRadioGroup",bhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ohe,{...o,...r,ref:t})});bhe.displayName=xhe;var whe="DropdownMenuRadioItem",B4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ihe,{...o,...r,ref:t})});B4.displayName=whe;var She="DropdownMenuItemIndicator",V4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(she,{...o,...r,ref:t})});V4.displayName=She;var khe="DropdownMenuSeparator",U4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(ahe,{...o,...r,ref:t})});U4.displayName=khe;var Ehe="DropdownMenuArrow",Che=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(lhe,{...o,...r,ref:t})});Che.displayName=Ehe;var _he="DropdownMenuSubTrigger",H4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(che,{...o,...r,ref:t})});H4.displayName=_he;var Phe="DropdownMenuSubContent",W4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(uhe,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});W4.displayName=Phe;var Nhe=j4,The=I4,Ohe=A4,K4=L4,G4=F4,q4=z4,Y4=$4,J4=B4,X4=V4,Z4=U4,Q4=H4,e3=W4;const Mhe=Nhe,jhe=The,Rhe=g.forwardRef(({className:e,inset:t,children:n,...r},o)=>f.jsxs(Q4,{ref:o,className:ze("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-bg-brand-primary_alt data-[state=open]:bg-bg-brand-primary",t&&"pl-8",e),...r,children:[n,f.jsx(Gv,{className:"w-4 h-4 ml-auto"})]}));Rhe.displayName=Q4.displayName;const Ihe=g.forwardRef(({className:e,...t},n)=>f.jsx(e3,{ref:n,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Ihe.displayName=e3.displayName;const t3=g.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>f.jsx(Ohe,{container:n,children:f.jsx(K4,{ref:o,sideOffset:t,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));t3.displayName=K4.displayName;const Rs=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(q4,{ref:r,className:ze("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-bg-brand-solid focus:text-text-brand-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Rs.displayName=q4.displayName;const Ahe=g.forwardRef(({className:e,children:t,checked:n,...r},o)=>f.jsxs(Y4,{ref:o,className:ze("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(X4,{children:f.jsx(Bu,{className:"w-4 h-4"})})}),t]}));Ahe.displayName=Y4.displayName;const Dhe=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(J4,{ref:r,className:ze("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(X4,{children:f.jsx(b7,{className:"w-2 h-2 fill-current"})})}),t]}));Dhe.displayName=J4.displayName;const Lhe=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(G4,{ref:r,className:ze("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Lhe.displayName=G4.displayName;const Fhe=g.forwardRef(({className:e,...t},n)=>f.jsx(Z4,{ref:n,className:ze("-mx-1 my-1 h-px bg-muted",e),...t}));Fhe.displayName=Z4.displayName;var zhe=Object.defineProperty,$he=Object.getOwnPropertyDescriptor,xp=(e,t,n,r)=>{for(var o=r>1?void 0:r?$he(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&zhe(t,n,o),o},Bhe={icon:"bold",label:({t:e})=>e(pP.LABEL),description:({t:e})=>e(pP.DESCRIPTION)},zl=class extends mp{get name(){return"bold"}createTags(){return[He.FormattingMark,He.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>yi(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>De(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...t.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",e.dom(n),0]}}}createInputRules(){return[tv({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return bh({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=uo(e??t.selection,t.doc);return n==null||n(t.addMark(r,o,this.type.create())),!0}}removeBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=uo(e??t.selection,t.doc);return t.doc.rangeHasMark(r,o,this.type)?(n==null||n(t.removeMark(r,o,this.type)),!0):!1}}shortcut(e){return this.toggleBold()(e)}};xp([ye(Bhe)],zl.prototype,"toggleBold",1);xp([ye()],zl.prototype,"setBold",1);xp([ye()],zl.prototype,"removeBold",1);xp([qr({shortcut:oe.Bold,command:"toggleBold"})],zl.prototype,"shortcut",1);zl=xp([ot({defaultOptions:{weight:void 0},staticKeys:["weight"]})],zl);var Vhe=Object.defineProperty,Uhe=Object.getOwnPropertyDescriptor,Zk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Uhe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Vhe(t,n,o),o},Hhe={icon:"italic",label:({t:e})=>e(mP.LABEL),description:({t:e})=>e(mP.DESCRIPTION)},Th=class extends mp{get name(){return"italic"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"i",getAttrs:e.parse},{tag:"em",getAttrs:e.parse},{style:"font-style=italic"},...t.parseDOM??[]],toDOM:n=>["em",e.dom(n),0]}}createKeymap(){return{"Mod-i":bh({type:this.type})}}createInputRules(){return[tv({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),tv({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(e){return bh({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};Zk([ye(Hhe)],Th.prototype,"toggleItalic",1);Zk([qr({shortcut:oe.Italic,command:"toggleItalic"})],Th.prototype,"shortcut",1);Th=Zk([ot({})],Th);var Whe=Object.defineProperty,Khe=Object.getOwnPropertyDescriptor,Qk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Khe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Whe(t,n,o),o},Ghe={icon:"strikethrough",label:({t:e})=>e(gP.LABEL),description:({t:e})=>e(gP.DESCRIPTION)},Oh=class extends mp{get name(){return"strike"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"s",getAttrs:e.parse},{tag:"del",getAttrs:e.parse},{tag:"strike",getAttrs:e.parse},{style:"text-decoration",getAttrs:n=>n==="line-through"?{}:!1},...t.parseDOM??[]],toDOM:n=>["s",e.dom(n),0]}}toggleStrike(){return bh({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[tv({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};Qk([ye(Ghe)],Oh.prototype,"toggleStrike",1);Qk([qr({shortcut:oe.Strike,command:"toggleStrike"})],Oh.prototype,"shortcut",1);Oh=Qk([ot({})],Oh);var qhe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="rotate(90)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',Yhe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="matrix(0 1 1 0 0 0)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',Jhe=encodeURIComponent(qhe),Xhe=encodeURIComponent(Yhe),Gn,VN,Zhe=(VN=class{constructor(e){$t(this,"dom");Rn(this,Gn);$t(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,Xe(this,Gn,n),this.type=e,this.createHandle(e)}createHandle(e){switch(Ln(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),Ln(ue(this,Gn),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),ue(this,Gn).dataset.dragging="",e){case 0:Ln(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Ln(ue(this,Gn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 1:Ln(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Ln(ue(this,Gn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 2:Ln(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),Ln(ue(this,Gn),{width:" 42px",height:"4px",boxSizing:"content-box",maxWidth:"50%",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 3:Ln(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),Ln(ue(this,Gn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Xhe}") `});break;case 4:Ln(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),Ln(ue(this,Gn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Jhe}") `});break}this.dom.append(ue(this,Gn))}setHandleVisibility(e){const t=e||!!ue(this,Gn).dataset.dragging;ue(this,Gn).style.opacity=t?"1":"0"}dataSetDragging(e){ue(this,Gn).dataset.dragging=e?"true":""}},Gn=new WeakMap,VN),tm=50,n3=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(n3||{}),Us,Hs,Ws,ni,Ks,UN,Qhe=(UN=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){$t(this,"dom");Rn(this,Us);Rn(this,Hs);Rn(this,Ws,[]);$t(this,"aspectRatio");Rn(this,ni);Rn(this,Ks);const s=this.createWrapper(e,i),a=this.createElement({node:e,view:t,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(h=>new Zhe(h));for(const h of c){const p=m=>{this.startResizing(m,t,n,h)};h.dom.addEventListener("mousedown",p),ue(this,Ws).push(()=>h.dom.removeEventListener("mousedown",p)),s.append(h.dom)}const u=()=>{c.forEach(h=>h.setHandleVisibility(!0))},d=()=>{c.forEach(h=>h.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",d),ue(this,Ws).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",d)),s.append(a),this.dom=s,Xe(this,Hs,e),Xe(this,Us,a),this.aspectRatio=r}createWrapper(e,t){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",t?Ln(n,{width:DN(t.width),aspectRatio:`${t.width} / ${t.height}`}):Ln(n,{width:DN(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),Ln(n,{maxWidth:"100%",minWidth:`${tm}px`,verticalAlign:"bottom",display:"inline-block",lineHeight:"0",transition:"width 0.15s ease-out, height 0.15s ease-out"}),n}startResizing(e,t,n,r){var u,d;e.preventDefault(),r.dataSetDragging(!0),ue(this,Us).style.pointerEvents="none";const o=e.pageX,i=e.pageY,s=((u=ue(this,Us))==null?void 0:u.getBoundingClientRect().width)||0,a=((d=ue(this,Us))==null?void 0:d.getBoundingClientRect().height)||0,l=Jb(100,!1,h=>{const p=h.pageX,m=h.pageY,v=p-o,x=m-i;let b=null,w=null;if(this.aspectRatio===0&&s&&a)switch(r.type){case 0:case 3:b=s+v,w=a/s*b;break;case 1:case 4:b=s-v,w=a/s*b;break;case 2:w=a+x,b=s/a*w;break}else if(this.aspectRatio===1)switch(r.type){case 0:b=s+v;break;case 1:b=s-v;break;case 2:w=a+x;break;case 3:b=s+v,w=a+x;break;case 4:b=s-v,w=a+x;break}typeof b=="number"&&b<tm&&(this.aspectRatio===0&&s&&a?(b=tm,w=a/s*b):this.aspectRatio===1&&(b=tm)),b&&(Xe(this,ni,Math.round(b)),this.dom.style.width=`${ue(this,ni)}px`),w&&Xe(this,Ks,Math.round(w)),(b||w)&&(this.dom.style.aspectRatio=`${ue(this,ni)} / ${ue(this,Ks)}`)}),c=h=>{h.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),ue(this,Us).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const p=n(),m=t.state.tr.setNodeMarkup(p,void 0,{...ue(this,Hs).attrs,width:ue(this,ni),height:ue(this,Ks)});t.dispatch(m)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),ue(this,Ws).push(()=>document.removeEventListener("mousemove",l)),ue(this,Ws).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==ue(this,Hs).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==ue(this,ni)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==ue(this,ni)&&e.attrs.height!==ue(this,Ks)||!epe(ue(this,Hs),e,["width","height"])?!1:(Xe(this,Hs,e),Xe(this,ni,e.attrs.width),Xe(this,Ks,e.attrs.height),!0)}destroy(){ue(this,Ws).forEach(e=>e())}},Us=new WeakMap,Hs=new WeakMap,Ws=new WeakMap,ni=new WeakMap,Ks=new WeakMap,UN);function epe(e,t,n){return e===t||tpe(e,t,n)&&e.content.eq(t.content)}function tpe(e,t,n){const r=e.attrs,o=t.attrs,i={};for(const a of n)i[a]=null;e.attrs={...r,...i},t.attrs={...o,...i};const s=e.sameMarkup(t);return e.attrs=r,t.attrs=o,s}function DN(e){return typeof e=="number"?`${e}px`:e||void 0}var npe=Object.defineProperty,rpe=Object.getOwnPropertyDescriptor,eE=(e,t,n,r)=>{for(var o=r>1?void 0:r?rpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&npe(t,n,o),o},ope=class extends Qhe{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:n3.Fixed})}createElement({node:e}){const t=document.createElement("img");return t.setAttribute("src",e.attrs.src),Ln(t,{width:"100%",minWidth:"50px",objectFit:"contain"}),t}},Mh=class extends go{get name(){return"image"}createTags(){return[He.InlineNode,He.Media]}createNodeSpec(e,t){const{preferPastedTextContent:n}=this.options;return{inline:!0,draggable:!0,selectable:!1,...t,attrs:{...e.defaults(),alt:{default:""},crop:{default:null},height:{default:null},width:{default:null},rotate:{default:null},src:{default:null},title:{default:""},fileName:{default:null},resizable:{default:!1}},parseDOM:[{tag:"img[src]",getAttrs:r=>{var o;if(yi(r)){const i=spe({element:r,parse:e.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=tL(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:i}=uo(t??n.selection,n.doc),s=this.type.create(e);return r==null||r(n.replaceRangeWith(o,i,s)),!0}}uploadImage(e,t){const{updatePlaceholder:n,destroyPlaceholder:r,createPlaceholder:o}=this.options;return i=>{const{tr:s}=i;let a=s.selection.from;return this.store.createPlaceholderCommand({promise:e,placeholder:{type:"widget",get pos(){return a},createElement:(l,c)=>{const u=o(l,c);return t==null||t(u),u},onUpdate:(l,c,u,d)=>{n(l,c,u,d)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=J2(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(i)}}fileUploadFileHandler(e,t,n){var c;const{preferPastedTextContent:r,uploadHandler:o}=this.options;if(r&&cpe(t)&&((c=t.clipboardData)!=null&&c.getData("text/plain")))return!1;const{commands:i,chain:s}=this.store,a=e.map((u,d)=>({file:u,progress:h=>{i.updatePlaceholder(l[d],h)}})),l=o(a);Br(n)&&s.selectText(n);for(const u of l)s.uploadImage(u);return s.run(),!0}createPasteRules(){return[{type:"file",regexp:/image/i,fileHandler:e=>{const t=e.type==="drop"?e.pos:void 0;return this.fileUploadFileHandler(e.files,e.event,t)}}]}createNodeViews(){return this.options.enableResizing?(e,t,n)=>new ope(e,t,n):{}}};eE([ye()],Mh.prototype,"insertImage",1);eE([ye()],Mh.prototype,"uploadImage",1);Mh=eE([ot({defaultOptions:{createPlaceholder:ape,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:lpe,enableResizing:!1,preferPastedTextContent:!0}})],Mh);function ipe(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function spe({element:e,parse:t}){const{width:n,height:r}=ipe(e);return{...t(e),alt:e.getAttribute("alt")??"",height:Number.parseInt(r||"0",10)||null,src:e.getAttribute("src")??null,title:e.getAttribute("title")??"",width:Number.parseInt(n||"0",10)||null,fileName:e.getAttribute("data-file-name")??null}}function ape(e,t){const n=document.createElement("div");return n.classList.add(Tue.IMAGE_LOADER),n}function lpe(e){Pe(e.length>0,{code:re.EXTENSION,message:"The upload handler was applied for the image extension without any valid files"});let t=0;const n=[];for(const{file:r,progress:o}of e)n.push(()=>new Promise(i=>{const s=new FileReader;s.addEventListener("load",a=>{var l;t+=1,o(t/e.length),i({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),s.readAsDataURL(r)}));return n}function cpe(e){return e.clipboardData!==void 0}function upe(e={}){return new fs({view(t){return new dpe(t,e)}})}class dpe{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r;if(n){let a=t.nodeBefore,l=t.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=X2(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}}var fpe=Object.defineProperty,hpe=Object.getOwnPropertyDescriptor,ppe=(e,t,n,r)=>{for(var o=r>1?void 0:r?hpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&fpe(t,n,o),o},Aw=class extends Nt{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[upe({color:e,width:t})]}};Aw=ppe([ot({defaultOptions:{color:"black",width:1}})],Aw);var mpe=Object.defineProperty,gpe=Object.getOwnPropertyDescriptor,r3=(e,t,n,r)=>{for(var o=r>1?void 0:r?gpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&mpe(t,n,o),o},{LABEL:vpe}=xQ,ype={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({...vpe,values:{level:t==null?void 0:t.level}})},xpe=[oe.H1,oe.H2,oe.H3,oe.H4,oe.H5,oe.H6],dv=class extends go{get name(){return"heading"}createTags(){return[He.Block,He.TextBlock,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),level:{default:this.options.defaultLevel}},parseDOM:[...this.options.levels.map(n=>({tag:`h${n}`,getAttrs:r=>({...e.parse(r),level:n})})),...t.parseDOM??[]],toDOM:n=>this.options.levels.includes(n.attrs.level)?[`h${n.attrs.level}`,e.dom(n),0]:[`h${this.options.defaultLevel}`,e.dom(n),0]}}toggleHeading(e={}){return oL({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension(Ge),n=we(),r=[];for(const o of this.options.levels){const i=xpe[o-1]??oe.H1;n[i]=ev(this.type,{level:o}),r.push({attrs:{level:o},shortcut:e(i)[0]})}return t.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(e=>zQ(new RegExp(`^(#{1,${e}})\\s$`),this.type,()=>({level:e})))}createPasteRules(){return this.options.levels.map(e=>({type:"node",nodeType:this.type,regexp:new RegExp(`^#{${e}}\\s([\\s\\w]+)$`),getAttributes:()=>({level:e}),startOfTextBlock:!0}))}};r3([ye(ype)],dv.prototype,"toggleHeading",1);dv=r3([ot({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],dv);var o3={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:X3,function(){return function(n){function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var o={};return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)}([function(n,r,o){function i(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function s(c){typeof c!="string"&&i();for(var u=0,d=0,h=0,p=c.length,m=0;p--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,d=m);for(u=m,m=d;m--;)if(l.indexOf(c[m])!==-1){h=m+1;break}return 2>h?"":c.slice(h,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],d,h=0;for(d=c.length;h<d;h++)u.push(s(c[h]));return u}i()}}])})})(o3);var bpe=o3.exports;const wpe=Ma(bpe);var Spe=Object.defineProperty,kpe=Object.getOwnPropertyDescriptor,bp=(e,t,n,r)=>{for(var o=r>1?void 0:r?kpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Spe(t,n,o),o},Epe=["com","de","net","org","uk","cn","ga","nl","cf","ml","tk","ru","br","gq","xyz","fr","eu","info","co","au","ca","it","in","ch","pl","es","online","us","top","be","jp","biz","se","at","dk","cz","za","me","ir","icu","shop","kr","site","mx","hu","io","cc","club","no","cyou"],LN="updateLink",Cpe=/(?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)*(?:(?:\d(?!\.)|[a-z\u00A1-\uFFFF])(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)+[a-z\u00A1-\uFFFF]{2,}(?::\d{2,5})?(?:[#/?]\S*)?/gi,$l=class extends mp{constructor(){super(...arguments);$t(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[He.Link,He.ExcludeInputRules]}createMarkSpec(t,n){const r="data-link-auto",o=i=>{const{defaultTarget:s,supportedTargets:a}=this.options,l=s?[...a,s]:a;return i&&Go(l,i)?{target:i}:void 0};return{inclusive:!1,excludes:"_",...n,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:i=>{if(!yi(i))return!1;const s=i.getAttribute("href"),a=i.textContent,l=this.options.autoLink&&(i.hasAttribute(r)||s===a||(s==null?void 0:s.replace(`${this.options.defaultProtocol}//`,""))===a);return{...t.parse(i),href:s,auto:l,...o(i.getAttribute("target"))}}},...n.parseDOM??[]],toDOM:i=>{const{auto:s,target:a,...l}=tL(i.attrs,t),c=i.attrs.auto?{[r]:""}:{};return["a",{...t.dom(i),...l,rel:"noopener noreferrer nofollow",...c,...o(i.attrs.target)},0]}}}onCreate(){const{autoLinkRegex:t}=this.options;this._autoLinkRegexNonGlobal=new RegExp(`^${t.source}$`,t.flags.replace("g",""))}shortcut({tr:t}){let n="",{from:r,to:o,empty:i,$from:s}=t.selection,a=!1;const l=ls(s,this.type);if(i){const c=l??ZD(t);if(!c)return!1;({text:n,from:r,to:o}=c),a=!0}return r===o?!1:(a||(n=t.doc.textBetween(r,o)),this.options.onActivateLink(n),this.options.onShortcut({activeLink:l?{attrs:l.mark.attrs,from:l.from,to:l.to}:void 0,selectedText:n,from:r,to:o}),!0)}updateLink(t,n){return r=>{const{tr:o}=r;return!(Kl(o.selection)&&!Ck(o.selection)||sne(o.selection)||Qg({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:LN,attrs:t,range:n}),_ne({type:this.type,attrs:t,range:n})(r))}}selectLink(){return this.store.commands.selectMark.original(this.type)}removeLink(t){return n=>{const{tr:r}=n;return Qg({trState:r,type:this.type,...t})?sL({type:this.type,expand:!0,range:t})(n):!1}}createPasteRules(){return[{type:"mark",regexp:this.options.autoLinkRegex,markType:this.type,getAttributes:(t,n)=>({href:this.buildHref(wf(t)),auto:!n}),transformMatch:t=>{const n=wf(t);return!n||!this.isValidUrl(n)?!1:n}}]}createEventHandlers(){return{clickMark:(t,n)=>{const r=n.getMark(this.type);if(!r)return;const o=r.mark.attrs,i={...o,...r};if(this.options.onClick(t,i))return!0;if(!this.store.view.editable)return;let s=!1;if(this.options.openLinkOnClick){s=!0;const a=o.href;window.open(a,"_blank")}return this.options.selectTextOnClick&&(s=!0,this.store.commands.selectText(r)),s}}}createPlugin(){return{appendTransaction:(t,n,r)=>{if(t.filter(m=>!!m.getMeta(this.name)).forEach(m=>{const v=m.getMeta(this.name);if(v.command===LN){const{range:x,attrs:b}=v,{selection:w,doc:S}=r,C={range:x,selection:w,doc:S,attrs:b},{from:_,to:P}=x??w;this.options.onUpdateLink(S.textBetween(_,P),C)}}),!this.options.autoLink||Tw(n)-Tw(r)===1||!t.some(m=>m.docChanged))return;const a=Gte(t,n),l=dne(a,[Ht,hn]),{mapping:c}=a,{tr:u,doc:d}=r,{updateLink:h,removeLink:p}=this.store.chain(u);if(l.forEach(({prevFrom:m,prevTo:v,from:x,to:b})=>{const w=[],S=b-x===2,C=this.getLinkMarksInRange(n.doc,m,v,!0).filter(_=>_.mark.type===this.type).map(({from:_,to:P,text:O})=>({mappedFrom:c.map(_),mappedTo:c.map(P),text:O,from:_,to:P}));C.forEach(({mappedFrom:_,mappedTo:P,from:O,to:M},I)=>this.getLinkMarksInRange(d,_,P,!0).filter(L=>L.mark.type===this.type).forEach(L=>{const U=n.doc.textBetween(O,M,void 0," "),$=d.textBetween(L.from,L.to+1,void 0," ").trim(),K=this.isValidUrl(U);this.isValidUrl($)||(K&&(p({from:L.from,to:L.to}).tr(),C.splice(I,1)),!S&&x===b&&this.findAutoLinks($).map(B=>this.addLinkProperties({...B,from:_+B.start,to:_+B.end})).forEach(({attrs:B,range:A,text:R})=>{h(B,A).tr(),w.push({attrs:B,range:A,text:R})}))})),this.findTextBlocksInRange(d,{from:x,to:b}).forEach(({text:_,positionStart:P})=>{this.findAutoLinks(_).map(O=>this.addLinkProperties({...O,from:P+O.start+1,to:P+O.end+1})).filter(({range:O})=>{const M=x>=O.from&&x<=O.to,I=b>=O.from&&b<=O.to;return M||I||S}).filter(({range:O})=>this.getLinkMarksInRange(u.doc,O.from,O.to,!1).length===0).filter(({range:{from:O},text:M})=>!C.some(({text:I,mappedFrom:L})=>L===O&&I===M)).forEach(({attrs:O,text:M,range:I})=>{h(O,I).tr(),w.push({attrs:O,range:I,text:M})})}),window.requestAnimationFrame(()=>{w.forEach(({attrs:_,range:P,text:O})=>{const{doc:M,selection:I}=u;this.options.onUpdateLink(O,{attrs:_,doc:M,range:P,selection:I})})})}),u.steps.length!==0)return u}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,n,r,o){const i=[];if(n===r){const s=Math.max(n-1,0),a=t.resolve(s),l=ls(a,this.type);(l==null?void 0:l.mark.attrs.auto)===o&&i.push(l)}else t.nodesBetween(n,r,(s,a)=>{const c=(s.marks??[]).find(({type:u,attrs:d})=>u===this.type&&d.auto===o);c&&i.push({from:a,to:a+s.nodeSize,mark:c,text:s.textContent})});return i}findTextBlocksInRange(t,n){const r=[];return t.nodesBetween(n.from,n.to,(o,i)=>{!o.isTextblock||!o.type.allowsMarkType(this.type)||r.push({node:o,pos:i})}),r.map(o=>({text:t.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," "),positionStart:o.pos}))}addLinkProperties({from:t,to:n,href:r,...o}){return{...o,range:{from:t,to:n},attrs:{href:r,auto:!0}}}findAutoLinks(t){if(this.options.findAutoLinks)return this.options.findAutoLinks(t,this.options.defaultProtocol);const n=[];for(const r of xy(t,this.options.autoLinkRegex)){const o=wf(r);if(!o)continue;const i=this.buildHref(o);!this.isValidTLD(i)&&!i.startsWith("tel:")||n.push({text:o,href:i,start:r.index,end:r.index+o.length})}return n}isValidUrl(t){var n;return this.options.isValidUrl?this.options.isValidUrl(t,this.options.defaultProtocol):this.isValidTLD(this.buildHref(t))&&!!((n=this._autoLinkRegexNonGlobal)!=null&&n.test(t))}isValidTLD(t){const{autoLinkAllowedTLDs:n}=this.options;if(n.length===0)return!0;const r=wpe(t);if(r==="")return!0;const o=oZ(r.split("."));return n.includes(o)}};bp([qr({shortcut:oe.InsertLink})],$l.prototype,"shortcut",1);bp([ye()],$l.prototype,"updateLink",1);bp([ye()],$l.prototype,"selectLink",1);bp([ye()],$l.prototype,"removeLink",1);$l=bp([ot({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:Cpe,autoLinkAllowedTLDs:Epe,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:_pe},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:ht.Medium})],$l);function _pe({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var Ppe=Object.defineProperty,Npe=Object.getOwnPropertyDescriptor,i3=(e,t,n,r)=>{for(var o=r>1?void 0:r?Npe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ppe(t,n,o),o},fv=class extends go{get name(){return"hardBreak"}createTags(){return[He.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
|
|
489
|
+
`,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=Kte(bf(dL),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":e,"Shift-Enter":e}}insertHardBreak(){return e=>{const{tr:t,dispatch:n}=e;return n==null||n(t.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};i3([ye()],fv.prototype,"insertHardBreak",1);fv=i3([ot({defaultPriority:ht.Low})],fv);const Tpe=()=>[new zl({}),new Th,new Oh,new Mh({enableResizing:!1}),new Aw({}),new dv({levels:[1,2,3,4,5,6],defaultLevel:1}),new Ch({}),new _h,new $l({autoLink:!0}),new fv].slice();function Ope(e){const{manager:t,state:n,setState:r}=jde({extensions:Tpe,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function Mpe({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,disabled:a,autoFocus:l}){const c=r&&Object.entries(r).some(([,p])=>p),[u,d]=g.useState(c),h=g.useMemo(()=>[ve("p-4 outline-none focus:outline-none appearance-none bg-bg-primary rounded-b-md")],[u]);return f.jsx("div",{autoFocus:l,onFocus:()=>{i&&i(!0)},onBlur:()=>{i&&i(!1)},className:ve("relative text-base m-1 val-rich-text-editor focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 border border-input rounded-md"),children:f.jsxs(Ide,{manager:n,initialContent:e,state:t,classNames:h,onChange:o,editable:!a,children:[f.jsx(jpe,{hasOptions:c,options:r,debug:s,setShowToolbar:d}),f.jsx(Mw,{})]})})}const jpe=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,d,h,p,m,v,x,b,w,S,C,_,P,O,M,I,L,U,$,K,W,B,A,R,N,D;const o=GL(),i=Sde(),s=t||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();g.useEffect(()=>{r(s)},[s]);const a=g.useRef(null);return f.jsxs("div",{children:[f.jsx("div",{className:"h-0",ref:a}),f.jsxs("div",{className:ve("sticky top-0 flex flex-col py-2 z-[40] divide-y rounded-md rounded-b-none border-b border-input bg-primary-foreground",{hidden:!s}),children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[(((l=e==null?void 0:e.block)==null?void 0:l.h1)||((c=e==null?void 0:e.block)==null?void 0:c.h2)||((u=e==null?void 0:e.block)==null?void 0:u.h3)||((d=e==null?void 0:e.block)==null?void 0:d.h4)||((h=e==null?void 0:e.block)==null?void 0:h.h5)||((p=e==null?void 0:e.block)==null?void 0:p.h6)||i.heading())&&f.jsxs(Mhe,{children:[f.jsx(jhe,{asChild:!0,className:"pr-4",children:f.jsxs("button",{children:[i.heading({level:1})&&f.jsx(r_,{size:22}),i.heading({level:2})&&f.jsx(o_,{size:22}),i.heading({level:3})&&f.jsx(i_,{size:22}),i.heading({level:4})&&f.jsx(s_,{size:22}),i.heading({level:5})&&f.jsx(a_,{size:22}),i.heading({level:6})&&f.jsx(l_,{size:22}),!i.heading()&&"Normal"]})}),f.jsxs(t3,{container:a.current,children:[f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:f.jsx(r_,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:f.jsx(o_,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h3)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:f.jsx(i_,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h4)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:f.jsx(s_,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:f.jsx(a_,{size:16})}),((S=e==null?void 0:e.block)==null?void 0:S.h6)&&f.jsx(Rs,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:f.jsx(l_,{size:16})})]})]}),(((C=e==null?void 0:e.style)==null?void 0:C.bold)||i.bold())&&f.jsx(cc,{icon:f.jsx(g7,{size:18}),stroke:3,isOption:(_=e==null?void 0:e.style)==null?void 0:_.bold,isActive:((P=e==null?void 0:e.style)==null?void 0:P.bold)||i.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((O=e==null?void 0:e.style)==null?void 0:O.lineThrough)||i.strike())&&f.jsx(cc,{icon:f.jsx(U7,{size:18}),stroke:3,isOption:(M=e==null?void 0:e.style)==null?void 0:M.lineThrough,isActive:((I=e==null?void 0:e.style)==null?void 0:I.lineThrough)||i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((L=e==null?void 0:e.style)==null?void 0:L.italic)||i.italic())&&f.jsx(cc,{icon:f.jsx(_7,{size:18}),stroke:3,isOption:(U=e==null?void 0:e.style)==null?void 0:U.italic,isActive:(($=e==null?void 0:e.style)==null?void 0:$.italic)||i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((K=e==null?void 0:e.block)==null?void 0:K.ul)||i.bulletList())&&f.jsx(cc,{icon:f.jsx(NR,{size:18}),stroke:3,isActive:((W=e==null?void 0:e.block)==null?void 0:W.ul)||i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((B=e==null?void 0:e.block)==null?void 0:B.ol)||i.orderedList())&&f.jsx(cc,{icon:f.jsx(O7,{size:18}),stroke:3,isActive:((A=e==null?void 0:e.block)==null?void 0:A.ol)||i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((R=e==null?void 0:e.inline)==null?void 0:R.a)||i.link())&&f.jsx(cc,{icon:f.jsx(T7,{size:18}),stroke:3,isActive:((N=e==null?void 0:e.inline)==null?void 0:N.a)||i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((D=e==null?void 0:e.inline)==null?void 0:D.img)||i.image())&&f.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[f.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:z=>{o2(z).then(V=>{o.insertImage({src:V.src,width:V.width,height:V.height,fileName:X.createFilename(V.src,V.filename??null,{width:V.width,height:V.height,mimeType:V.mimeType},V.fileHash)??void 0}).focus().run(),z.target.value=""})}}),f.jsx(PR,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&f.jsx("button",{onMouseDown:z=>z.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),f.jsx(Rpe,{})]})]})};function Rpe(){const e=GL(),[t,n]=g.useState(),r=kde().link();return g.useEffect(()=>{const i=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(i)},[r==null?void 0:r.href]),r!==void 0?f.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[f.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:t,placeholder:"https://"}),f.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:f.jsx(Bu,{size:14})}),f.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:f.jsx(X7,{size:13})})]}):null}function cc({stroke:e,isActive:t,onToggle:n,icon:r}){return f.jsx("button",{className:ve({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function Ipe({path:e,autoFocus:t}){const n="richtext",r=Fu(),o=Dt(e),i=at(e,n),s=vS(),a=yS(),l="data"in i?i.data:void 0,{manager:c}=Ope(l&&zp(l)),u=g.useRef(!1),{patchPath:d,addPatch:h,addAndUploadPatchWithFileOps:p}=On(e),[m,v]=g.useState(c.createState({content:l&&zp(l)})),x="data"in i&&i.data,b="clientSideOnly"in i&&i.clientSideOnly;g.useEffect(()=>{b===!1&&v(C=>{try{const _=x?zp(x):void 0,P=c.createState({content:_,selection:C.selection});return P.doc.eq(C.doc)?C:P}catch(_){return console.error("Error (re)creating editor state with selection, retrying without...",_),c.createState({content:x?zp(x):void 0})}})},[x,b]);const w=g.useMemo(()=>{var _,P;if(!("data"in o&&o.data.type==="richtext"))return null;const C=o.data;return typeof((P=(_=C.options)==null?void 0:_.inline)==null?void 0:P.img)=="object"&&C.options.inline.img.remote&&s.status==="ready"&&(r!=null&&r.remoteHost)&&a?{publicProjectId:s.publicProjectId,bucket:a,coreVersion:s.coreVersion,schema:C.options.inline.img,remoteHost:r==null?void 0:r.remoteHost}:null},[o,s,r,a]);if(o.status==="error")return f.jsx(Jt,{path:e,error:o.error,type:n});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:n});if(i.status=="not-found"||o.status==="not-found")return f.jsx(Pn,{path:e,type:n});if(o.status==="loading")return f.jsx(gt,{path:e,type:n});if(!("data"in i)||i.data===void 0)return f.jsx(gt,{path:e,type:n});if(o.data.type!==n)return f.jsx(vr,{path:e,expectedType:n,actualType:o.data.type});const S=o.data;return r!=null&&r.remoteHost||console.warn("RichTextField: config.remoteHost is not set. Remote images will not work."),f.jsxs("div",{id:e,children:[f.jsx($r,{path:e}),f.jsx(Mpe,{autoFocus:t,disabled:u.current,state:m,options:S.options,manager:c,onChange:async C=>{var P;const _=m==null?void 0:m.doc;if(!u.current&&(v(C.state),_&&!C.state.doc.eq(_))){const O=Ape(d,((P=r==null?void 0:r.files)==null?void 0:P.directory)??"/public/val",C.state.doc.toJSON(),w);O.some(M=>M.op==="file")?(u.current=!0,await p(O,"image",M=>{alert("Error uploading image. Please try again later."),console.error("Error uploading image",M)},(M,I,L,U)=>{console.log(`Uploading ${M}/${I} (${L}/${U})`)}).finally(()=>{u.current=!1})):h(O,"richtext")}}})]})}function Ape(e,t,n,r){const{blocks:o,files:i}=n?gU(n,t,r):{blocks:[],files:{}};return[{op:"replace",path:e,value:o},...Object.values(i).flatMap(({value:s,filePathOrRef:a,metadata:l,patchPaths:c})=>c.map(u=>({op:"file",path:e,filePath:a,value:s,metadata:l,nestedFilePath:u,remote:!!r})))]}function Dpe({path:e}){const t=at(e,"richtext");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"richtext"});if(t.status=="not-found")return f.jsx(Pn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=Lpe(t.data);return n.status==="error"?f.jsx(nt,{path:e,error:n.error,type:"richtext"}):f.jsx("div",{className:"truncate",children:n.value})}function Lpe(e){let t;function n(o){if(t)return t;if(typeof o=="string")return o;if(typeof o=="object"&&o){if("children"in o&&Array.isArray(o.children))return o.children.map(n).join(" ");if("tag"in o&&typeof o.tag=="string")return""}return t="Invalid richtext node: "+JSON.stringify(o),JSON.stringify(o)}const r=e.map(n).join(" ");return t?{status:"error",error:t}:{status:"ok",value:r}}function tE({path:e}){const t=Dt(e),n=at(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return f.jsx(gr,{path:e});if(r==="string")return f.jsx(tJ,{path:e});if(r==="array")return f.jsx(Hpe,{path:e});if(r==="boolean")return f.jsx(oJ,{path:e});if(r==="number")return f.jsx(sJ,{path:e});if(r==="union")return f.jsx(QJ,{path:e});if(r==="object")return f.jsx(qJ,{path:e});if(r==="image")return f.jsx(aX,{path:e});if(r==="keyOf")return f.jsx(uX,{path:e});if(r==="date")return f.jsx(fX,{path:e});if(r==="literal")return f.jsx(hX,{path:e});if(r==="record")return f.jsx(yX,{path:e});if(r==="richtext")return f.jsx(Dpe,{path:e});if(r==="file")return f.jsx(oX,{path:e});{const o=r;return f.jsxs("div",{children:["Cannot preview: ",o]})}}function mr({path:e}){return f.jsx("div",{id:e,children:f.jsx(co,{size:12,className:"animate-spin"})},e+"-loading")}function gr({path:e}){return f.jsx("div",{id:e,className:"text-text-quartenary",children:"null"},e+"-null")}function Fpe({source:e,preview:t,path:n,schema:r,disabled:o,onClick:i,onMove:s,onDelete:a}){const[l,c]=g.useState([]);g.useEffect(()=>{const h=[];let p=1;for(const m of e)h.push({path:m,id:p}),p++;c(h)},[e,n]);const u=Oq(Wx(lA),Wx(cA),Wx(JS,{coordinateGetter:QY})),d=g.useCallback(h=>{const{active:p,over:m}=h;if((p==null?void 0:p.id)!==(m==null?void 0:m.id)){const v=l.findIndex(b=>b.id===Number(p==null?void 0:p.id)),x=l.findIndex(b=>b.id===Number(m==null?void 0:m.id));c(b=>ZS(b,v,x)),s(v,x)}},[l]);return f.jsx(OY,{sensors:u,collisionDetection:jq,onDragEnd:d,children:f.jsx(UY,{items:l,strategy:BY,disabled:o,children:f.jsx("div",{className:"flex flex-col w-full gap-y-4",children:l.map(({path:h,id:p})=>f.jsx(zpe,{id:p,schema:r,disabled:o,previewLayout:t==null?void 0:t.layout,preview:t==null?void 0:t.items[p-1],path:h,onClick:i,onDelete:m=>{a(m-1)}},p))})})})}const FN=170;function zpe({id:e,path:t,schema:n,disabled:r,preview:o,onClick:i,onDelete:s}){var w,S;const a=g.useRef(null),[l,c]=g.useState(!1);g.useEffect(()=>{a.current&&(a.current.getBoundingClientRect().height>=FN?c(!0):c(!1))},[e,t]);const{attributes:u,listeners:d,setNodeRef:h,transform:p,transition:m}=JY({id:e,disabled:r===!0}),v=Da()||{},x={transform:lh.Transform.toString(p),transition:m},b=!0;return f.jsxs("div",{"touch-action":"manipulation",ref:h,style:x,className:ve("flex disabled:opacity-55 flex-1",{"items-start":!b,"items-center":b}),children:[f.jsx("button",{...u,...d,className:ve("pt-2 my-1",{"opacity-30":r}),disabled:r,onClick:()=>{i(t)},children:f.jsx(E7,{})}),f.jsx("button",{className:"pt-2 my-1 mr-2 -ml-1 font-serif text-accent",disabled:r,onClick:()=>{i(t)},children:Vpe(e)}),!o&&((w=n==null?void 0:n.item)==null?void 0:w.type)==="string"&&f.jsx("div",{className:"flex-grow w-full",children:f.jsx(xA,{path:t})}),(o||((S=n==null?void 0:n.item)==null?void 0:S.type)!=="string")&&f.jsxs("button",{className:ve("flex-grow","relative flex text-left border rounded-lg border-border bg-card gap-y-2 bg-bg-primary","hover:bg-bg-secondary_subtle"),style:{maxHeight:FN},ref:a,disabled:r,onClick:()=>{i(t)},children:[o&&f.jsx($pe,{...o}),!o&&f.jsx("div",{className:"flex-grow w-full p-4",children:f.jsx(tE,{path:t})}),l&&f.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-b via-50% from-transparent via-card/90 to-card",style:{height:40}})]}),f.jsxs("button",{className:ve("flex gap-x-2",{"items-start pt-4":!b,"items-center":b}),onClick:()=>{s(e)},children:[a2(t,v)?f.jsx(l2,{}):f.jsx("div",{className:"w-2 h-2"}),f.jsx(G7,{className:"w-4 h-4 mr-2"})]})]})}function $pe({title:e,image:t,subtitle:n}){return f.jsxs("div",{className:ve("flex w-full items-center justify-between pl-4 flex-grow"),children:[f.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[f.jsx("div",{className:"text-lg font-medium",children:e}),n&&f.jsx("div",{className:"flex-shrink block overflow-hidden text-sm text-gray-500 text-ellipsis max-h-5",children:n})]}),t&&f.jsx(Bpe,{src:t,alt:e})]})}function Bpe({src:e,alt:t}){var i;const[n,r]=g.useState(!1);if(e==null)return f.jsx("div",{className:"flex-shrink-0 w-20 h-20 ml-4 opacity-25 bg-bg-brand-secondary"});const o=e[Ie]==="file"?X.convertFileSource(e).url:X.convertRemoteSource(e).url;return f.jsxs("div",{className:"relative flex-shrink-0 w-20 h-20 ml-4",children:[!n&&f.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),f.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(i=e.metadata)!=null&&i.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function Vpe(e){return(e-1).toString()}function Upe({path:e}){const t="array",{navigate:n}=Mn(),r=Dt(e),o=xR(e),i=at(e,t),{addPatch:s,patchPath:a}=On(e);if(r.status==="error")return f.jsx(Jt,{path:e,error:r.error,type:t});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:t});if(i.status=="not-found"||r.status==="not-found")return f.jsx(Pn,{path:e,type:t});if(r.status==="loading")return f.jsx(gt,{path:e,type:t});if(r.data.type!=="array")return f.jsx(vr,{path:e,expectedType:"array",actualType:r.data.type});const l=r.data,c=o&&"data"in o?o.data:void 0,u=c&&(i.status==="success"&&i.clientSideOnly||i.status==="loading");return f.jsxs("div",{id:e,className:"relative w-full",children:[f.jsx($r,{path:e}),(o==null?void 0:o.status)==="error"&&f.jsx(c2,{error:o.message,path:e}),u&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-bg-disabled z-[40] opacity-40",children:f.jsx(co,{className:"animate-spin"})}),f.jsx(Fpe,{path:e,disabled:u,onClick:d=>{n(d)},onDelete:async d=>{s([{op:"remove",path:a.concat(d.toString())}],l.type)},onMove:async(d,h)=>{s([{op:"move",from:a.concat(d.toString()),path:a.concat(h.toString())}],l.type)},schema:l,preview:(c==null?void 0:c.layout)==="list"&&c.parent==="array"?c:void 0,source:i.data||[]})]})}function Hpe({path:e}){const t=at(e,"array");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"array"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{children:`${t.data.length} items`})}function zy({path:e,schema:t,autoFocus:n}){if(t.type==="string")return f.jsx(xA,{path:e,autoFocus:n},e);if(t.type==="number")return f.jsx(iJ,{path:e},e);if(t.type==="boolean")return f.jsx(nJ,{path:e},e);if(t.type==="image")return f.jsx(iX,{path:e},e);if(t.type==="object")return f.jsx(GJ,{path:e},e);if(t.type==="array")return f.jsx(Upe,{path:e},e);if(t.type==="record")return f.jsx(pX,{path:e},e);if(t.type==="union")return f.jsx(JJ,{path:e},e);if(t.type==="keyOf")return f.jsx(lX,{path:e},e);if(t.type==="richtext")return f.jsx(Ipe,{path:e,autoFocus:n},e);if(t.type==="date")return f.jsx(dX,{path:e},e);if(t.type==="file")return f.jsx(rX,{path:e},e);if(t.type==="literal")return f.jsx(Jt,{path:e,error:"Literal fields are not editable"});{const r=t;return f.jsx(Jt,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function Wpe({path:e}){const t=Dt(e),{path:n,schema:r}=XA(e),{navigate:o}=Mn(),i=SS(),s=Xh(),a=g.useCallback(p=>{if("data"in s){const m=s.data,v=HI(p,i,m);v?o(v):(o(p),console.error(`Error navigating to path: ${p} - no schemas found`))}else console.warn("Schemas not loaded yet"),o(p)},[s,i,o]);if(t.status==="error")return f.jsx(Jt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return f.jsx(gt,{path:e,type:"module"});if(t.status==="not-found")return f.jsx(Pn,{path:e,type:"module"});const l=t.data,c=e2(e),u=c.slice(0,-1),d=c[c.length-1],h=DJ(e,n,r);return f.jsxs("div",{className:"flex flex-col gap-6 pt-4 pb-40",children:[f.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[c.length>1&&f.jsx("div",{className:"inline-flex items-center text-sm text-text-quartenary",children:u.map((p,m)=>m<u.length-1?f.jsxs(g.Fragment,{children:[f.jsx("button",{onClick:()=>{a(p.sourcePath)},children:p.text}),f.jsx("span",{children:f.jsx(Gv,{size:16})})]},m):f.jsx("button",{onClick:()=>{a(p.sourcePath)},children:p.text},m))}),f.jsx("div",{children:f.jsxs("div",{className:"flex items-center justify-between h-6 gap-4 text-xl",children:[!h&&f.jsx("span",{children:d.text}),h&&f.jsxs("span",{children:["#",Number(d.text)]}),f.jsx(QA,{path:e,variant:"module"})]})})]}),f.jsx(zy,{path:e,schema:l},e)]})}function Kpe(){const e=YW(),t=l7();return f.jsxs(f.Fragment,{children:[f.jsx(Gpe,{}),f.jsxs(Io,{viewportId:"val-content-area",children:[t!==null&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"w-full h-16"}),f.jsxs("div",{className:"absolute w-full h-16 top-0 p-4 text-center text-white bg-bg-error-primary z-[50]",children:[t.type==="network-error"&&"Network error - retrying...",t.type==="remote-files-error"&&t.error]})]}),f.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[800px] px-4 mx-auto",children:e==="service-unavailable"?f.jsxs("div",{className:"p-8 mt-20 text-center text-text-error-primary bg-bg-error-primary",children:[f.jsx("p",{children:"Could not connect to the content service."}),f.jsx("p",{children:"Please try again later"})]}):f.jsx(qpe,{})})]})]})}function Gpe(){const{navMenu:e,toolsMenu:t}=$y();return f.jsxs("div",{className:"flex items-center justify-between w-full h-16 px-4 border-b border-border-primary",children:[f.jsx("button",{className:ve({"ml-[calc(320px+0.5rem)] xl:ml-0":e.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>e.setOpen(!e.isOpen),children:f.jsx(Eg,{size:16,className:ve("transform",{"rotate-180":!e.isOpen})})}),f.jsx("button",{className:ve({"mr-[calc(320px+0.5rem)] xl:mr-0":t.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>t.setOpen(!t.isOpen),children:f.jsx(Eg,{size:16,className:ve("transform",{"rotate-180":t.isOpen})})})]})}function qpe(){const{currentSourcePath:e}=Mn(),t=e;return f.jsx(Wpe,{path:t})}var nE="Dialog",[s3,Ume]=ho(nE),[Ype,Jo]=s3(nE),a3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=g.useRef(null),l=g.useRef(null),[c=!1,u]=zr({prop:r,defaultProp:o,onChange:i});return f.jsx(Ype,{scope:t,triggerRef:a,contentRef:l,contentId:Ar(),titleId:Ar(),descriptionId:Ar(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};a3.displayName=nE;var l3="DialogTrigger",Jpe=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(l3,n),i=$e(t,o.triggerRef);return f.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":sE(o.open),...r,ref:i,onClick:ne(e.onClick,o.onOpenToggle)})});Jpe.displayName=l3;var rE="DialogPortal",[Xpe,c3]=s3(rE,{forceMount:void 0}),u3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Jo(rE,t);return f.jsx(Xpe,{scope:t,forceMount:n,children:g.Children.map(r,s=>f.jsx(an,{present:n||i.open,children:f.jsx(Du,{asChild:!0,container:o,children:s})}))})};u3.displayName=rE;var hv="DialogOverlay",d3=g.forwardRef((e,t)=>{const n=c3(hv,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Jo(hv,e.__scopeDialog);return i.modal?f.jsx(an,{present:r||i.open,children:f.jsx(Zpe,{...o,ref:t})}):null});d3.displayName=hv;var Zpe=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(hv,n);return f.jsx(tp,{as:ns,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(Te.div,{"data-state":sE(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Bl="DialogContent",f3=g.forwardRef((e,t)=>{const n=c3(Bl,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Jo(Bl,e.__scopeDialog);return f.jsx(an,{present:r||i.open,children:i.modal?f.jsx(Qpe,{...o,ref:t}):f.jsx(eme,{...o,ref:t})})});f3.displayName=Bl;var Qpe=g.forwardRef((e,t)=>{const n=Jo(Bl,e.__scopeDialog),r=g.useRef(null),o=$e(t,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return Xv(i)},[]),f.jsx(h3,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,i=>i.preventDefault())})}),eme=g.forwardRef((e,t)=>{const n=Jo(Bl,e.__scopeDialog),r=g.useRef(!1),o=g.useRef(!1);return f.jsx(h3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),h3=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=Jo(Bl,n),l=g.useRef(null),c=$e(t,l);return Jv(),f.jsxs(f.Fragment,{children:[f.jsx(ep,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx(Hl,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":sE(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(tme,{titleId:a.titleId}),f.jsx(rme,{contentRef:l,descriptionId:a.descriptionId})]})]})}),oE="DialogTitle",iE=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(oE,n);return f.jsx(Te.h2,{id:o.titleId,...r,ref:t})});iE.displayName=oE;var p3="DialogDescription",m3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(p3,n);return f.jsx(Te.p,{id:o.descriptionId,...r,ref:t})});m3.displayName=p3;var g3="DialogClose",v3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Jo(g3,n);return f.jsx(Te.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});v3.displayName=g3;function sE(e){return e?"open":"closed"}var y3="DialogTitleWarning",[Hme,x3]=b9(y3,{contentName:Bl,titleName:oE,docsSlug:"dialog"}),tme=({titleId:e})=>{const t=x3(y3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
490
490
|
|
|
491
491
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
492
492
|
|