@valbuild/ui 0.60.24 → 0.60.27
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/ui",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.27",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"typecheck": "tsc --noEmit",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@remirror/pm": "^2.0.8",
|
|
42
42
|
"@remirror/react": "^2.0.35",
|
|
43
43
|
"@remirror/styles": "^2.0.7",
|
|
44
|
-
"@valbuild/core": "~0.60.
|
|
45
|
-
"@valbuild/shared": "~0.60.
|
|
44
|
+
"@valbuild/core": "~0.60.27",
|
|
45
|
+
"@valbuild/shared": "~0.60.27",
|
|
46
46
|
"class-variance-authority": "^0.7.0",
|
|
47
47
|
"classnames": "^2.3.2",
|
|
48
48
|
"clsx": "^2.0.0",
|
|
@@ -40,7 +40,7 @@ Error generating stack: `+i.message+`
|
|
|
40
40
|
*/var rD=m,oD=Symbol.for("react.element"),iD=Symbol.for("react.fragment"),sD=Object.prototype.hasOwnProperty,aD=rD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,lD={key:!0,ref:!0,__self:!0,__source:!0};function RO(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)sD.call(t,r)&&!lD.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:oD,type:e,key:i,ref:s,props:o,_owner:aD.current}}xm.Fragment=iD;xm.jsx=RO;xm.jsxs=RO;NO.exports=xm;var v=NO.exports;function $y(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Gx(e,t){if(e){if(typeof e=="string")return $y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $y(e,t)}}function bm(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Gx(e))||t&&e&&typeof e.length=="number"){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=!0,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!i&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function Yx(e){return e.length>0}var Qd=Object.freeze({kind:"ok",value:void 0});function nn(e){return e===void 0?Qd:{kind:"ok",value:e}}function _t(e){return{kind:"err",error:e}}function yc(e){return e===Qd||e.kind==="ok"}function wm(e){return e!==Qd&&e.kind==="err"}function $O(e){var t=[],n=[],r=bm(e),o;try{for(r.s();!(o=r.n()).done;){var i=o.value;yc(i)?t.push(i.value):n.push(i.error)}}catch(s){r.e(s)}finally{r.f()}return Yx(n)?_t(n):nn(t)}function cD(e){return $O(e)}function uD(e){var t=[],n=bm(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value;wm(o)&&t.push(o.error)}}catch(i){n.e(i)}finally{n.f()}return Yx(t)?_t(t):Qd}function Xx(e,t){return function(n){for(var r=nn(t),o=0;o<n.length&&yc(r);++o)r=e(r.value,n[o],o);return r}}function xr(e){return function(t){return yc(t)?nn(e(t.value)):t}}function ga(e){return function(t){return yc(t)?e(t.value):t}}function dD(e){return function(t){return wm(t)?_t(e(t.error)):t}}function fD(e,t){return function(n){return e(n)?nn(n):_t(t(n))}}var km=function(t,n){return function(r){return yc(r)?t(r.value)?r:_t(n(r.value)):r}},He=Object.freeze({__proto__:null,voidOk:Qd,ok:nn,err:_t,isOk:yc,isErr:wm,allT:$O,all:cD,allV:uD,flatMapReduce:Xx,map:xr,flatMap:ga,mapErr:dD,fromPredicate:fD,filterOrElse:km});function pD(e){if(Array.isArray(e))return $y(e)}function hD(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function mD(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
42
42
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AO(e){return pD(e)||hD(e)||Gx(e)||mD()}function ce(e){"@babel/helpers - typeof";return ce=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},ce(e)}function gD(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 IO(e){var t=gD(e,"string");return typeof t=="symbol"?t:String(t)}function se(e,t,n){return t=IO(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rk(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 br(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rk(Object(n),!0).forEach(function(r){se(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vD(e){if(Array.isArray(e))return e}function yD(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 xD(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
43
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sn(e,t){return vD(e)||yD(e,t)||Gx(e,t)||xD()}function jt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ok(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,IO(r.key),r)}}function zt(e,t,n){return t&&ok(e.prototype,t),n&&ok(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rh(e){return rh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},rh(e)}function DO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DO=function(){return!!e})()}function LO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bD(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 LO(e)}function dr(e,t,n){return t=rh(t),bD(e,DO()?Reflect.construct(t,n||[],rh(e).constructor):t.apply(e,n))}function Ay(e,t){return Ay=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Ay(e,t)}function fr(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&&Ay(e,t)}var pr=function(){function e(){jt(this,e)}return zt(e,[{key:"nullable",value:function(){return this.optional()}},{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):se({},r,[{message:o,value:i}])}}]),e}(),Au=Symbol("GetSchema"),wn=Symbol("Path"),Rt=Symbol("GetSource");function wD(e){return e[Au]}var Zx=zt(function e(t){jt(this,e),this.span=t}),kD=function(e){fr(t,e);function t(n,r){var o;return jt(this,t),o=dr(this,t,[r]),se(LO(o),"type","Sym"),o.value=n,o}return zt(t,[{key:"transpile",value:function(){return this.value}}]),t}(Zx);new kD("()");var Gt="_type",rn="_ref",ik="_tag",SD=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?se({},r,[{message:"Non-optional file was null or undefined.",value:o}]):typeof o[rn]!="string"?se({},r,[{message:"File did not have a file reference string. Got: ".concat(ce(o[rn])),value:o}]):o[Gt]!=="file"?se({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[Gt]),value:o}]):o.metadata?se({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["file:check-metadata"]}]):se({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[rn])==="file"&&(r==null?void 0:r[Gt])==="file"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt}}}]),t}(pr),ED=function(t){return new SD(t)};function jO(e){var t,n;if(!e[rn].startsWith("/public")){var r,o;return{url:e[rn]+((r=e.metadata)!==null&&r!==void 0&&r.sha256?"?sha256=".concat((o=e.metadata)===null||o===void 0?void 0:o.sha256):""),metadata:e.metadata}}return{url:e[rn].slice(7)+((t=e.metadata)!==null&&t!==void 0&&t.sha256?"?sha256=".concat((n=e.metadata)===null||n===void 0?void 0:n.sha256):""),metadata:e.metadata}}function zO(e){return ce(e)==="object"&&e!==null&&e!==void 0&&("val"in e||"valPath"in e)}function _D(e){return ce(e)==="object"&&e!==null&&e!==void 0&&wn in e&&"val"in e}function FO(e){return e[wn]}function CD(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function sk(e,t,n){return t?Bt(e(Bt(t,n))):Bt(t,n)}function ls(e){return ce(e)==="object"&&e!==null&&(Rt in e||wn in e)}function Bt(e,t,n){if(ce(e)==="object"){if(ls(e))return e;if(zO(e))return Bt(e.val,e.valPath)}if(e&&e[rn]&&e[Gt]==="file"){var r=e[rn];if(typeof r!="string")throw Error("Invalid file ref: "+r);return Bt(jO(e),t,n)}switch(ce(e)){case"function":case"symbol":throw Error("Invalid selector type: ".concat(ce(e),": ").concat(e));case"object":if(e!==null)return new Proxy(e,{has:function(i,s){return s===Rt||s===wn||s==="andThen"||s===Au?!0:s in i},get:function(i,s){if(s===Rt)return e;if(s===wn)return t;if(s===Au)return n;if(s==="andThen")return function(l){return sk(l,e,t)};if(Array.isArray(i)){if(s==="filter")return function(l){var c=i.map(function(u,d){return Bt(u,kr(t,d),n==null?void 0:n.item)}).filter(function(u){return l&&l instanceof pr?l.assert(ak(u)):ak(l(u))});return Bt(c,t,n)};if(s==="map")return function(l){var c=i.map(function(u,d){var f=l(Bt(u,kr(t,d),n==null?void 0:n.item),Bt(d));return ls(f)?f:Bt(f)});return Bt(c,t,n)}}if(Array.isArray(i)&&s==="length")return Bt(i.length);var a=Reflect.get(i,s);return CD(e,s)?Number.isNaN(Number(s))?Bt(a,kr(t,s),n==null?void 0:n.items[s]):Bt(a,kr(t,Number(s)),n==null?void 0:n.item):a}});default:return se(se(se({eq:function(i){var s=i;if(ls(i)&&(s=i[Rt],s instanceof Zx))throw Error("TODO: Cannot evaluate equality with an Expr");return Bt(e===s,void 0)},andThen:function(i){return sk(i,e===void 0?null:e,t)}},Rt,e===void 0?null:e),wn,t),Au,n)}}function kr(e,t){if(ce(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));return e!==void 0?"".concat(e,".").concat(JSON.stringify(t)):void 0}function ak(e){if(ce(e)==="object"&&(Rt in e||wn in e)){var t=e[Rt];return t}return e}var Jx=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.items=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ce(o)!=="object"?se({},r,[{message:"Expected 'object', got '".concat(ce(o),"'")}]):Array.isArray(o)?se({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=Sn(a,2),c=l[0],u=l[1],d=kr(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 f=u.validate(d,o[c]);f&&s?s=br(br({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(this.items);o<i.length;o++){var s=Sn(i[o],2),a=s[0],l=s[1];if(!l.assert(r[a]))return!1}return ce(r)==="object"&&!Array.isArray(r)}},{key:"optional",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=Sn(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}]),t}(pr),OD=function(t){return new Jx(t)},BO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.item=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ce(o)!=="object"||!Array.isArray(o)?se({},r,[{message:"Expected 'array', got '".concat(ce(o),"'")}]):(o.forEach(function(a,l){var c=kr(r,l);if(!c)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at index ").concat(l),o);else{var u=i.item.validate(c,a);u&&s?s=br(br({},u),s):u&&(s=u)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;var o=bm(r),i;try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!this.item.assert(s))return!1}}catch(a){o.e(a)}finally{o.f()}return ce(r)==="object"&&Array.isArray(r)}},{key:"optional",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}]),t}(pr),TD=function(t){return new BO(t)},Iy=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.value=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?se({},r,[{message:"Expected 'string', got '".concat(ce(o),"'"),value:o}]):o!==this.value?se({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}]),t}(pr),PD=function(t){return new Iy(t)},VO=function(e){fr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return jt(this,t),o=dr(this,t),o.key=n,o.items=r,o.opt=i,o}return zt(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i==null)return!1;if(!this.key)return se({},r,[{message:"Missing required first argument in union"}]);var a=this.key;if(!Array.isArray(this.items))return se({},r,[{message:"A union schema must take more than 1 schema arguments",fatal:!0}]);if(typeof a=="string"){if(this.items.some(function(P){return!(P instanceof Jx)}))return se({},r,[{message:"Key is a string, so all schema items must be objects",fatal:!0}]);var l=this.items,c=l.map(function(P){return P.serialize()}),u=c.filter(function(P){return P.type!=="object"||P.items[a].type!=="literal"});if(u.length>0)return se({},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)),fatal:!0}]);var d=c,f=d.filter(function(P){return P.items[a].opt});if(f.length>1)return se({},r,[{message:"Schema cannot have an optional keys: ".concat(a),fatal:!0}]);if(ce(i)!=="object")return se({},r,[{message:"Expected an object"}]);var p=i;if(p[a]===void 0)return se({},r,[{message:"Missing required key: ".concat(a)}]);var h=[],g=bm(d),b;try{for(g.s();!(b=g.n()).done;){var y=b.value,x=y.items[a];if(x.type==="literal")if(!h.includes(x.value))h.push(x.value);else return se({},r,[{message:"Found duplicate key in schema: ".concat(x.value),fatal:!0}])}}catch(P){g.e(P)}finally{g.f()}var w=l.find(function(P){return!P.items[a].validate(r,p[a])});if(!w){var k=kr(r,a);if(!k)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return se({},k,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(P){var N=P.items[a];if(N.type==="literal"&&N.value)return'"'.concat(N.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(N,null,2)))}).join(", "))}])}var S=w.validate(r,p);if(S)return S}else if(a instanceof Iy){if(this.items.some(function(P){return!(P instanceof Iy)}))return se({},r,[{message:"Key is a literal schema, so all schema items must be literals",fatal:!0}]);var O=[a].concat(AO(this.items));if(typeof i=="string"){var E=O.some(function(P){return!P.validate(r,i)});if(!E)return se({},r,[{message:"Union must match one of the following: ".concat(O.map(function(P){return'"'.concat(P.value,'"')}).join(", "))}])}}else return se({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r){return!0}},{key:"optional",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}}}]),t}(pr),MD=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 VO(t,r)},UO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return!1}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"richtext",opt:this.opt,options:this.options}}}]),t}(pr),ND=function(t){return new UO(t??{})},HO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?se({},r,[{message:"Non-optional image was null or undefined.",value:o}]):typeof o[rn]!="string"?se({},r,[{message:"Image did not have a file reference string. Got: ".concat(ce(o[rn])),value:o}]):o[Gt]!=="file"?se({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[Gt]),value:o}]):o.metadata?se({},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 sha256 (string of length 64 of the base16 hash).",value:o,fixes:["image:replace-metadata"]}]):se({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[rn])==="image"&&(r==null?void 0:r[Gt])==="file"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt}}}]),t}(pr),RD=function(t){return new HO(t)},WO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.item=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ce(o)!=="object"?se({},r,[{message:"Expected 'object', got '".concat(ce(o),"'")}]):Array.isArray(o)?se({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=Sn(a,2),c=l[0],u=l[1],d=kr(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 f=i.item.validate(d,u);f&&s?s=br(br({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(r);o<i.length;o++){var s=Sn(i[o],2),a=s[1];if(!this.item.assert(a))return!1}return ce(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}]),t}(pr),$D=function(t){return new WO(t)};function AD(e){var t=e[Rt];if(t instanceof Zx)throw Error("Cannot get raw source of an Expr");var n=t;return n}function ID(e){return e.indexOf(".")===-1?[e,""]:[e.slice(0,e.indexOf(".")),e.slice(e.indexOf(".")+1)]}function DD(e){return e instanceof Jx||ce(e)==="object"&&"type"in e&&e.type==="object"}function LD(e){return e instanceof WO||ce(e)==="object"&&"type"in e&&e.type==="record"}function jD(e){return e instanceof BO||ce(e)==="object"&&"type"in e&&e.type==="array"}function zD(e){return e instanceof VO||ce(e)==="object"&&"type"in e&&e.type==="union"}function FD(e){return e instanceof UO||ce(e)==="object"&&"type"in e&&e.type==="richtext"}function BD(e){return e instanceof HO||ce(e)==="object"&&"type"in e&&e.type==="image"}function VD(e,t,n){for(var r=KO(e),o=AO(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(jD(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(ce(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ce(s)));if(s[u]===void 0){var d;throw Error("Invalid path: array source (length: ".concat((d=s)===null||d===void 0?void 0:d.length,") did not have index ").concat(u," from path: ").concat(e))}s=s[u],i=i.item}else if(LD(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ce(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ce(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(DD(i)){if(ce(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ce(s)));if(!s[u])throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.items[u]}else{if(BD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};if(zD(i)){var f=i.key;if(typeof f!="string")return{v:{path:o.map(function(g){return Number.isNaN(Number(g))?JSON.stringify(g):g}).join("."),schema:i,source:s}};var p=s[f];if(!p)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(f," in path: ").concat(e));var h=i.items.find(function(g){var b;return(g==null||(b=g.items)===null||b===void 0||(b=b[f])===null||b===void 0?void 0:b.value)===p});if(!h)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(f," of value ").concat(p," in path: ").concat(e));i=h.items[u],s=s[u]}else{if(FD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};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 KO(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}var sr=zt(function e(t){jt(this,e),this.message=t}),UD=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?se({},r,[{message:"Expected 'number', got '".concat(ce(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="number"}},{key:"optional",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}]),t}(pr),HD=function(t){return new UD(t)},qO=function(e){fr(t,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 jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return zt(t,[{key:"min",value:function(r){return new t(br(br({},this.options),{},{minLength:r}),this.opt,this.isRaw)}},{key:"max",value:function(r){return new t(br(br({},this.options),{},{maxLength:r}),this.opt,this.isRaw)}},{key:"regexp",value:function(r){return new t(br(br({},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 se({},r,[{message:"Expected 'string', got '".concat(ce(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?se({},r,l):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",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}}}]),t}(pr),WD=function(t){return new qO(t)},KD=function(e){fr(t,e);function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return jt(this,t),n=dr(this,t),n.opt=r,n}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?se({},r,[{message:"Expected 'boolean', got '".concat(ce(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="boolean"}},{key:"optional",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}]),t}(pr),qD=function(){return new KD},GD=function(e){fr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return jt(this,t),o=dr(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return zt(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return se({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return se({},r,[{message:"Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="array"&&typeof o!="number")return se({},r,[{message:"Type of value in keyof (array) must be 'number'"}]);if(i.type==="record"&&typeof o!="string")return se({},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 se({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return!1}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;var o=this.schema;if(!o)return!1;var i=o;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return!1;if(i.opt&&r==null)return!0;if(i.type==="array"&&typeof r!="number"||i.type==="record"&&typeof r!="string")return!1;if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(r))return!1}return!0}},{key:"optional",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.");var o=this.schema;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(o.type){case"array":i="number";break;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}}}]),t}(pr),YD=function(t){var n;return new GD(t==null||(n=t[Au])===null||n===void 0?void 0:n.serialize(),FO(t))};function XD(){return{string:WD,boolean:qD,array:TD,object:OD,number:HD,union:MD,richtext:ND,image:RD,literal:PD,keyOf:YD,record:$D,file:ED}}var lk="rt_image";function ZD(e){return GO(e3(e))}function JD(e){return ls(e)?ce(e[Rt])==="object"&&e[Rt]!==null&&Array.isArray(e[Rt]):Array.isArray(e)}function QD(e){return ls(e)?ce(e[Rt])==="object"&&e[Rt]!==null&&!Array.isArray(e[Rt]):ce(e)==="object"}function e3(e){var t=Bt(e);function n(r){var o=JD(r),i=QD(r);if(o){var s=Rt in r?r[Rt]:r,a=wn in r?r[wn]:void 0;return{val:s.map(function(u,d){return n(ls(u)?u:Bt(u,kr(a,d)))}),valPath:a}}else if(i){var l=Rt in r?r[Rt]:r,c=wn in r?r[wn]:void 0;return{val:l!==null&&Object.fromEntries(Object.entries(l).map(function(u){var d=Sn(u,2),f=d[0],p=d[1];return[f,n(ls(p)?p:Bt(p,kr(c,f)))]})),valPath:c}}else return ls(r)?{val:n(r[Rt]),valPath:r[wn]}:r}return n(t)}function Dy(e){var t=zO(e)?e.val:e;switch(ce(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ce(t)));case"object":return t===null?null:Array.isArray(t)?t.map(Dy):Object.fromEntries(Object.entries(t).map(function(n){var r=Sn(n,2),o=r[0],i=r[1];return[o,i&&Dy(i)]}));default:return t}}function GO(e){var t=e.val;switch(ce(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ce(t)));case"object":if(t!==null)return new Proxy(t,{has:function(r,o){return o==="val"||o===wn?!0:ck(r,o)},get:function(r,o){if(o===wn)return e.valPath;if(o==="val")return Dy(e);if(Array.isArray(r)&&o==="length")return r.length;if(ck(t,o)){var i,s;return GO({val:Reflect.get(r,o).val,valPath:(i=(s=Reflect.get(r,o))===null||s===void 0?void 0:s.valPath)!==null&&i!==void 0?i:kr(e.valPath,Array.isArray(r)?Number(o):o)})}return Reflect.get(r,o)}});default:return se(se({},wn,e.valPath),"val",e.val)}}function ck(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var t3=[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],Qe=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}(Qe||{}),uk={sha256:1};function n3(e){if(e&&!uk[e]&&!uk[e.toLowerCase()])throw new Error("Digest method not supported");return new r3}var r3=function(){function e(){jt(this,e),se(this,"A",1779033703),se(this,"B",-1150833019),se(this,"C",1013904242),se(this,"D",-1521486534),se(this,"E",1359893119),se(this,"F",-1694144372),se(this,"G",528734635),se(this,"H",1541459225),se(this,"_size",0),se(this,"_sp",0),(!Lf||Fc>=Qe.allocTotal)&&(Lf=new ArrayBuffer(Qe.allocTotal),Fc=0),this._byte=new Uint8Array(Lf,Fc,Qe.allocBytes),this._word=new Int32Array(Lf,Fc,Qe.allocWords),Fc+=Qe.allocBytes}return zt(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+ce(n));var r=n.byteOffset,o=n.byteLength,i=o/Qe.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%Qe.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*Qe.inputWords);i--;)this._int32(a,s>>2),s+=Qe.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%Qe.inputBytes,l=a;r<s&&l<Qe.inputBytes;)o[l++]=n[r++];l>=Qe.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%Qe.inputBytes,c=l;a<i&&c<Qe.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>=Qe.inputBytes&&(this._int32(o),o[0]=o[Qe.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,f=0;for(r=r|0;f<Qe.inputWords;)Is[f++]=zr(n[r++]);for(f=Qe.inputWords;f<Qe.workWords;f++)Is[f]=d3(Is[f-2])+Is[f-7]+u3(Is[f-15])+Is[f-16]|0;for(f=0;f<Qe.workWords;f++){var p=d+c3(l)+s3(l,c,u)+t3[f]+Is[f]|0,h=l3(o)+a3(o,i,s)|0;d=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+h|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%Qe.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>Qe.highIndex){for(;i<Qe.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<Qe.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[Qe.highIndex]=zr(l)),a&&(o[Qe.lowIndex]=zr(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 ki(n)+ki(r)+ki(o)+ki(i)+ki(s)+ki(a)+ki(l)+ki(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]=zr(n),d[1]=zr(r),d[2]=zr(o),d[3]=zr(i),d[4]=zr(s),d[5]=zr(a),d[6]=zr(l),d[7]=zr(c),u.slice(0,32)}}]),e}(),Is=new Int32Array(Qe.workWords),Lf,Fc=0,ki=function(t){return(t+4294967296).toString(16).substr(-8)},o3=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},i3=function(t){return t},zr=f3()?i3:o3,s3=function(t,n,r){return r^t&(n^r)},a3=function(t,n,r){return t&n|r&(t|n)},l3=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},c3=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},u3=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},d3=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function f3(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var p3=function(t){return n3().update(t).digest("hex")};function Yn(){Yn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(_,T,C){_[T]=C.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(_,T,C){return Object.defineProperty(_,T,{value:C,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(T,C,M){return T[C]=M}}function u(_,T,C,M){var R=T&&T.prototype instanceof y?T:y,L=Object.create(R.prototype),G=new U(M||[]);return o(L,"_invoke",{value:$(_,C,G)}),L}function d(_,T,C){try{return{type:"normal",arg:_.call(T,C)}}catch(M){return{type:"throw",arg:M}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",g="completed",b={};function y(){}function x(){}function w(){}var k={};c(k,s,function(){return this});var S=Object.getPrototypeOf,O=S&&S(S(K([])));O&&O!==n&&r.call(O,s)&&(k=O);var E=w.prototype=y.prototype=Object.create(k);function P(_){["next","throw","return"].forEach(function(T){c(_,T,function(C){return this._invoke(T,C)})})}function N(_,T){function C(R,L,G,ve){var me=d(_[R],_,L);if(me.type!=="throw"){var Be=me.arg,Te=Be.value;return Te&&typeof Te=="object"&&r.call(Te,"__await")?T.resolve(Te.__await).then(function(J){C("next",J,G,ve)},function(J){C("throw",J,G,ve)}):T.resolve(Te).then(function(J){Be.value=J,G(Be)},function(J){return C("throw",J,G,ve)})}ve(me.arg)}var M;o(this,"_invoke",{value:function(R,L){function G(){return new T(function(ve,me){C(R,L,ve,me)})}return M=M?M.then(G,G):G()}})}function $(_,T,C){var M=f;return function(R,L){if(M===h)throw new Error("Generator is already running");if(M===g){if(R==="throw")throw L;return{value:e,done:!0}}for(C.method=R,C.arg=L;;){var G=C.delegate;if(G){var ve=z(G,C);if(ve){if(ve===b)continue;return ve}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(M===f)throw M=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);M=h;var me=d(_,T,C);if(me.type==="normal"){if(M=C.done?g:p,me.arg===b)continue;return{value:me.arg,done:C.done}}me.type==="throw"&&(M=g,C.method="throw",C.arg=me.arg)}}}function z(_,T){var C=T.method,M=_.iterator[C];if(M===e)return T.delegate=null,C==="throw"&&_.iterator.return&&(T.method="return",T.arg=e,z(_,T),T.method==="throw")||C!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+C+"' method")),b;var R=d(M,_.iterator,T.arg);if(R.type==="throw")return T.method="throw",T.arg=R.arg,T.delegate=null,b;var L=R.arg;return L?L.done?(T[_.resultName]=L.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=e),T.delegate=null,b):L:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function le(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function U(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(j,this),this.reset(!0)}function K(_){if(_||_===""){var T=_[s];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var C=-1,M=function R(){for(;++C<_.length;)if(r.call(_,C))return R.value=_[C],R.done=!1,R;return R.value=e,R.done=!0,R};return M.next=M}}throw new TypeError(typeof _+" is not iterable")}return x.prototype=w,o(E,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===x||(T.displayName||T.name)==="GeneratorFunction")},t.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,w):(_.__proto__=w,c(_,l,"GeneratorFunction")),_.prototype=Object.create(E),_},t.awrap=function(_){return{__await:_}},P(N.prototype),c(N.prototype,a,function(){return this}),t.AsyncIterator=N,t.async=function(_,T,C,M,R){R===void 0&&(R=Promise);var L=new N(u(_,T,C,M),R);return t.isGeneratorFunction(T)?L:L.next().then(function(G){return G.done?G.value:L.next()})},P(E),c(E,l,"Generator"),c(E,s,function(){return this}),c(E,"toString",function(){return"[object Generator]"}),t.keys=function(_){var T=Object(_),C=[];for(var M in T)C.push(M);return C.reverse(),function R(){for(;C.length;){var L=C.pop();if(L in T)return R.value=L,R.done=!1,R}return R.done=!0,R}},t.values=K,U.prototype={constructor:U,reset:function(_){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(le),!_)for(var T in this)T.charAt(0)==="t"&&r.call(this,T)&&!isNaN(+T.slice(1))&&(this[T]=e)},stop:function(){this.done=!0;var _=this.tryEntries[0].completion;if(_.type==="throw")throw _.arg;return this.rval},dispatchException:function(_){if(this.done)throw _;var T=this;function C(me,Be){return L.type="throw",L.arg=_,T.next=me,Be&&(T.method="next",T.arg=e),!!Be}for(var M=this.tryEntries.length-1;M>=0;--M){var R=this.tryEntries[M],L=R.completion;if(R.tryLoc==="root")return C("end");if(R.tryLoc<=this.prev){var G=r.call(R,"catchLoc"),ve=r.call(R,"finallyLoc");if(G&&ve){if(this.prev<R.catchLoc)return C(R.catchLoc,!0);if(this.prev<R.finallyLoc)return C(R.finallyLoc)}else if(G){if(this.prev<R.catchLoc)return C(R.catchLoc,!0)}else{if(!ve)throw new Error("try statement without catch or finally");if(this.prev<R.finallyLoc)return C(R.finallyLoc)}}}},abrupt:function(_,T){for(var C=this.tryEntries.length-1;C>=0;--C){var M=this.tryEntries[C];if(M.tryLoc<=this.prev&&r.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var R=M;break}}R&&(_==="break"||_==="continue")&&R.tryLoc<=T&&T<=R.finallyLoc&&(R=null);var L=R?R.completion:{};return L.type=_,L.arg=T,R?(this.method="next",this.next=R.finallyLoc,b):this.complete(L)},complete:function(_,T){if(_.type==="throw")throw _.arg;return _.type==="break"||_.type==="continue"?this.next=_.arg:_.type==="return"?(this.rval=this.arg=_.arg,this.method="return",this.next="end"):_.type==="normal"&&T&&(this.next=T),b},finish:function(_){for(var T=this.tryEntries.length-1;T>=0;--T){var C=this.tryEntries[T];if(C.finallyLoc===_)return this.complete(C.completion,C.afterLoc),le(C),b}},catch:function(_){for(var T=this.tryEntries.length-1;T>=0;--T){var C=this.tryEntries[T];if(C.tryLoc===_){var M=C.completion;if(M.type==="throw"){var R=M.arg;le(C)}return R}}throw new Error("illegal catch attempt")},delegateYield:function(_,T,C){return this.delegate={iterator:K(_),resultName:T,nextLoc:C},this.method==="next"&&(this.arg=e),b}},t}function dk(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){n(c);return}a.done?t(l):Promise.resolve(l).then(r,o)}function ol(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){dk(i,r,o,s,a,"next",l)}function a(l){dk(i,r,o,s,a,"throw",l)}s(void 0)})}}var Qx=function(){function e(t){jt(this,e),this.host=t}return zt(e,[{key:"getDisableUrl",value:function(n){return"".concat(this.host,"/disable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getLoginUrl",value:function(n){return"".concat(this.host,"/authorize?redirect_to=").concat(encodeURIComponent(n))}},{key:"getEnableUrl",value:function(n){return"".concat(this.host,"/enable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getPatches",value:function(){var t=ol(Yn().mark(function r(o){var i,s,a;return Yn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return i=o.patchIds,s=o.headers,a=i?"?".concat(i.map(function(u){return"".concat(u,"=").concat(encodeURIComponent(u))}).join("&")):"",c.abrupt("return",fetch("".concat(this.host,"/patches/~").concat(a),{headers:s||{"Content-Type":"application/json"}}).then(function(u){return Si(u)}).catch(Ds));case 3:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"deletePatches",value:function(){var t=ol(Yn().mark(function r(o,i){var s;return Yn().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return s=new URLSearchParams,o.forEach(function(c){return s.append("id",c)}),l.abrupt("return",fetch("".concat(this.host,"/patches/~?").concat(s),{method:"DELETE",headers:i||{"Content-Type":"application/json"}}).then(function(c){return Si(c)}).catch(Ds));case 3:case"end":return l.stop()}},r,this)}));function n(r,o){return t.apply(this,arguments)}return n}()},{key:"getEditUrl",value:function(){return"/val"}},{key:"postPatches",value:function(n,r,o){return fetch("".concat(this.host,"/patches/~"),{headers:o||{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(se({},n,r))}).then(function(){var i=ol(Yn().mark(function s(a){return Yn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",Si(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(Ds)}},{key:"getSession",value:function(){return fetch("".concat(this.host,"/session")).then(function(n){return Si(n).catch(Ds)})}},{key:"getTree",value:function(n){var r=n.patch,o=r===void 0?!1:r,i=n.includeSchema,s=i===void 0?!1:i,a=n.includeSource,l=a===void 0?!1:a,c=n.treePath,u=c===void 0?"/":c,d=n.headers,f=new URLSearchParams;return f.set("patch",o.toString()),f.set("schema",s.toString()),f.set("source",l.toString()),fetch("".concat(this.host,"/tree/~").concat(u,"?").concat(f.toString()),{headers:d}).then(function(p){return Si(p)}).catch(Ds)}},{key:"postCommit",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/commit"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=ol(Yn().mark(function s(a){var l;return Yn().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(!a.ok){u.next=4;break}return u.abrupt("return",Si(a));case 4:if(!(a.status===400&&a.headers.get("content-type")==="application/json")){u.next=13;break}return u.next=7,a.json();case 7:if(l=u.sent,!("validationErrors"in l)){u.next=12;break}return u.abrupt("return",_t(l));case 12:return u.abrupt("return",YO(a.status,l,a.statusText));case 13:return u.abrupt("return",Si(a));case 14:case"end":return u.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(Ds)}},{key:"postValidate",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/validate"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=ol(Yn().mark(function s(a){return Yn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",Si(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(Ds)}}]),e}();function Ds(e){return _t({statusCode:500,message:e instanceof Error||ce(e)==="object"&&e&&"message"in e&&typeof e.message=="string"?e.message:"Unknown error",details:ce(e)==="object"&&e&&"details"in e?e.details:void 0})}function YO(e,t,n){return _t({statusCode:e,message:t.message||n,details:t.details||Object.fromEntries(Object.entries(t).filter(function(r){var o=Sn(r,1),i=o[0];return i!=="message"}))})}function Si(e){return Ly.apply(this,arguments)}function Ly(){return Ly=ol(Yn().mark(function e(t){var n;return Yn().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,!t.ok){o.next=9;break}return o.t0=He,o.next=5,t.json();case 5:return o.t1=o.sent,o.abrupt("return",o.t0.ok.call(o.t0,o.t1));case 9:return o.prev=9,o.next=12,t.json();case 12:return n=o.sent,o.abrupt("return",YO(t.status,n,t.statusText));case 16:return o.prev=16,o.t2=o.catch(9),o.abrupt("return",_t({statusCode:t.status,message:t.statusText}));case 19:o.next=24;break;case 21:return o.prev=21,o.t3=o.catch(0),o.abrupt("return",_t({message:o.t3 instanceof Error?o.t3.message:"Unknown error"}));case 24:case"end":return o.stop()}},e,null,[[0,21],[9,16]])})),Ly.apply(this,arguments)}var Fe={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:jO,getSchema:wD,getValPath:FO,getVal:ZD,getSource:AD,resolvePath:VD,splitModuleIdAndModulePath:ID,isVal:_D,createValPathOfItem:kr,getSHA256Hash:p3,initSchema:XD,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&&h3(n)}).join("/"))},createPatchPath:function(t){return KO(t)},patchPathToModulePath:function(t){return t.map(function(n){return Number.isInteger(Number(n))?n:JSON.stringify(n)}).join(".")},VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session"};function h3(e){try{return JSON.parse(e)}catch{return e}}var XO={exports:{}};/*!
|
|
43
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sn(e,t){return vD(e)||yD(e,t)||Gx(e,t)||xD()}function jt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ok(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,IO(r.key),r)}}function zt(e,t,n){return t&&ok(e.prototype,t),n&&ok(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rh(e){return rh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},rh(e)}function DO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DO=function(){return!!e})()}function LO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bD(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 LO(e)}function dr(e,t,n){return t=rh(t),bD(e,DO()?Reflect.construct(t,n||[],rh(e).constructor):t.apply(e,n))}function Ay(e,t){return Ay=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Ay(e,t)}function fr(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&&Ay(e,t)}var pr=function(){function e(){jt(this,e)}return zt(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):se({},r,[{message:o,value:i}])}}]),e}(),Au=Symbol("GetSchema"),wn=Symbol("Path"),Rt=Symbol("GetSource");function wD(e){return e[Au]}var Zx=zt(function e(t){jt(this,e),this.span=t}),kD=function(e){fr(t,e);function t(n,r){var o;return jt(this,t),o=dr(this,t,[r]),se(LO(o),"type","Sym"),o.value=n,o}return zt(t,[{key:"transpile",value:function(){return this.value}}]),t}(Zx);new kD("()");var Gt="_type",rn="_ref",ik="_tag",SD=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?se({},r,[{message:"Non-optional file was null or undefined.",value:o}]):typeof o[rn]!="string"?se({},r,[{message:"File did not have a file reference string. Got: ".concat(ce(o[rn])),value:o}]):o[Gt]!=="file"?se({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[Gt]),value:o}]):o.metadata?se({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["file:check-metadata"]}]):se({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[rn])==="file"&&(r==null?void 0:r[Gt])==="file"}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt}}}]),t}(pr),ED=function(t){return new SD(t)};function jO(e){var t,n;if(!e[rn].startsWith("/public")){var r,o;return{url:e[rn]+((r=e.metadata)!==null&&r!==void 0&&r.sha256?"?sha256=".concat((o=e.metadata)===null||o===void 0?void 0:o.sha256):""),metadata:e.metadata}}return{url:e[rn].slice(7)+((t=e.metadata)!==null&&t!==void 0&&t.sha256?"?sha256=".concat((n=e.metadata)===null||n===void 0?void 0:n.sha256):""),metadata:e.metadata}}function zO(e){return ce(e)==="object"&&e!==null&&e!==void 0&&("val"in e||"valPath"in e)}function _D(e){return ce(e)==="object"&&e!==null&&e!==void 0&&wn in e&&"val"in e}function FO(e){return e[wn]}function CD(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function sk(e,t,n){return t?Bt(e(Bt(t,n))):Bt(t,n)}function ls(e){return ce(e)==="object"&&e!==null&&(Rt in e||wn in e)}function Bt(e,t,n){if(ce(e)==="object"){if(ls(e))return e;if(zO(e))return Bt(e.val,e.valPath)}if(e&&e[rn]&&e[Gt]==="file"){var r=e[rn];if(typeof r!="string")throw Error("Invalid file ref: "+r);return Bt(jO(e),t,n)}switch(ce(e)){case"function":case"symbol":throw Error("Invalid selector type: ".concat(ce(e),": ").concat(e));case"object":if(e!==null)return new Proxy(e,{has:function(i,s){return s===Rt||s===wn||s==="andThen"||s===Au?!0:s in i},get:function(i,s){if(s===Rt)return e;if(s===wn)return t;if(s===Au)return n;if(s==="andThen")return function(l){return sk(l,e,t)};if(Array.isArray(i)){if(s==="filter")return function(l){var c=i.map(function(u,d){return Bt(u,kr(t,d),n==null?void 0:n.item)}).filter(function(u){return l&&l instanceof pr?l.assert(ak(u)):ak(l(u))});return Bt(c,t,n)};if(s==="map")return function(l){var c=i.map(function(u,d){var f=l(Bt(u,kr(t,d),n==null?void 0:n.item),Bt(d));return ls(f)?f:Bt(f)});return Bt(c,t,n)}}if(Array.isArray(i)&&s==="length")return Bt(i.length);var a=Reflect.get(i,s);return CD(e,s)?Number.isNaN(Number(s))?Bt(a,kr(t,s),n==null?void 0:n.items[s]):Bt(a,kr(t,Number(s)),n==null?void 0:n.item):a}});default:return se(se(se({eq:function(i){var s=i;if(ls(i)&&(s=i[Rt],s instanceof Zx))throw Error("TODO: Cannot evaluate equality with an Expr");return Bt(e===s,void 0)},andThen:function(i){return sk(i,e===void 0?null:e,t)}},Rt,e===void 0?null:e),wn,t),Au,n)}}function kr(e,t){if(ce(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));return e!==void 0?"".concat(e,".").concat(JSON.stringify(t)):void 0}function ak(e){if(ce(e)==="object"&&(Rt in e||wn in e)){var t=e[Rt];return t}return e}var Jx=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.items=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ce(o)!=="object"?se({},r,[{message:"Expected 'object', got '".concat(ce(o),"'")}]):Array.isArray(o)?se({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=Sn(a,2),c=l[0],u=l[1],d=kr(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 f=u.validate(d,o[c]);f&&s?s=br(br({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(this.items);o<i.length;o++){var s=Sn(i[o],2),a=s[0],l=s[1];if(!l.assert(r[a]))return!1}return ce(r)==="object"&&!Array.isArray(r)}},{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=Sn(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}]),t}(pr),OD=function(t){return new Jx(t)},BO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.item=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ce(o)!=="object"||!Array.isArray(o)?se({},r,[{message:"Expected 'array', got '".concat(ce(o),"'")}]):(o.forEach(function(a,l){var c=kr(r,l);if(!c)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at index ").concat(l),o);else{var u=i.item.validate(c,a);u&&s?s=br(br({},u),s):u&&(s=u)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;var o=bm(r),i;try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!this.item.assert(s))return!1}}catch(a){o.e(a)}finally{o.f()}return ce(r)==="object"&&Array.isArray(r)}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}]),t}(pr),TD=function(t){return new BO(t)},Iy=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.value=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?se({},r,[{message:"Expected 'string', got '".concat(ce(o),"'"),value:o}]):o!==this.value?se({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"nullable",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}]),t}(pr),PD=function(t){return new Iy(t)},VO=function(e){fr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return jt(this,t),o=dr(this,t),o.key=n,o.items=r,o.opt=i,o}return zt(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i==null)return!1;if(!this.key)return se({},r,[{message:"Missing required first argument in union"}]);var a=this.key;if(!Array.isArray(this.items))return se({},r,[{message:"A union schema must take more than 1 schema arguments",fatal:!0}]);if(typeof a=="string"){if(this.items.some(function(P){return!(P instanceof Jx)}))return se({},r,[{message:"Key is a string, so all schema items must be objects",fatal:!0}]);var l=this.items,c=l.map(function(P){return P.serialize()}),u=c.filter(function(P){return P.type!=="object"||P.items[a].type!=="literal"});if(u.length>0)return se({},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)),fatal:!0}]);var d=c,f=d.filter(function(P){return P.items[a].opt});if(f.length>1)return se({},r,[{message:"Schema cannot have an optional keys: ".concat(a),fatal:!0}]);if(ce(i)!=="object")return se({},r,[{message:"Expected an object"}]);var p=i;if(p[a]===void 0)return se({},r,[{message:"Missing required key: ".concat(a)}]);var h=[],g=bm(d),b;try{for(g.s();!(b=g.n()).done;){var y=b.value,x=y.items[a];if(x.type==="literal")if(!h.includes(x.value))h.push(x.value);else return se({},r,[{message:"Found duplicate key in schema: ".concat(x.value),fatal:!0}])}}catch(P){g.e(P)}finally{g.f()}var w=l.find(function(P){return!P.items[a].validate(r,p[a])});if(!w){var k=kr(r,a);if(!k)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return se({},k,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(P){var N=P.items[a];if(N.type==="literal"&&N.value)return'"'.concat(N.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(N,null,2)))}).join(", "))}])}var S=w.validate(r,p);if(S)return S}else if(a instanceof Iy){if(this.items.some(function(P){return!(P instanceof Iy)}))return se({},r,[{message:"Key is a literal schema, so all schema items must be literals",fatal:!0}]);var O=[a].concat(AO(this.items));if(typeof i=="string"){var E=O.some(function(P){return!P.validate(r,i)});if(!E)return se({},r,[{message:"Union must match one of the following: ".concat(O.map(function(P){return'"'.concat(P.value,'"')}).join(", "))}])}}else return se({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r){return!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}}}]),t}(pr),MD=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 VO(t,r)},UO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return!1}},{key:"assert",value:function(r){return!0}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"richtext",opt:this.opt,options:this.options}}}]),t}(pr),ND=function(t){return new UO(t??{})},HO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?se({},r,[{message:"Non-optional image was null or undefined.",value:o}]):typeof o[rn]!="string"?se({},r,[{message:"Image did not have a file reference string. Got: ".concat(ce(o[rn])),value:o}]):o[Gt]!=="file"?se({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[Gt]),value:o}]):o.metadata?se({},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 sha256 (string of length 64 of the base16 hash).",value:o,fixes:["image:replace-metadata"]}]):se({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[rn])==="image"&&(r==null?void 0:r[Gt])==="file"}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt}}}]),t}(pr),RD=function(t){return new HO(t)},WO=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.item=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ce(o)!=="object"?se({},r,[{message:"Expected 'object', got '".concat(ce(o),"'")}]):Array.isArray(o)?se({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=Sn(a,2),c=l[0],u=l[1],d=kr(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 f=i.item.validate(d,u);f&&s?s=br(br({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(r);o<i.length;o++){var s=Sn(i[o],2),a=s[1];if(!this.item.assert(a))return!1}return ce(r)==="object"&&!Array.isArray(r)}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}]),t}(pr),$D=function(t){return new WO(t)};function AD(e){var t=e[Rt];if(t instanceof Zx)throw Error("Cannot get raw source of an Expr");var n=t;return n}function ID(e){return e.indexOf(".")===-1?[e,""]:[e.slice(0,e.indexOf(".")),e.slice(e.indexOf(".")+1)]}function DD(e){return e instanceof Jx||ce(e)==="object"&&"type"in e&&e.type==="object"}function LD(e){return e instanceof WO||ce(e)==="object"&&"type"in e&&e.type==="record"}function jD(e){return e instanceof BO||ce(e)==="object"&&"type"in e&&e.type==="array"}function zD(e){return e instanceof VO||ce(e)==="object"&&"type"in e&&e.type==="union"}function FD(e){return e instanceof UO||ce(e)==="object"&&"type"in e&&e.type==="richtext"}function BD(e){return e instanceof HO||ce(e)==="object"&&"type"in e&&e.type==="image"}function VD(e,t,n){for(var r=KO(e),o=AO(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(jD(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(ce(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ce(s)));if(s[u]===void 0){var d;throw Error("Invalid path: array source (length: ".concat((d=s)===null||d===void 0?void 0:d.length,") did not have index ").concat(u," from path: ").concat(e))}s=s[u],i=i.item}else if(LD(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ce(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ce(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(DD(i)){if(ce(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ce(s)));if(!s[u])throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.items[u]}else{if(BD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};if(zD(i)){var f=i.key;if(typeof f!="string")return{v:{path:o.map(function(g){return Number.isNaN(Number(g))?JSON.stringify(g):g}).join("."),schema:i,source:s}};var p=s[f];if(!p)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(f," in path: ").concat(e));var h=i.items.find(function(g){var b;return(g==null||(b=g.items)===null||b===void 0||(b=b[f])===null||b===void 0?void 0:b.value)===p});if(!h)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(f," of value ").concat(p," in path: ").concat(e));i=h.items[u],s=s[u]}else{if(FD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};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 KO(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}var sr=zt(function e(t){jt(this,e),this.message=t}),UD=function(e){fr(t,e);function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?se({},r,[{message:"Expected 'number', got '".concat(ce(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="number"}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}]),t}(pr),HD=function(t){return new UD(t)},qO=function(e){fr(t,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 jt(this,t),r=dr(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return zt(t,[{key:"min",value:function(r){return new t(br(br({},this.options),{},{minLength:r}),this.opt,this.isRaw)}},{key:"max",value:function(r){return new t(br(br({},this.options),{},{maxLength:r}),this.opt,this.isRaw)}},{key:"regexp",value:function(r){return new t(br(br({},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 se({},r,[{message:"Expected 'string', got '".concat(ce(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?se({},r,l):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{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}}}]),t}(pr),WD=function(t){return new qO(t)},KD=function(e){fr(t,e);function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return jt(this,t),n=dr(this,t),n.opt=r,n}return zt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?se({},r,[{message:"Expected 'boolean', got '".concat(ce(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="boolean"}},{key:"nullable",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}]),t}(pr),qD=function(){return new KD},GD=function(e){fr(t,e);function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return jt(this,t),o=dr(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return zt(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return se({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return se({},r,[{message:"Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="array"&&typeof o!="number")return se({},r,[{message:"Type of value in keyof (array) must be 'number'"}]);if(i.type==="record"&&typeof o!="string")return se({},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 se({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return!1}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;var o=this.schema;if(!o)return!1;var i=o;if(!(i.type==="array"||i.type==="object"||i.type==="record"))return!1;if(i.opt&&r==null)return!0;if(i.type==="array"&&typeof r!="number"||i.type==="record"&&typeof r!="string")return!1;if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(r))return!1}return!0}},{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.");var o=this.schema;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(o.type){case"array":i="number";break;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}}}]),t}(pr),YD=function(t){var n;return new GD(t==null||(n=t[Au])===null||n===void 0?void 0:n.serialize(),FO(t))};function XD(){return{string:WD,boolean:qD,array:TD,object:OD,number:HD,union:MD,richtext:ND,image:RD,literal:PD,keyOf:YD,record:$D,file:ED}}var lk="rt_image";function ZD(e){return GO(e3(e))}function JD(e){return ls(e)?ce(e[Rt])==="object"&&e[Rt]!==null&&Array.isArray(e[Rt]):Array.isArray(e)}function QD(e){return ls(e)?ce(e[Rt])==="object"&&e[Rt]!==null&&!Array.isArray(e[Rt]):ce(e)==="object"}function e3(e){var t=Bt(e);function n(r){var o=JD(r),i=QD(r);if(o){var s=Rt in r?r[Rt]:r,a=wn in r?r[wn]:void 0;return{val:s.map(function(u,d){return n(ls(u)?u:Bt(u,kr(a,d)))}),valPath:a}}else if(i){var l=Rt in r?r[Rt]:r,c=wn in r?r[wn]:void 0;return{val:l!==null&&Object.fromEntries(Object.entries(l).map(function(u){var d=Sn(u,2),f=d[0],p=d[1];return[f,n(ls(p)?p:Bt(p,kr(c,f)))]})),valPath:c}}else return ls(r)?{val:n(r[Rt]),valPath:r[wn]}:r}return n(t)}function Dy(e){var t=zO(e)?e.val:e;switch(ce(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ce(t)));case"object":return t===null?null:Array.isArray(t)?t.map(Dy):Object.fromEntries(Object.entries(t).map(function(n){var r=Sn(n,2),o=r[0],i=r[1];return[o,i&&Dy(i)]}));default:return t}}function GO(e){var t=e.val;switch(ce(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ce(t)));case"object":if(t!==null)return new Proxy(t,{has:function(r,o){return o==="val"||o===wn?!0:ck(r,o)},get:function(r,o){if(o===wn)return e.valPath;if(o==="val")return Dy(e);if(Array.isArray(r)&&o==="length")return r.length;if(ck(t,o)){var i,s;return GO({val:Reflect.get(r,o).val,valPath:(i=(s=Reflect.get(r,o))===null||s===void 0?void 0:s.valPath)!==null&&i!==void 0?i:kr(e.valPath,Array.isArray(r)?Number(o):o)})}return Reflect.get(r,o)}});default:return se(se({},wn,e.valPath),"val",e.val)}}function ck(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var t3=[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],Qe=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}(Qe||{}),uk={sha256:1};function n3(e){if(e&&!uk[e]&&!uk[e.toLowerCase()])throw new Error("Digest method not supported");return new r3}var r3=function(){function e(){jt(this,e),se(this,"A",1779033703),se(this,"B",-1150833019),se(this,"C",1013904242),se(this,"D",-1521486534),se(this,"E",1359893119),se(this,"F",-1694144372),se(this,"G",528734635),se(this,"H",1541459225),se(this,"_size",0),se(this,"_sp",0),(!Lf||Fc>=Qe.allocTotal)&&(Lf=new ArrayBuffer(Qe.allocTotal),Fc=0),this._byte=new Uint8Array(Lf,Fc,Qe.allocBytes),this._word=new Int32Array(Lf,Fc,Qe.allocWords),Fc+=Qe.allocBytes}return zt(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+ce(n));var r=n.byteOffset,o=n.byteLength,i=o/Qe.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%Qe.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*Qe.inputWords);i--;)this._int32(a,s>>2),s+=Qe.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%Qe.inputBytes,l=a;r<s&&l<Qe.inputBytes;)o[l++]=n[r++];l>=Qe.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%Qe.inputBytes,c=l;a<i&&c<Qe.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>=Qe.inputBytes&&(this._int32(o),o[0]=o[Qe.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,f=0;for(r=r|0;f<Qe.inputWords;)Is[f++]=zr(n[r++]);for(f=Qe.inputWords;f<Qe.workWords;f++)Is[f]=d3(Is[f-2])+Is[f-7]+u3(Is[f-15])+Is[f-16]|0;for(f=0;f<Qe.workWords;f++){var p=d+c3(l)+s3(l,c,u)+t3[f]+Is[f]|0,h=l3(o)+a3(o,i,s)|0;d=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+h|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%Qe.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>Qe.highIndex){for(;i<Qe.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<Qe.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[Qe.highIndex]=zr(l)),a&&(o[Qe.lowIndex]=zr(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 ki(n)+ki(r)+ki(o)+ki(i)+ki(s)+ki(a)+ki(l)+ki(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]=zr(n),d[1]=zr(r),d[2]=zr(o),d[3]=zr(i),d[4]=zr(s),d[5]=zr(a),d[6]=zr(l),d[7]=zr(c),u.slice(0,32)}}]),e}(),Is=new Int32Array(Qe.workWords),Lf,Fc=0,ki=function(t){return(t+4294967296).toString(16).substr(-8)},o3=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},i3=function(t){return t},zr=f3()?i3:o3,s3=function(t,n,r){return r^t&(n^r)},a3=function(t,n,r){return t&n|r&(t|n)},l3=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},c3=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},u3=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},d3=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function f3(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var p3=function(t){return n3().update(t).digest("hex")};function Yn(){Yn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(_,T,C){_[T]=C.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(_,T,C){return Object.defineProperty(_,T,{value:C,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(T,C,M){return T[C]=M}}function u(_,T,C,M){var R=T&&T.prototype instanceof y?T:y,L=Object.create(R.prototype),G=new U(M||[]);return o(L,"_invoke",{value:$(_,C,G)}),L}function d(_,T,C){try{return{type:"normal",arg:_.call(T,C)}}catch(M){return{type:"throw",arg:M}}}t.wrap=u;var f="suspendedStart",p="suspendedYield",h="executing",g="completed",b={};function y(){}function x(){}function w(){}var k={};c(k,s,function(){return this});var S=Object.getPrototypeOf,O=S&&S(S(K([])));O&&O!==n&&r.call(O,s)&&(k=O);var E=w.prototype=y.prototype=Object.create(k);function P(_){["next","throw","return"].forEach(function(T){c(_,T,function(C){return this._invoke(T,C)})})}function N(_,T){function C(R,L,G,ve){var me=d(_[R],_,L);if(me.type!=="throw"){var Be=me.arg,Te=Be.value;return Te&&typeof Te=="object"&&r.call(Te,"__await")?T.resolve(Te.__await).then(function(J){C("next",J,G,ve)},function(J){C("throw",J,G,ve)}):T.resolve(Te).then(function(J){Be.value=J,G(Be)},function(J){return C("throw",J,G,ve)})}ve(me.arg)}var M;o(this,"_invoke",{value:function(R,L){function G(){return new T(function(ve,me){C(R,L,ve,me)})}return M=M?M.then(G,G):G()}})}function $(_,T,C){var M=f;return function(R,L){if(M===h)throw new Error("Generator is already running");if(M===g){if(R==="throw")throw L;return{value:e,done:!0}}for(C.method=R,C.arg=L;;){var G=C.delegate;if(G){var ve=z(G,C);if(ve){if(ve===b)continue;return ve}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(M===f)throw M=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);M=h;var me=d(_,T,C);if(me.type==="normal"){if(M=C.done?g:p,me.arg===b)continue;return{value:me.arg,done:C.done}}me.type==="throw"&&(M=g,C.method="throw",C.arg=me.arg)}}}function z(_,T){var C=T.method,M=_.iterator[C];if(M===e)return T.delegate=null,C==="throw"&&_.iterator.return&&(T.method="return",T.arg=e,z(_,T),T.method==="throw")||C!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+C+"' method")),b;var R=d(M,_.iterator,T.arg);if(R.type==="throw")return T.method="throw",T.arg=R.arg,T.delegate=null,b;var L=R.arg;return L?L.done?(T[_.resultName]=L.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=e),T.delegate=null,b):L:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function le(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function U(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(j,this),this.reset(!0)}function K(_){if(_||_===""){var T=_[s];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var C=-1,M=function R(){for(;++C<_.length;)if(r.call(_,C))return R.value=_[C],R.done=!1,R;return R.value=e,R.done=!0,R};return M.next=M}}throw new TypeError(typeof _+" is not iterable")}return x.prototype=w,o(E,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===x||(T.displayName||T.name)==="GeneratorFunction")},t.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,w):(_.__proto__=w,c(_,l,"GeneratorFunction")),_.prototype=Object.create(E),_},t.awrap=function(_){return{__await:_}},P(N.prototype),c(N.prototype,a,function(){return this}),t.AsyncIterator=N,t.async=function(_,T,C,M,R){R===void 0&&(R=Promise);var L=new N(u(_,T,C,M),R);return t.isGeneratorFunction(T)?L:L.next().then(function(G){return G.done?G.value:L.next()})},P(E),c(E,l,"Generator"),c(E,s,function(){return this}),c(E,"toString",function(){return"[object Generator]"}),t.keys=function(_){var T=Object(_),C=[];for(var M in T)C.push(M);return C.reverse(),function R(){for(;C.length;){var L=C.pop();if(L in T)return R.value=L,R.done=!1,R}return R.done=!0,R}},t.values=K,U.prototype={constructor:U,reset:function(_){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(le),!_)for(var T in this)T.charAt(0)==="t"&&r.call(this,T)&&!isNaN(+T.slice(1))&&(this[T]=e)},stop:function(){this.done=!0;var _=this.tryEntries[0].completion;if(_.type==="throw")throw _.arg;return this.rval},dispatchException:function(_){if(this.done)throw _;var T=this;function C(me,Be){return L.type="throw",L.arg=_,T.next=me,Be&&(T.method="next",T.arg=e),!!Be}for(var M=this.tryEntries.length-1;M>=0;--M){var R=this.tryEntries[M],L=R.completion;if(R.tryLoc==="root")return C("end");if(R.tryLoc<=this.prev){var G=r.call(R,"catchLoc"),ve=r.call(R,"finallyLoc");if(G&&ve){if(this.prev<R.catchLoc)return C(R.catchLoc,!0);if(this.prev<R.finallyLoc)return C(R.finallyLoc)}else if(G){if(this.prev<R.catchLoc)return C(R.catchLoc,!0)}else{if(!ve)throw new Error("try statement without catch or finally");if(this.prev<R.finallyLoc)return C(R.finallyLoc)}}}},abrupt:function(_,T){for(var C=this.tryEntries.length-1;C>=0;--C){var M=this.tryEntries[C];if(M.tryLoc<=this.prev&&r.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var R=M;break}}R&&(_==="break"||_==="continue")&&R.tryLoc<=T&&T<=R.finallyLoc&&(R=null);var L=R?R.completion:{};return L.type=_,L.arg=T,R?(this.method="next",this.next=R.finallyLoc,b):this.complete(L)},complete:function(_,T){if(_.type==="throw")throw _.arg;return _.type==="break"||_.type==="continue"?this.next=_.arg:_.type==="return"?(this.rval=this.arg=_.arg,this.method="return",this.next="end"):_.type==="normal"&&T&&(this.next=T),b},finish:function(_){for(var T=this.tryEntries.length-1;T>=0;--T){var C=this.tryEntries[T];if(C.finallyLoc===_)return this.complete(C.completion,C.afterLoc),le(C),b}},catch:function(_){for(var T=this.tryEntries.length-1;T>=0;--T){var C=this.tryEntries[T];if(C.tryLoc===_){var M=C.completion;if(M.type==="throw"){var R=M.arg;le(C)}return R}}throw new Error("illegal catch attempt")},delegateYield:function(_,T,C){return this.delegate={iterator:K(_),resultName:T,nextLoc:C},this.method==="next"&&(this.arg=e),b}},t}function dk(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){n(c);return}a.done?t(l):Promise.resolve(l).then(r,o)}function ol(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){dk(i,r,o,s,a,"next",l)}function a(l){dk(i,r,o,s,a,"throw",l)}s(void 0)})}}var Qx=function(){function e(t){jt(this,e),this.host=t}return zt(e,[{key:"getDisableUrl",value:function(n){return"".concat(this.host,"/disable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getLoginUrl",value:function(n){return"".concat(this.host,"/authorize?redirect_to=").concat(encodeURIComponent(n))}},{key:"getEnableUrl",value:function(n){return"".concat(this.host,"/enable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getPatches",value:function(){var t=ol(Yn().mark(function r(o){var i,s,a;return Yn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return i=o.patchIds,s=o.headers,a=i?"?".concat(i.map(function(u){return"".concat(u,"=").concat(encodeURIComponent(u))}).join("&")):"",c.abrupt("return",fetch("".concat(this.host,"/patches/~").concat(a),{headers:s||{"Content-Type":"application/json"}}).then(function(u){return Si(u)}).catch(Ds));case 3:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"deletePatches",value:function(){var t=ol(Yn().mark(function r(o,i){var s;return Yn().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return s=new URLSearchParams,o.forEach(function(c){return s.append("id",c)}),l.abrupt("return",fetch("".concat(this.host,"/patches/~?").concat(s),{method:"DELETE",headers:i||{"Content-Type":"application/json"}}).then(function(c){return Si(c)}).catch(Ds));case 3:case"end":return l.stop()}},r,this)}));function n(r,o){return t.apply(this,arguments)}return n}()},{key:"getEditUrl",value:function(){return"/val"}},{key:"postPatches",value:function(n,r,o){return fetch("".concat(this.host,"/patches/~"),{headers:o||{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(se({},n,r))}).then(function(){var i=ol(Yn().mark(function s(a){return Yn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",Si(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(Ds)}},{key:"getSession",value:function(){return fetch("".concat(this.host,"/session")).then(function(n){return Si(n).catch(Ds)})}},{key:"getTree",value:function(n){var r=n.patch,o=r===void 0?!1:r,i=n.includeSchema,s=i===void 0?!1:i,a=n.includeSource,l=a===void 0?!1:a,c=n.treePath,u=c===void 0?"/":c,d=n.headers,f=new URLSearchParams;return f.set("patch",o.toString()),f.set("schema",s.toString()),f.set("source",l.toString()),fetch("".concat(this.host,"/tree/~").concat(u,"?").concat(f.toString()),{headers:d}).then(function(p){return Si(p)}).catch(Ds)}},{key:"postCommit",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/commit"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=ol(Yn().mark(function s(a){var l;return Yn().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(!a.ok){u.next=4;break}return u.abrupt("return",Si(a));case 4:if(!(a.status===400&&a.headers.get("content-type")==="application/json")){u.next=13;break}return u.next=7,a.json();case 7:if(l=u.sent,!("validationErrors"in l)){u.next=12;break}return u.abrupt("return",_t(l));case 12:return u.abrupt("return",YO(a.status,l,a.statusText));case 13:return u.abrupt("return",Si(a));case 14:case"end":return u.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(Ds)}},{key:"postValidate",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/validate"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(){var i=ol(Yn().mark(function s(a){return Yn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",Si(a));case 1:case"end":return c.stop()}},s)}));return function(s){return i.apply(this,arguments)}}()).catch(Ds)}}]),e}();function Ds(e){return _t({statusCode:500,message:e instanceof Error||ce(e)==="object"&&e&&"message"in e&&typeof e.message=="string"?e.message:"Unknown error",details:ce(e)==="object"&&e&&"details"in e?e.details:void 0})}function YO(e,t,n){return _t({statusCode:e,message:t.message||n,details:t.details||Object.fromEntries(Object.entries(t).filter(function(r){var o=Sn(r,1),i=o[0];return i!=="message"}))})}function Si(e){return Ly.apply(this,arguments)}function Ly(){return Ly=ol(Yn().mark(function e(t){var n;return Yn().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,!t.ok){o.next=9;break}return o.t0=He,o.next=5,t.json();case 5:return o.t1=o.sent,o.abrupt("return",o.t0.ok.call(o.t0,o.t1));case 9:return o.prev=9,o.next=12,t.json();case 12:return n=o.sent,o.abrupt("return",YO(t.status,n,t.statusText));case 16:return o.prev=16,o.t2=o.catch(9),o.abrupt("return",_t({statusCode:t.status,message:t.statusText}));case 19:o.next=24;break;case 21:return o.prev=21,o.t3=o.catch(0),o.abrupt("return",_t({message:o.t3 instanceof Error?o.t3.message:"Unknown error"}));case 24:case"end":return o.stop()}},e,null,[[0,21],[9,16]])})),Ly.apply(this,arguments)}var Fe={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:jO,getSchema:wD,getValPath:FO,getVal:ZD,getSource:AD,resolvePath:VD,splitModuleIdAndModulePath:ID,isVal:_D,createValPathOfItem:kr,getSHA256Hash:p3,initSchema:XD,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&&h3(n)}).join("/"))},createPatchPath:function(t){return KO(t)},patchPathToModulePath:function(t){return t.map(function(n){return Number.isInteger(Number(n))?n:JSON.stringify(n)}).join(".")},VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session"};function h3(e){try{return JSON.parse(e)}catch{return e}}var XO={exports:{}};/*!
|
|
44
44
|
Copyright (c) 2018 Jed Watson.
|
|
45
45
|
Licensed under the MIT License (MIT), see
|
|
46
46
|
http://jedwatson.github.io/classnames
|
package/server/.tmp/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Val</title>
|
|
7
|
-
<script type="module" crossorigin src="/api/val/static/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/api/val/static/assets/index-74U4UJnx.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/api/val/static/assets/index-O8QijCC5.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|