@remoteoss/json-schema-form 1.0.0-beta.8 → 1.0.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  var Ya=Object.create;var hr=Object.defineProperty;var Za=Object.getOwnPropertyDescriptor;var Qa=Object.getOwnPropertyNames;var es=Object.getPrototypeOf,rs=Object.prototype.hasOwnProperty;var u=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ts=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Qa(r))!rs.call(e,o)&&o!==t&&hr(e,o,{get:()=>r[o],enumerable:!(n=Za(r,o))||n.enumerable});return e};var A=(e,r,t)=>(t=e!=null?Ya(es(e)):{},ts(r||!e||!e.__esModule?hr(t,"default",{value:e,enumerable:!0}):t,e));var k=u((hm,mr)=>{"use strict";mr.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var Je=u(q=>{"use strict";var d=k(),je=()=>[{type:d.RANGE,from:48,to:57}],gr=()=>[{type:d.CHAR,value:95},{type:d.RANGE,from:97,to:122},{type:d.RANGE,from:65,to:90}].concat(je()),yr=()=>[{type:d.CHAR,value:9},{type:d.CHAR,value:10},{type:d.CHAR,value:11},{type:d.CHAR,value:12},{type:d.CHAR,value:13},{type:d.CHAR,value:32},{type:d.CHAR,value:160},{type:d.CHAR,value:5760},{type:d.RANGE,from:8192,to:8202},{type:d.CHAR,value:8232},{type:d.CHAR,value:8233},{type:d.CHAR,value:8239},{type:d.CHAR,value:8287},{type:d.CHAR,value:12288},{type:d.CHAR,value:65279}],ns=()=>[{type:d.CHAR,value:10},{type:d.CHAR,value:13},{type:d.CHAR,value:8232},{type:d.CHAR,value:8233}];q.words=()=>({type:d.SET,set:gr(),not:!1});q.notWords=()=>({type:d.SET,set:gr(),not:!0});q.ints=()=>({type:d.SET,set:je(),not:!1});q.notInts=()=>({type:d.SET,set:je(),not:!0});q.whitespace=()=>({type:d.SET,set:yr(),not:!1});q.notWhitespace=()=>({type:d.SET,set:yr(),not:!0});q.anyChar=()=>({type:d.SET,set:ns(),not:!0})});var xr=u(W=>{"use strict";var br=k(),F=Je(),is="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",os={0:0,t:9,n:10,v:11,f:12,r:13};W.strToChars=function(e){var r=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return e=e.replace(r,function(t,n,o,i,a,s,l,c){if(o)return t;var f=n?8:i?parseInt(i,16):a?parseInt(a,16):s?parseInt(s,8):l?is.indexOf(l):os[c],p=String.fromCharCode(f);return/[[\]{}^$.|?*+()]/.test(p)&&(p="\\"+p),p}),e};W.tokenizeClass=(e,r)=>{for(var t=[],n=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,o,i;(o=n.exec(e))!=null;)if(o[1])t.push(F.words());else if(o[2])t.push(F.ints());else if(o[3])t.push(F.whitespace());else if(o[4])t.push(F.notWords());else if(o[5])t.push(F.notInts());else if(o[6])t.push(F.notWhitespace());else if(o[7])t.push({type:br.RANGE,from:(o[8]||o[9]).charCodeAt(0),to:o[10].charCodeAt(0)});else if(i=o[12])t.push({type:br.CHAR,value:i.charCodeAt(0)});else return[t,n.lastIndex];W.error(r,"Unterminated character class")};W.error=(e,r)=>{throw new SyntaxError("Invalid regular expression: /"+e+"/: "+r)}});var Sr=u(K=>{"use strict";var pe=k();K.wordBoundary=()=>({type:pe.POSITION,value:"b"});K.nonWordBoundary=()=>({type:pe.POSITION,value:"B"});K.begin=()=>({type:pe.POSITION,value:"^"});K.end=()=>({type:pe.POSITION,value:"$"})});var Or=u((bm,Fe)=>{"use strict";var N=xr(),O=k(),V=Je(),de=Sr();Fe.exports=e=>{var r=0,t,n,o={type:O.ROOT,stack:[]},i=o,a=o.stack,s=[],l=Xa=>{N.error(e,`Nothing to repeat at column ${Xa-1}`)},c=N.strToChars(e);for(t=c.length;r<t;)switch(n=c[r++],n){case"\\":switch(n=c[r++],n){case"b":a.push(de.wordBoundary());break;case"B":a.push(de.nonWordBoundary());break;case"w":a.push(V.words());break;case"W":a.push(V.notWords());break;case"d":a.push(V.ints());break;case"D":a.push(V.notInts());break;case"s":a.push(V.whitespace());break;case"S":a.push(V.notWhitespace());break;default:/\d/.test(n)?a.push({type:O.REFERENCE,value:parseInt(n,10)}):a.push({type:O.CHAR,value:n.charCodeAt(0)})}break;case"^":a.push(de.begin());break;case"$":a.push(de.end());break;case"[":var f;c[r]==="^"?(f=!0,r++):f=!1;var p=N.tokenizeClass(c.slice(r),e);r+=p[1],a.push({type:O.SET,set:p[0],not:f});break;case".":a.push(V.anyChar());break;case"(":var h={type:O.GROUP,stack:[],remember:!0};n=c[r],n==="?"&&(n=c[r+1],r+=2,n==="="?h.followedBy=!0:n==="!"?h.notFollowedBy=!0:n!==":"&&N.error(e,`Invalid group, character '${n}' after '?' at column ${r-1}`),h.remember=!1),a.push(h),s.push(i),i=h,a=h.stack;break;case")":s.length===0&&N.error(e,`Unmatched ) at column ${r-1}`),i=s.pop(),a=i.options?i.options[i.options.length-1]:i.stack;break;case"|":i.options||(i.options=[i.stack],delete i.stack);var b=[];i.options.push(b),a=b;break;case"{":var g=/^(\d+)(,(\d+)?)?\}/.exec(c.slice(r)),J,dr;g!==null?(a.length===0&&l(r),J=parseInt(g[1],10),dr=g[2]?g[3]?parseInt(g[3],10):1/0:J,r+=g[0].length,a.push({type:O.REPETITION,min:J,max:dr,value:a.pop()})):a.push({type:O.CHAR,value:123});break;case"?":a.length===0&&l(r),a.push({type:O.REPETITION,min:0,max:1,value:a.pop()});break;case"+":a.length===0&&l(r),a.push({type:O.REPETITION,min:1,max:1/0,value:a.pop()});break;case"*":a.length===0&&l(r),a.push({type:O.REPETITION,min:0,max:1/0,value:a.pop()});break;default:a.push({type:O.CHAR,value:n.charCodeAt(0)})}return s.length!==0&&N.error(e,"Unterminated group"),o};Fe.exports.types=O});var Er=u((xm,vr)=>{"use strict";var P=class e{constructor(r,t){this.low=r,this.high=t,this.length=1+t-r}overlaps(r){return!(this.high<r.low||this.low>r.high)}touches(r){return!(this.high+1<r.low||this.low-1>r.high)}add(r){return new e(Math.min(this.low,r.low),Math.max(this.high,r.high))}subtract(r){return r.low<=this.low&&r.high>=this.high?[]:r.low>this.low&&r.high<this.high?[new e(this.low,r.low-1),new e(r.high+1,this.high)]:r.low<=this.low?[new e(r.high+1,this.high)]:[new e(this.low,r.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},Ne=class e{constructor(r,t){this.ranges=[],this.length=0,r!=null&&this.add(r,t)}_update_length(){this.length=this.ranges.reduce((r,t)=>r+t.length,0)}add(r,t){var n=o=>{for(var i=0;i<this.ranges.length&&!o.touches(this.ranges[i]);)i++;for(var a=this.ranges.slice(0,i);i<this.ranges.length&&o.touches(this.ranges[i]);)o=o.add(this.ranges[i]),i++;a.push(o),this.ranges=a.concat(this.ranges.slice(i)),this._update_length()};return r instanceof e?r.ranges.forEach(n):(t==null&&(t=r),n(new P(r,t))),this}subtract(r,t){var n=o=>{for(var i=0;i<this.ranges.length&&!o.overlaps(this.ranges[i]);)i++;for(var a=this.ranges.slice(0,i);i<this.ranges.length&&o.overlaps(this.ranges[i]);)a=a.concat(this.ranges[i].subtract(o)),i++;this.ranges=a.concat(this.ranges.slice(i)),this._update_length()};return r instanceof e?r.ranges.forEach(n):(t==null&&(t=r),n(new P(r,t))),this}intersect(r,t){var n=[],o=i=>{for(var a=0;a<this.ranges.length&&!i.overlaps(this.ranges[a]);)a++;for(;a<this.ranges.length&&i.overlaps(this.ranges[a]);){var s=Math.max(this.ranges[a].low,i.low),l=Math.min(this.ranges[a].high,i.high);n.push(new P(s,l)),a++}};return r instanceof e?r.ranges.forEach(o):(t==null&&(t=r),o(new P(r,t))),this.ranges=n,this._update_length(),this}index(r){for(var t=0;t<this.ranges.length&&this.ranges[t].length<=r;)r-=this.ranges[t].length,t++;return this.ranges[t].low+r}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new e(this)}numbers(){return this.ranges.reduce((r,t)=>{for(var n=t.low;n<=t.high;)r.push(n),n++;return r},[])}subranges(){return this.ranges.map(r=>({low:r.low,high:r.high,length:1+r.high-r.low}))}};vr.exports=Ne});var qr=u((Sm,Tr)=>{"use strict";var he=Or(),X=Er(),_=he.types;Tr.exports=class Y{constructor(r,t){if(this._setDefaults(r),r instanceof RegExp)this.ignoreCase=r.ignoreCase,this.multiline=r.multiline,r=r.source;else if(typeof r=="string")this.ignoreCase=t&&t.indexOf("i")!==-1,this.multiline=t&&t.indexOf("m")!==-1;else throw new Error("Expected a regexp or string");this.tokens=he(r)}_setDefaults(r){this.max=r.max!=null?r.max:Y.prototype.max!=null?Y.prototype.max:100,this.defaultRange=r.defaultRange?r.defaultRange:this.defaultRange.clone(),r.randInt&&(this.randInt=r.randInt)}gen(){return this._gen(this.tokens,[])}_gen(r,t){var n,o,i,a,s;switch(r.type){case _.ROOT:case _.GROUP:if(r.followedBy||r.notFollowedBy)return"";for(r.remember&&r.groupNumber===void 0&&(r.groupNumber=t.push(null)-1),n=r.options?this._randSelect(r.options):r.stack,o="",a=0,s=n.length;a<s;a++)o+=this._gen(n[a],t);return r.remember&&(t[r.groupNumber]=o),o;case _.POSITION:return"";case _.SET:var l=this._expand(r);return l.length?String.fromCharCode(this._randSelect(l)):"";case _.REPETITION:for(i=this.randInt(r.min,r.max===1/0?r.min+this.max:r.max),o="",a=0;a<i;a++)o+=this._gen(r.value,t);return o;case _.REFERENCE:return t[r.value-1]||"";case _.CHAR:var c=this.ignoreCase&&this._randBool()?this._toOtherCase(r.value):r.value;return String.fromCharCode(c)}}_toOtherCase(r){return r+(97<=r&&r<=122?-32:65<=r&&r<=90?32:0)}_randBool(){return!this.randInt(0,1)}_randSelect(r){return r instanceof X?r.index(this.randInt(0,r.length-1)):r[this.randInt(0,r.length-1)]}_expand(r){if(r.type===he.types.CHAR)return new X(r.value);if(r.type===he.types.RANGE)return new X(r.from,r.to);{let t=new X;for(let n=0;n<r.set.length;n++){let o=this._expand(r.set[n]);if(t.add(o),this.ignoreCase)for(let i=0;i<o.length;i++){let a=o.index(i),s=this._toOtherCase(a);a!==s&&t.add(s)}}return r.not?this.defaultRange.clone().subtract(t):this.defaultRange.clone().intersect(t)}}randInt(r,t){return r+Math.floor(Math.random()*(1+t-r))}get defaultRange(){return this._range=this._range||new X(32,126)}set defaultRange(r){this._range=r}static randexp(r,t){var n;return typeof r=="string"&&(r=new RegExp(r,t)),r._randexp===void 0?(n=new Y(r,t),r._randexp=n):(n=r._randexp,n._setDefaults(r)),n.gen()}static sugar(){RegExp.prototype.gen=function(){return Y.randexp(this)}}}});var Be=u((Vg,ot)=>{"use strict";var Ps=typeof global=="object"&&global&&global.Object===Object&&global;ot.exports=Ps});var C=u((_g,at)=>{"use strict";var Ms=Be(),Ls=typeof self=="object"&&self&&self.Object===Object&&self,Ds=Ms||Ls||Function("return this")();at.exports=Ds});var ee=u((wg,st)=>{"use strict";var Bs=C(),$s=Bs.Symbol;st.exports=$s});var ct=u((Cg,ft)=>{"use strict";var ut=ee(),lt=Object.prototype,Us=lt.hasOwnProperty,Hs=lt.toString,re=ut?ut.toStringTag:void 0;function zs(e){var r=Us.call(e,re),t=e[re];try{e[re]=void 0;var n=!0}catch{}var o=Hs.call(e);return n&&(r?e[re]=t:delete e[re]),o}ft.exports=zs});var dt=u((Rg,pt)=>{"use strict";var Gs=Object.prototype,ks=Gs.toString;function Ws(e){return ks.call(e)}pt.exports=Ws});var M=u((jg,gt)=>{"use strict";var ht=ee(),Ks=ct(),Xs=dt(),Ys="[object Null]",Zs="[object Undefined]",mt=ht?ht.toStringTag:void 0;function Qs(e){return e==null?e===void 0?Zs:Ys:mt&&mt in Object(e)?Ks(e):Xs(e)}gt.exports=Qs});var T=u((Jg,yt)=>{"use strict";function eu(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}yt.exports=eu});var Se=u((Fg,bt)=>{"use strict";var ru=M(),tu=T(),nu="[object AsyncFunction]",iu="[object Function]",ou="[object GeneratorFunction]",au="[object Proxy]";function su(e){if(!tu(e))return!1;var r=ru(e);return r==iu||r==ou||r==nu||r==au}bt.exports=su});var St=u((Ng,xt)=>{"use strict";var uu=C(),lu=uu["__core-js_shared__"];xt.exports=lu});var Et=u((Pg,vt)=>{"use strict";var $e=St(),Ot=function(){var e=/[^.]+$/.exec($e&&$e.keys&&$e.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function fu(e){return!!Ot&&Ot in e}vt.exports=fu});var qt=u((Mg,Tt)=>{"use strict";var cu=Function.prototype,pu=cu.toString;function du(e){if(e!=null){try{return pu.call(e)}catch{}try{return e+""}catch{}}return""}Tt.exports=du});var At=u((Lg,It)=>{"use strict";var hu=Se(),mu=Et(),gu=T(),yu=qt(),bu=/[\\^$.*+?()[\]{}|]/g,xu=/^\[object .+?Constructor\]$/,Su=Function.prototype,Ou=Object.prototype,vu=Su.toString,Eu=Ou.hasOwnProperty,Tu=RegExp("^"+vu.call(Eu).replace(bu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qu(e){if(!gu(e)||mu(e))return!1;var r=hu(e)?Tu:xu;return r.test(yu(e))}It.exports=qu});var _t=u((Dg,Vt)=>{"use strict";function Iu(e,r){return e?.[r]}Vt.exports=Iu});var Oe=u((Bg,wt)=>{"use strict";var Au=At(),Vu=_t();function _u(e,r){var t=Vu(e,r);return Au(t)?t:void 0}wt.exports=_u});var te=u(($g,Ct)=>{"use strict";var wu=Oe(),Cu=wu(Object,"create");Ct.exports=Cu});var Jt=u((Ug,jt)=>{"use strict";var Rt=te();function Ru(){this.__data__=Rt?Rt(null):{},this.size=0}jt.exports=Ru});var Nt=u((Hg,Ft)=>{"use strict";function ju(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}Ft.exports=ju});var Mt=u((zg,Pt)=>{"use strict";var Ju=te(),Fu="__lodash_hash_undefined__",Nu=Object.prototype,Pu=Nu.hasOwnProperty;function Mu(e){var r=this.__data__;if(Ju){var t=r[e];return t===Fu?void 0:t}return Pu.call(r,e)?r[e]:void 0}Pt.exports=Mu});var Dt=u((Gg,Lt)=>{"use strict";var Lu=te(),Du=Object.prototype,Bu=Du.hasOwnProperty;function $u(e){var r=this.__data__;return Lu?r[e]!==void 0:Bu.call(r,e)}Lt.exports=$u});var $t=u((kg,Bt)=>{"use strict";var Uu=te(),Hu="__lodash_hash_undefined__";function zu(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=Uu&&r===void 0?Hu:r,this}Bt.exports=zu});var Ht=u((Wg,Ut)=>{"use strict";var Gu=Jt(),ku=Nt(),Wu=Mt(),Ku=Dt(),Xu=$t();function L(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}L.prototype.clear=Gu;L.prototype.delete=ku;L.prototype.get=Wu;L.prototype.has=Ku;L.prototype.set=Xu;Ut.exports=L});var Gt=u((Kg,zt)=>{"use strict";function Yu(){this.__data__=[],this.size=0}zt.exports=Yu});var ne=u((Xg,kt)=>{"use strict";function Zu(e,r){return e===r||e!==e&&r!==r}kt.exports=Zu});var ie=u((Yg,Wt)=>{"use strict";var Qu=ne();function el(e,r){for(var t=e.length;t--;)if(Qu(e[t][0],r))return t;return-1}Wt.exports=el});var Xt=u((Zg,Kt)=>{"use strict";var rl=ie(),tl=Array.prototype,nl=tl.splice;function il(e){var r=this.__data__,t=rl(r,e);if(t<0)return!1;var n=r.length-1;return t==n?r.pop():nl.call(r,t,1),--this.size,!0}Kt.exports=il});var Zt=u((Qg,Yt)=>{"use strict";var ol=ie();function al(e){var r=this.__data__,t=ol(r,e);return t<0?void 0:r[t][1]}Yt.exports=al});var en=u((ey,Qt)=>{"use strict";var sl=ie();function ul(e){return sl(this.__data__,e)>-1}Qt.exports=ul});var tn=u((ry,rn)=>{"use strict";var ll=ie();function fl(e,r){var t=this.__data__,n=ll(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}rn.exports=fl});var oe=u((ty,nn)=>{"use strict";var cl=Gt(),pl=Xt(),dl=Zt(),hl=en(),ml=tn();function D(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}D.prototype.clear=cl;D.prototype.delete=pl;D.prototype.get=dl;D.prototype.has=hl;D.prototype.set=ml;nn.exports=D});var Ue=u((ny,on)=>{"use strict";var gl=Oe(),yl=C(),bl=gl(yl,"Map");on.exports=bl});var un=u((iy,sn)=>{"use strict";var an=Ht(),xl=oe(),Sl=Ue();function Ol(){this.size=0,this.__data__={hash:new an,map:new(Sl||xl),string:new an}}sn.exports=Ol});var fn=u((oy,ln)=>{"use strict";function vl(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}ln.exports=vl});var ae=u((ay,cn)=>{"use strict";var El=fn();function Tl(e,r){var t=e.__data__;return El(r)?t[typeof r=="string"?"string":"hash"]:t.map}cn.exports=Tl});var dn=u((sy,pn)=>{"use strict";var ql=ae();function Il(e){var r=ql(this,e).delete(e);return this.size-=r?1:0,r}pn.exports=Il});var mn=u((uy,hn)=>{"use strict";var Al=ae();function Vl(e){return Al(this,e).get(e)}hn.exports=Vl});var yn=u((ly,gn)=>{"use strict";var _l=ae();function wl(e){return _l(this,e).has(e)}gn.exports=wl});var xn=u((fy,bn)=>{"use strict";var Cl=ae();function Rl(e,r){var t=Cl(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}bn.exports=Rl});var ve=u((cy,Sn)=>{"use strict";var jl=un(),Jl=dn(),Fl=mn(),Nl=yn(),Pl=xn();function B(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}B.prototype.clear=jl;B.prototype.delete=Jl;B.prototype.get=Fl;B.prototype.has=Nl;B.prototype.set=Pl;Sn.exports=B});var vn=u((py,On)=>{"use strict";var Ml="__lodash_hash_undefined__";function Ll(e){return this.__data__.set(e,Ml),this}On.exports=Ll});var Tn=u((dy,En)=>{"use strict";function Dl(e){return this.__data__.has(e)}En.exports=Dl});var He=u((hy,qn)=>{"use strict";var Bl=ve(),$l=vn(),Ul=Tn();function Ee(e){var r=-1,t=e==null?0:e.length;for(this.__data__=new Bl;++r<t;)this.add(e[r])}Ee.prototype.add=Ee.prototype.push=$l;Ee.prototype.has=Ul;qn.exports=Ee});var An=u((my,In)=>{"use strict";function Hl(e,r,t,n){for(var o=e.length,i=t+(n?1:-1);n?i--:++i<o;)if(r(e[i],i,e))return i;return-1}In.exports=Hl});var _n=u((gy,Vn)=>{"use strict";function zl(e){return e!==e}Vn.exports=zl});var Cn=u((yy,wn)=>{"use strict";function Gl(e,r,t){for(var n=t-1,o=e.length;++n<o;)if(e[n]===r)return n;return-1}wn.exports=Gl});var jn=u((by,Rn)=>{"use strict";var kl=An(),Wl=_n(),Kl=Cn();function Xl(e,r,t){return r===r?Kl(e,r,t):kl(e,Wl,t)}Rn.exports=Xl});var ze=u((xy,Jn)=>{"use strict";var Yl=jn();function Zl(e,r){var t=e==null?0:e.length;return!!t&&Yl(e,r,0)>-1}Jn.exports=Zl});var Ge=u((Sy,Fn)=>{"use strict";function Ql(e,r,t){for(var n=-1,o=e==null?0:e.length;++n<o;)if(t(r,e[n]))return!0;return!1}Fn.exports=Ql});var se=u((Oy,Nn)=>{"use strict";function ef(e,r){for(var t=-1,n=e==null?0:e.length,o=Array(n);++t<n;)o[t]=r(e[t],t,e);return o}Nn.exports=ef});var Te=u((vy,Pn)=>{"use strict";function rf(e){return function(r){return e(r)}}Pn.exports=rf});var ke=u((Ey,Mn)=>{"use strict";function tf(e,r){return e.has(r)}Mn.exports=tf});var Dn=u((Ty,Ln)=>{"use strict";var nf=He(),of=ze(),af=Ge(),sf=se(),uf=Te(),lf=ke(),ff=200;function cf(e,r,t,n){var o=-1,i=of,a=!0,s=e.length,l=[],c=r.length;if(!s)return l;t&&(r=sf(r,uf(t))),n?(i=af,a=!1):r.length>=ff&&(i=lf,a=!1,r=new nf(r));e:for(;++o<s;){var f=e[o],p=t==null?f:t(f);if(f=n||f!==0?f:0,a&&p===p){for(var h=c;h--;)if(r[h]===p)continue e;l.push(f)}else i(r,p,n)||l.push(f)}return l}Ln.exports=cf});var $n=u((qy,Bn)=>{"use strict";function pf(e,r){for(var t=-1,n=r.length,o=e.length;++t<n;)e[o+t]=r[t];return e}Bn.exports=pf});var R=u((Iy,Un)=>{"use strict";function df(e){return e!=null&&typeof e=="object"}Un.exports=df});var zn=u((Ay,Hn)=>{"use strict";var hf=M(),mf=R(),gf="[object Arguments]";function yf(e){return mf(e)&&hf(e)==gf}Hn.exports=yf});var qe=u((Vy,Wn)=>{"use strict";var Gn=zn(),bf=R(),kn=Object.prototype,xf=kn.hasOwnProperty,Sf=kn.propertyIsEnumerable,Of=Gn(function(){return arguments}())?Gn:function(e){return bf(e)&&xf.call(e,"callee")&&!Sf.call(e,"callee")};Wn.exports=Of});var j=u((_y,Kn)=>{"use strict";var vf=Array.isArray;Kn.exports=vf});var Qn=u((wy,Zn)=>{"use strict";var Xn=ee(),Ef=qe(),Tf=j(),Yn=Xn?Xn.isConcatSpreadable:void 0;function qf(e){return Tf(e)||Ef(e)||!!(Yn&&e&&e[Yn])}Zn.exports=qf});var ti=u((Cy,ri)=>{"use strict";var If=$n(),Af=Qn();function ei(e,r,t,n,o){var i=-1,a=e.length;for(t||(t=Af),o||(o=[]);++i<a;){var s=e[i];r>0&&t(s)?r>1?ei(s,r-1,t,n,o):If(o,s):n||(o[o.length]=s)}return o}ri.exports=ei});var We=u((Ry,ni)=>{"use strict";function Vf(e){return e}ni.exports=Vf});var oi=u((jy,ii)=>{"use strict";function _f(e,r,t){switch(t.length){case 0:return e.call(r);case 1:return e.call(r,t[0]);case 2:return e.call(r,t[0],t[1]);case 3:return e.call(r,t[0],t[1],t[2])}return e.apply(r,t)}ii.exports=_f});var ui=u((Jy,si)=>{"use strict";var wf=oi(),ai=Math.max;function Cf(e,r,t){return r=ai(r===void 0?e.length-1:r,0),function(){for(var n=arguments,o=-1,i=ai(n.length-r,0),a=Array(i);++o<i;)a[o]=n[r+o];o=-1;for(var s=Array(r+1);++o<r;)s[o]=n[o];return s[r]=t(a),wf(e,this,s)}}si.exports=Cf});var fi=u((Fy,li)=>{"use strict";function Rf(e){return function(){return e}}li.exports=Rf});var Ke=u((Ny,ci)=>{"use strict";var jf=Oe(),Jf=function(){try{var e=jf(Object,"defineProperty");return e({},"",{}),e}catch{}}();ci.exports=Jf});var hi=u((Py,di)=>{"use strict";var Ff=fi(),pi=Ke(),Nf=We(),Pf=pi?function(e,r){return pi(e,"toString",{configurable:!0,enumerable:!1,value:Ff(r),writable:!0})}:Nf;di.exports=Pf});var gi=u((My,mi)=>{"use strict";var Mf=800,Lf=16,Df=Date.now;function Bf(e){var r=0,t=0;return function(){var n=Df(),o=Lf-(n-t);if(t=n,o>0){if(++r>=Mf)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}mi.exports=Bf});var bi=u((Ly,yi)=>{"use strict";var $f=hi(),Uf=gi(),Hf=Uf($f);yi.exports=Hf});var Ie=u((Dy,xi)=>{"use strict";var zf=We(),Gf=ui(),kf=bi();function Wf(e,r){return kf(Gf(e,r,zf),e+"")}xi.exports=Wf});var Xe=u((By,Si)=>{"use strict";var Kf=9007199254740991;function Xf(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Kf}Si.exports=Xf});var Ae=u(($y,Oi)=>{"use strict";var Yf=Se(),Zf=Xe();function Qf(e){return e!=null&&Zf(e.length)&&!Yf(e)}Oi.exports=Qf});var Ve=u((Uy,vi)=>{"use strict";var ec=Ae(),rc=R();function tc(e){return rc(e)&&ec(e)}vi.exports=tc});var qi=u((Hy,Ti)=>{"use strict";var nc=Dn(),ic=ti(),oc=Ie(),Ei=Ve(),ac=oc(function(e,r){return Ei(e)?nc(e,ic(r,1,Ei,!0)):[]});Ti.exports=ac});var _e=u((zy,Ii)=>{"use strict";var sc=M(),uc=R(),lc="[object Symbol]";function fc(e){return typeof e=="symbol"||uc(e)&&sc(e)==lc}Ii.exports=fc});var Vi=u((Gy,Ai)=>{"use strict";var cc=j(),pc=_e(),dc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hc=/^\w*$/;function mc(e,r){if(cc(e))return!1;var t=typeof e;return t=="number"||t=="symbol"||t=="boolean"||e==null||pc(e)?!0:hc.test(e)||!dc.test(e)||r!=null&&e in Object(r)}Ai.exports=mc});var Ci=u((ky,wi)=>{"use strict";var _i=ve(),gc="Expected a function";function Ye(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw new TypeError(gc);var t=function(){var n=arguments,o=r?r.apply(this,n):n[0],i=t.cache;if(i.has(o))return i.get(o);var a=e.apply(this,n);return t.cache=i.set(o,a)||i,a};return t.cache=new(Ye.Cache||_i),t}Ye.Cache=_i;wi.exports=Ye});var ji=u((Wy,Ri)=>{"use strict";var yc=Ci(),bc=500;function xc(e){var r=yc(e,function(n){return t.size===bc&&t.clear(),n}),t=r.cache;return r}Ri.exports=xc});var Fi=u((Ky,Ji)=>{"use strict";var Sc=ji(),Oc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vc=/\\(\\)?/g,Ec=Sc(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(""),e.replace(Oc,function(t,n,o,i){r.push(o?i.replace(vc,"$1"):n||t)}),r});Ji.exports=Ec});var Bi=u((Xy,Di)=>{"use strict";var Ni=ee(),Tc=se(),qc=j(),Ic=_e(),Ac=1/0,Pi=Ni?Ni.prototype:void 0,Mi=Pi?Pi.toString:void 0;function Li(e){if(typeof e=="string")return e;if(qc(e))return Tc(e,Li)+"";if(Ic(e))return Mi?Mi.call(e):"";var r=e+"";return r=="0"&&1/e==-Ac?"-0":r}Di.exports=Li});var Ui=u((Yy,$i)=>{"use strict";var Vc=Bi();function _c(e){return e==null?"":Vc(e)}$i.exports=_c});var Ze=u((Zy,Hi)=>{"use strict";var wc=j(),Cc=Vi(),Rc=Fi(),jc=Ui();function Jc(e,r){return wc(e)?e:Cc(e,r)?[e]:Rc(jc(e))}Hi.exports=Jc});var Qe=u((Qy,zi)=>{"use strict";var Fc=_e(),Nc=1/0;function Pc(e){if(typeof e=="string"||Fc(e))return e;var r=e+"";return r=="0"&&1/e==-Nc?"-0":r}zi.exports=Pc});var ki=u((eb,Gi)=>{"use strict";var Mc=Ze(),Lc=Qe();function Dc(e,r){r=Mc(r,e);for(var t=0,n=r.length;e!=null&&t<n;)e=e[Lc(r[t++])];return t&&t==n?e:void 0}Gi.exports=Dc});var Ki=u((rb,Wi)=>{"use strict";var Bc=ki();function $c(e,r,t){var n=e==null?void 0:Bc(e,r);return n===void 0?t:n}Wi.exports=$c});var Zi=u((tb,Yi)=>{"use strict";var Uc=He(),Hc=ze(),zc=Ge(),Gc=se(),kc=Te(),Xi=ke(),Wc=Math.min;function Kc(e,r,t){for(var n=t?zc:Hc,o=e[0].length,i=e.length,a=i,s=Array(i),l=1/0,c=[];a--;){var f=e[a];a&&r&&(f=Gc(f,kc(r))),l=Wc(f.length,l),s[a]=!t&&(r||o>=120&&f.length>=120)?new Uc(a&&f):void 0}f=e[0];var p=-1,h=s[0];e:for(;++p<o&&c.length<l;){var b=f[p],g=r?r(b):b;if(b=t||b!==0?b:0,!(h?Xi(h,g):n(c,g,t))){for(a=i;--a;){var J=s[a];if(!(J?Xi(J,g):n(e[a],g,t)))continue e}h&&h.push(g),c.push(b)}}return c}Yi.exports=Kc});var eo=u((nb,Qi)=>{"use strict";var Xc=Ve();function Yc(e){return Xc(e)?e:[]}Qi.exports=Yc});var to=u((ib,ro)=>{"use strict";var Zc=se(),Qc=Zi(),ep=Ie(),rp=eo(),tp=ep(function(e){var r=Zc(e,rp);return r.length&&r[0]===e[0]?Qc(r):[]});ro.exports=tp});var io=u((ob,no)=>{"use strict";var np=oe();function ip(){this.__data__=new np,this.size=0}no.exports=ip});var ao=u((ab,oo)=>{"use strict";function op(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}oo.exports=op});var uo=u((sb,so)=>{"use strict";function ap(e){return this.__data__.get(e)}so.exports=ap});var fo=u((ub,lo)=>{"use strict";function sp(e){return this.__data__.has(e)}lo.exports=sp});var po=u((lb,co)=>{"use strict";var up=oe(),lp=Ue(),fp=ve(),cp=200;function pp(e,r){var t=this.__data__;if(t instanceof up){var n=t.__data__;if(!lp||n.length<cp-1)return n.push([e,r]),this.size=++t.size,this;t=this.__data__=new fp(n)}return t.set(e,r),this.size=t.size,this}co.exports=pp});var mo=u((fb,ho)=>{"use strict";var dp=oe(),hp=io(),mp=ao(),gp=uo(),yp=fo(),bp=po();function $(e){var r=this.__data__=new dp(e);this.size=r.size}$.prototype.clear=hp;$.prototype.delete=mp;$.prototype.get=gp;$.prototype.has=yp;$.prototype.set=bp;ho.exports=$});var we=u((cb,yo)=>{"use strict";var go=Ke();function xp(e,r,t){r=="__proto__"&&go?go(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}yo.exports=xp});var er=u((pb,bo)=>{"use strict";var Sp=we(),Op=ne();function vp(e,r,t){(t!==void 0&&!Op(e[r],t)||t===void 0&&!(r in e))&&Sp(e,r,t)}bo.exports=vp});var So=u((db,xo)=>{"use strict";function Ep(e){return function(r,t,n){for(var o=-1,i=Object(r),a=n(r),s=a.length;s--;){var l=a[e?s:++o];if(t(i[l],l,i)===!1)break}return r}}xo.exports=Ep});var vo=u((hb,Oo)=>{"use strict";var Tp=So(),qp=Tp();Oo.exports=qp});var Ao=u((ue,U)=>{"use strict";var Ip=C(),Io=typeof ue=="object"&&ue&&!ue.nodeType&&ue,Eo=Io&&typeof U=="object"&&U&&!U.nodeType&&U,Ap=Eo&&Eo.exports===Io,To=Ap?Ip.Buffer:void 0,qo=To?To.allocUnsafe:void 0;function Vp(e,r){if(r)return e.slice();var t=e.length,n=qo?qo(t):new e.constructor(t);return e.copy(n),n}U.exports=Vp});var _o=u((mb,Vo)=>{"use strict";var _p=C(),wp=_p.Uint8Array;Vo.exports=wp});var Ro=u((gb,Co)=>{"use strict";var wo=_o();function Cp(e){var r=new e.constructor(e.byteLength);return new wo(r).set(new wo(e)),r}Co.exports=Cp});var Jo=u((yb,jo)=>{"use strict";var Rp=Ro();function jp(e,r){var t=r?Rp(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}jo.exports=jp});var No=u((bb,Fo)=>{"use strict";function Jp(e,r){var t=-1,n=e.length;for(r||(r=Array(n));++t<n;)r[t]=e[t];return r}Fo.exports=Jp});var Lo=u((xb,Mo)=>{"use strict";var Fp=T(),Po=Object.create,Np=function(){function e(){}return function(r){if(!Fp(r))return{};if(Po)return Po(r);e.prototype=r;var t=new e;return e.prototype=void 0,t}}();Mo.exports=Np});var Bo=u((Sb,Do)=>{"use strict";function Pp(e,r){return function(t){return e(r(t))}}Do.exports=Pp});var rr=u((Ob,$o)=>{"use strict";var Mp=Bo(),Lp=Mp(Object.getPrototypeOf,Object);$o.exports=Lp});var tr=u((vb,Uo)=>{"use strict";var Dp=Object.prototype;function Bp(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||Dp;return e===t}Uo.exports=Bp});var zo=u((Eb,Ho)=>{"use strict";var $p=Lo(),Up=rr(),Hp=tr();function zp(e){return typeof e.constructor=="function"&&!Hp(e)?$p(Up(e)):{}}Ho.exports=zp});var ko=u((Tb,Go)=>{"use strict";function Gp(){return!1}Go.exports=Gp});var nr=u((le,H)=>{"use strict";var kp=C(),Wp=ko(),Xo=typeof le=="object"&&le&&!le.nodeType&&le,Wo=Xo&&typeof H=="object"&&H&&!H.nodeType&&H,Kp=Wo&&Wo.exports===Xo,Ko=Kp?kp.Buffer:void 0,Xp=Ko?Ko.isBuffer:void 0,Yp=Xp||Wp;H.exports=Yp});var Qo=u((qb,Zo)=>{"use strict";var Zp=M(),Qp=rr(),ed=R(),rd="[object Object]",td=Function.prototype,nd=Object.prototype,Yo=td.toString,id=nd.hasOwnProperty,od=Yo.call(Object);function ad(e){if(!ed(e)||Zp(e)!=rd)return!1;var r=Qp(e);if(r===null)return!0;var t=id.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Yo.call(t)==od}Zo.exports=ad});var ra=u((Ib,ea)=>{"use strict";var sd=M(),ud=Xe(),ld=R(),fd="[object Arguments]",cd="[object Array]",pd="[object Boolean]",dd="[object Date]",hd="[object Error]",md="[object Function]",gd="[object Map]",yd="[object Number]",bd="[object Object]",xd="[object RegExp]",Sd="[object Set]",Od="[object String]",vd="[object WeakMap]",Ed="[object ArrayBuffer]",Td="[object DataView]",qd="[object Float32Array]",Id="[object Float64Array]",Ad="[object Int8Array]",Vd="[object Int16Array]",_d="[object Int32Array]",wd="[object Uint8Array]",Cd="[object Uint8ClampedArray]",Rd="[object Uint16Array]",jd="[object Uint32Array]",m={};m[qd]=m[Id]=m[Ad]=m[Vd]=m[_d]=m[wd]=m[Cd]=m[Rd]=m[jd]=!0;m[fd]=m[cd]=m[Ed]=m[pd]=m[Td]=m[dd]=m[hd]=m[md]=m[gd]=m[yd]=m[bd]=m[xd]=m[Sd]=m[Od]=m[vd]=!1;function Jd(e){return ld(e)&&ud(e.length)&&!!m[sd(e)]}ea.exports=Jd});var na=u((fe,z)=>{"use strict";var Fd=Be(),ta=typeof fe=="object"&&fe&&!fe.nodeType&&fe,ce=ta&&typeof z=="object"&&z&&!z.nodeType&&z,Nd=ce&&ce.exports===ta,ir=Nd&&Fd.process,Pd=function(){try{var e=ce&&ce.require&&ce.require("util").types;return e||ir&&ir.binding&&ir.binding("util")}catch{}}();z.exports=Pd});var or=u((Ab,aa)=>{"use strict";var Md=ra(),Ld=Te(),ia=na(),oa=ia&&ia.isTypedArray,Dd=oa?Ld(oa):Md;aa.exports=Dd});var ar=u((Vb,sa)=>{"use strict";function Bd(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}sa.exports=Bd});var sr=u((_b,ua)=>{"use strict";var $d=we(),Ud=ne(),Hd=Object.prototype,zd=Hd.hasOwnProperty;function Gd(e,r,t){var n=e[r];(!(zd.call(e,r)&&Ud(n,t))||t===void 0&&!(r in e))&&$d(e,r,t)}ua.exports=Gd});var fa=u((wb,la)=>{"use strict";var kd=sr(),Wd=we();function Kd(e,r,t,n){var o=!t;t||(t={});for(var i=-1,a=r.length;++i<a;){var s=r[i],l=n?n(t[s],e[s],s,t,e):void 0;l===void 0&&(l=e[s]),o?Wd(t,s,l):kd(t,s,l)}return t}la.exports=Kd});var pa=u((Cb,ca)=>{"use strict";function Xd(e,r){for(var t=-1,n=Array(e);++t<e;)n[t]=r(t);return n}ca.exports=Xd});var Ce=u((Rb,da)=>{"use strict";var Yd=9007199254740991,Zd=/^(?:0|[1-9]\d*)$/;function Qd(e,r){var t=typeof e;return r=r??Yd,!!r&&(t=="number"||t!="symbol"&&Zd.test(e))&&e>-1&&e%1==0&&e<r}da.exports=Qd});var ma=u((jb,ha)=>{"use strict";var eh=pa(),rh=qe(),th=j(),nh=nr(),ih=Ce(),oh=or(),ah=Object.prototype,sh=ah.hasOwnProperty;function uh(e,r){var t=th(e),n=!t&&rh(e),o=!t&&!n&&nh(e),i=!t&&!n&&!o&&oh(e),a=t||n||o||i,s=a?eh(e.length,String):[],l=s.length;for(var c in e)(r||sh.call(e,c))&&!(a&&(c=="length"||o&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ih(c,l)))&&s.push(c);return s}ha.exports=uh});var ya=u((Jb,ga)=>{"use strict";function lh(e){var r=[];if(e!=null)for(var t in Object(e))r.push(t);return r}ga.exports=lh});var xa=u((Fb,ba)=>{"use strict";var fh=T(),ch=tr(),ph=ya(),dh=Object.prototype,hh=dh.hasOwnProperty;function mh(e){if(!fh(e))return ph(e);var r=ch(e),t=[];for(var n in e)n=="constructor"&&(r||!hh.call(e,n))||t.push(n);return t}ba.exports=mh});var ur=u((Nb,Sa)=>{"use strict";var gh=ma(),yh=xa(),bh=Ae();function xh(e){return bh(e)?gh(e,!0):yh(e)}Sa.exports=xh});var va=u((Pb,Oa)=>{"use strict";var Sh=fa(),Oh=ur();function vh(e){return Sh(e,Oh(e))}Oa.exports=vh});var Va=u((Mb,Aa)=>{"use strict";var Ea=er(),Eh=Ao(),Th=Jo(),qh=No(),Ih=zo(),Ta=qe(),qa=j(),Ah=Ve(),Vh=nr(),_h=Se(),wh=T(),Ch=Qo(),Rh=or(),Ia=ar(),jh=va();function Jh(e,r,t,n,o,i,a){var s=Ia(e,t),l=Ia(r,t),c=a.get(l);if(c){Ea(e,t,c);return}var f=i?i(s,l,t+"",e,r,a):void 0,p=f===void 0;if(p){var h=qa(l),b=!h&&Vh(l),g=!h&&!b&&Rh(l);f=l,h||b||g?qa(s)?f=s:Ah(s)?f=qh(s):b?(p=!1,f=Eh(l,!0)):g?(p=!1,f=Th(l,!0)):f=[]:Ch(l)||Ta(l)?(f=s,Ta(s)?f=jh(s):(!wh(s)||_h(s))&&(f=Ih(l))):p=!1}p&&(a.set(l,f),o(f,l,n,i,a),a.delete(l)),Ea(e,t,f)}Aa.exports=Jh});var lr=u((Lb,wa)=>{"use strict";var Fh=mo(),Nh=er(),Ph=vo(),Mh=Va(),Lh=T(),Dh=ur(),Bh=ar();function _a(e,r,t,n,o){e!==r&&Ph(r,function(i,a){if(o||(o=new Fh),Lh(i))Mh(e,r,a,t,_a,n,o);else{var s=n?n(Bh(e,a),i,a+"",e,r,o):void 0;s===void 0&&(s=i),Nh(e,a,s)}},Dh)}wa.exports=_a});var Ra=u((Db,Ca)=>{"use strict";var $h=ne(),Uh=Ae(),Hh=Ce(),zh=T();function Gh(e,r,t){if(!zh(t))return!1;var n=typeof r;return(n=="number"?Uh(t)&&Hh(r,t.length):n=="string"&&r in t)?$h(t[r],e):!1}Ca.exports=Gh});var fr=u((Bb,ja)=>{"use strict";var kh=Ie(),Wh=Ra();function Kh(e){return kh(function(r,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,a=o>2?t[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,a&&Wh(t[0],t[1],a)&&(i=o<3?void 0:i,o=1),r=Object(r);++n<o;){var s=t[n];s&&e(r,s,n,i)}return r})}ja.exports=Kh});var Fa=u(($b,Ja)=>{"use strict";var Xh=lr(),Yh=fr(),Zh=Yh(function(e,r,t){Xh(e,r,t)});Ja.exports=Zh});var Pa=u((Ub,Na)=>{"use strict";var Qh=lr(),em=fr(),rm=em(function(e,r,t,n){Qh(e,r,t,n)});Na.exports=rm});var Da=u((Hb,La)=>{"use strict";var tm=sr(),nm=Ze(),im=Ce(),Ma=T(),om=Qe();function am(e,r,t,n){if(!Ma(e))return e;r=nm(r,e);for(var o=-1,i=r.length,a=i-1,s=e;s!=null&&++o<i;){var l=om(r[o]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(o!=a){var f=s[l];c=n?n(f,l,s):void 0,c===void 0&&(c=Ma(f)?f:im(r[o+1])?[]:{})}tm(s,l,c),s=s[l]}return e}La.exports=am});var $a=u((zb,Ba)=>{"use strict";var sm=Da();function um(e,r,t){return e==null?e:sm(e,r,t)}Ba.exports=um});var jr=A(qr(),1);function Ar(e){if(e===0)return 0;let r=e/1024;return Number.parseFloat(r.toFixed(2))}var as=["if","then","else"];function Ir(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Z(e,r){if(!(!e||!r)&&!(typeof e!="object"||typeof r!="object"))for(let[t,n]of Object.entries(r)){if(as.includes(t))continue;let o=e[t];if(Ir(n))Ir(o)?Z(o,n):o!==n&&(e[t]=n);else if(o&&Array.isArray(n)){let i=o;for(let a of n)a&&typeof a=="object"?Z(i,n):t==="required"?i.find(s=>s===a)||i.push(a):e[t]=n}else e[t]!==n&&(e[t]=n)}}var Vr="yyyy-MM-dd";function _r(e,r){let t=new Date(e).getTime(),n=new Date(r).getTime();return t<n?"LESSER":t>n?"GREATER":"EQUAL"}function ss(e,r){let t=_r(e,r);return t==="GREATER"||t==="EQUAL"}function us(e,r){let t=_r(e,r);return t==="LESSER"||t==="EQUAL"}function wr(e,r,t,n=[]){let o=typeof e=="string",i=e==="",a=e===void 0||e===null&&t.treatNullAsUndefined,s=i||a,l=[];if(!o||s||r["x-jsf-presentation"]===void 0)return l;let{minDate:c,maxDate:f}=r["x-jsf-presentation"];return c&&!ss(e,c)&&l.push({path:n,validation:"minDate",schema:r,value:e}),f&&!us(e,f)&&l.push({path:n,validation:"maxDate",schema:r,value:e}),l}function Cr(e){return e["x-jsf-presentation"]?.inputType==="checkbox"}var Rr="Please acknowledge this field";function Jr(e,r,t,n){let o=e["x-jsf-presentation"];switch(t){case"type":return ls(e.type);case"required":return Cr(e)?Rr:"Required field";case"forbidden":return"Not allowed";case"const":return Cr(e)&&r===!1?Rr:`The only accepted value is ${JSON.stringify(e.const)}.`;case"enum":return`The option "${Pe(r)}" is not valid.`;case"anyOf":return`The option "${Pe(r)}" is not valid.`;case"oneOf":return`The option "${Pe(r)}" is not valid.`;case"not":return"The value must not satisfy the provided schema";case"minLength":return`Please insert at least ${e.minLength} characters`;case"maxLength":return`Please insert up to ${e.maxLength} characters`;case"pattern":return`Must have a valid format. E.g. ${(0,jr.randexp)(e.pattern||"")}`;case"format":if(e.format==="email")return"Please enter a valid email address";if(e.format==="date"){let i=new Date().toISOString().split("T")[0];return`Must be a valid date in ${Vr.toLowerCase()} format. e.g. ${i}`}return`Must be a valid ${e.format} format`;case"multipleOf":return`Must be a multiple of ${e.multipleOf}`;case"maximum":return`Must be smaller or equal to ${e.maximum}`;case"exclusiveMaximum":return`Must be smaller than ${e.exclusiveMaximum}`;case"minimum":return`Must be greater or equal to ${e.minimum}`;case"exclusiveMinimum":return`Must be greater than ${e.exclusiveMinimum}`;case"minDate":return`The date must be ${o?.minDate} or after.`;case"maxDate":return`The date must be ${o?.maxDate} or before.`;case"fileStructure":return"Not a valid file.";case"maxFileSize":{let i=o?.maxFileSize,a=typeof i=="number"?Ar(i):void 0;return`File size too large.${a?` The limit is ${a} MB.`:""}`}case"accept":{let i=o?.accept;return`Unsupported file format.${i?` The acceptable formats are ${i}.`:""}`}case"minItems":{let i=e.minItems===1?"item":"items";return`Must have at least ${e.minItems} ${i}`}case"maxItems":{let i=e.maxItems===1?"item":"items";return`Must have at most ${e.maxItems} ${i}`}case"uniqueItems":return"Items must be unique";case"contains":throw new Error('"contains" is not implemented yet');case"minContains":throw new Error('"minContains" is not implemented yet');case"maxContains":throw new Error('"maxContains" is not implemented yet');case"json-logic":return n||"The value is not valid"}}function ls(e){if(Array.isArray(e))return`The value must be a ${e.map(t=>t==="integer"?"number":t).join(" or ")}`;switch(e){case"number":case"integer":return"The value must be a number";case"boolean":return"The value must be a boolean";case"null":return"The value must be null";case"string":return"The value must be a string";case"object":return"The value must be an object";case"array":return"The value must be an array";default:return e?`The value must be ${e}`:"Invalid value"}}function Pe(e){return typeof e=="string"?e:JSON.stringify(e)}function fs(e,r){let t={};return r.forEach((o,i)=>{t[o]=i}),e.sort((o,i)=>{let a=t[o.name]??1/0,s=t[i.name]??1/0;return a!==s?a-s:e.indexOf(o)-e.indexOf(i)})}function Me(e,r){if(typeof e=="boolean")throw new Error("Schema must be an object");return e["x-jsf-order"]!==void 0?fs(r,e["x-jsf-order"]):r}function cs(e,r,t){r.checkboxValue=t.const,t.type==="boolean"&&(r.checkboxValue=!0)}function ps(e,r){if(e.options===void 0){let t=ms(r);t&&(e.options=t,r.type==="array"&&(e.multiple=!0))}}function ds(e,r,t,n){if(e.options===void 0){let o=bs(r,t,n);o&&(e.fields=o)}}function hs(e,r){if(!e)return"text";switch(e){case"string":{let{oneOf:t,format:n}=r;return n==="email"?"email":n==="date"?"date":n==="data-url"?"file":t?"radio":"text"}case"number":case"integer":return"number";case"object":return"fieldset";case"array":{let{items:t}=r;return t?.properties?"group-array":"select"}case"boolean":return"checkbox";default:return"text"}}function Fr(e,r,t,n){let o=t["x-jsf-presentation"];if(o?.inputType)return o.inputType;if(n&&r!=="root")throw new Error(`Strict error: Missing inputType to field "${t.title}".
2
- You can fix the json schema or skip this error by calling createHeadlessForm(schema, { strictInputType: false })`);if(!t.type){if(t.items?.properties)return"group-array";if(t.properties)return"select"}return hs(e||t.type||"string",t)}function me(e){return e.filter(r=>r!==null&&typeof r=="object"&&r.const!==null).map(r=>{let t=r.title,n=r.const,i=r["x-jsf-presentation"]?.meta,a={label:t||"",value:n};i&&(a.meta=i);let{title:s,const:l,"x-jsf-presentation":c,...f}=r;return{...a,...f}})}function ms(e){if(e.oneOf)return me(e.oneOf||[]);if(e.items?.anyOf)return me(e.items.anyOf);if(e.anyOf)return me(e.anyOf);if(e.enum){let r=e.enum?.map(t=>({title:typeof t=="string"?t:JSON.stringify(t),const:t}))||[];return me(r)}return null}function gs(e,r,t){let n=[];for(let i in e.properties){let a=e.required?.includes(i)||!1,s=w({schema:e.properties[i],name:i,required:a,originalSchema:r.properties?.[i]||e.properties[i],strictInputType:t});s&&n.push(s)}return Me(e,n)}function ys(e,r,t){let n=[];if(typeof e.items!="object"||e.items===null)return[];if(e.items?.type==="object"){let i=e.items;for(let a in i.properties){let s=i.required?.includes(a)||!1,l=w({schema:i.properties[a],name:a,required:s,originalSchema:r,strictInputType:t});l&&(l.nameKey=a,n.push(l))}}else{let i=w({schema:e.items,name:"item",required:!1,originalSchema:r,strictInputType:t});i&&n.push(i)}return Me(e.items,n)}function bs(e,r,t){return typeof e.properties=="object"&&e.properties!==null?gs(e,r,t):typeof e.items=="object"&&e.items!==null?ys(e,r,t):null}var xs=["title","type","x-jsf-errorMessage","x-jsf-presentation","oneOf","anyOf","properties"];function w({schema:e,name:r,required:t=!1,originalSchema:n,strictInputType:o=!1,type:i=void 0}){if(e===!1){let f=Fr(i,r,n,o),p=["fieldset","group-array"].includes(f);return{type:f,name:r,inputType:f,jsonType:"boolean",required:t,isVisible:!1,...p&&{fields:[]}}}if(typeof e=="boolean")return null;let a=e["x-jsf-presentation"]||{},s=e["x-jsf-errorMessage"],l=Fr(i,r,e,o),c={...Object.entries(e).filter(([f])=>!xs.includes(f)).reduce((f,[p,h])=>({...f,[p]:h}),{}),name:r,inputType:l,type:l,jsonType:i||e.type,required:t,isVisible:!0,...s&&{errorMessage:s}};return l==="checkbox"&&cs(l,c,e),e.title&&(c.label=e.title),Object.keys(a).length>0&&Object.entries(a).forEach(([f,p])=>{f!=="inputType"&&(c[f]=p)}),ps(c,e),ds(c,e,n),c}import ge from"json-logic-js";function be(e,r){let{validations:t,computedValues:n}=e;return{schema:{validations:t,computedValues:n},value:r}}function Nr(e){return/\{\{.*?\}\}/.test(e)}function ye(e={}){return Object.entries(e).reduce((r,[t,n])=>({...r,[t]:n??Number.NaN}),{})}function Pr(e,r,t=[]){let n=e["x-jsf-logic-validations"];return!n||n.length===0?[]:n.map(o=>{let i=r?.schema?.validations?.[o],a=r?.value;if(!i)throw new Error(`[json-schema-form] json-logic error: "${e.title}" required validation "${o}" doesn't exist.`);if(ge.apply(i.rule,ye(a))===!1){let l=i.errorMessage;return l&&Nr(l)&&(l=l.replace(/\{\{(.*?)\}\}/g,(c,f)=>{let p=f.trim(),h=r.schema.computedValues?.[p];return h?ge.apply(h.rule,ye(a)):ge.apply({var:p},ye(a))})),[{path:t,validation:"json-logic",customErrorMessage:l,schema:e,value:a}]}return[]}).flat()}function Ss(e,r,t){if(!r)throw new Error(`[json-schema-form] json-logic error: Computed value "${e}" doesn't exist`);return ge.apply(r,ye(t))}function Mr(e,r,t){if(r){let n={};Object.entries(r).forEach(([o,i])=>{let a=Ss(o,i.rule,t);n[o]=a}),Lr(e,n)}return e}function Lr(e,r){function t(n){let o=n["x-jsf-logic-computedAttrs"];o&&Os(n,r,o),n.type==="object"&&n.properties&&Lr(n,r),delete n["x-jsf-logic-computedAttrs"]}if(e.properties)for(let n in e.properties)t(e.properties[n]);else t(e)}function Os(e,r,t){function n(i){return Nr(i)?i.replace(/\{\{(.*?)\}\}/g,(a,s)=>{let l=s.trim();return r[l]||`{{${l}}}`}):r[i]}function o(i,a,s,l){let c=a;i[c]||(i[c]={}),Object.entries(s).forEach(([f,p])=>{typeof p=="string"?i[c][f]=n(p):o(i[c],f,p,l)})}for(let i in t){let a=i,s=t[i];typeof s=="string"?e[a]=n(s):o(e,a,s,r)}}function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function E(e,r){if(typeof e!=typeof r)return!1;if(e===r)return!0;if(e===null||r===null)return!1;if(Array.isArray(e)&&Array.isArray(r))return e.length!==r.length?!1:e.every((t,n)=>E(t,r[n]));if(v(e)&&v(r)){let t=Object.keys(e).sort(),n=Object.keys(r).sort();return t.length!==n.length||!E(t,n)?!1:t.every(o=>E(e[o],r[o]))}return!1}function Dr(e){if(typeof structuredClone=="function")try{return structuredClone(e)}catch(r){console.warn("structuredClone failed, falling back to JSON method:",r)}try{return JSON.parse(JSON.stringify(e))}catch{throw new Error("Deep clone failed: Object may contain circular references or non-serializable values")}}function Br(e,r,t,n,o){return Array.isArray(e)?[...vs(r,e,o),...Is(r,e,o),...qs(e,r,t,n,o),...Ts(r,e,t,n,o),...Es(r,e,t,n,o)]:[]}function vs(e,r,t){let n=[],o=r.length;return e.maxItems!==void 0&&o>e.maxItems&&n.push({path:t,validation:"maxItems",schema:e,value:r}),e.minItems!==void 0&&o<e.minItems&&n.push({path:t,validation:"minItems",schema:e,value:r}),n}function Es(e,r,t,n,o){if(e.items===void 0)return[];let i=[],a=Array.isArray(e.prefixItems)?e.prefixItems.length:0;for(let[s,l]of r.slice(a).entries())i.push(...x(l,e.items,t,[...o,"items",s+a],n));return i}function Ts(e,r,t,n,o){if(!Array.isArray(e.prefixItems))return[];let i=[];for(let[a,s]of r.entries())a<e.prefixItems.length&&i.push(...x(s,e.prefixItems[a],t,[...o,"prefixItems",a],n));return i}function qs(e,r,t,n,o){if(!("contains"in r))return[];let i=[],a=e.filter(s=>x(s,r.contains,t,[...o,"contains"],n).length===0).length;return r.minContains===void 0&&r.maxContains===void 0?a<1&&i.push({path:o,validation:"contains",schema:r,value:e}):(r.minContains!==void 0&&a<r.minContains&&i.push({path:o,validation:"minContains",schema:r,value:e}),r.maxContains!==void 0&&a>r.maxContains&&i.push({path:o,validation:"maxContains",schema:r,value:e})),i}function Is(e,r,t){if(e.uniqueItems!==!0)return[];let n=new Map;for(let o=0;o<r.length;o++){for(let i of n.values())if(E(r[o],i))return[{path:t,validation:"uniqueItems",schema:e,value:r[o]}];n.set(o,r[o])}return[]}function $r(e,r,t,n,o=[]){if(!r.allOf)return[];for(let i=0;i<r.allOf.length;i++){let a=r.allOf[i],s=x(e,a,t,[...o,"allOf",i],n);if(s.length>0)return s}return[]}function Ur(e,r,t,n,o=[]){if(!r.anyOf)return[];for(let i of r.anyOf)if(x(e,i,t,o,n).length===0)return[];return[{path:o,validation:"anyOf",schema:r,value:e}]}function Hr(e,r,t,n,o=[]){if(!r.oneOf)return[];let i=0;for(let a=0;a<r.oneOf.length&&!(x(e,r.oneOf[a],t,o,n).length===0&&(i++,i>1));a++);return i===0?[{path:o,validation:"oneOf",schema:r,value:e}]:i>1?[{path:o,validation:"oneOf",schema:r,value:e}]:[]}function zr(e,r,t,n,o=[]){return r.not===void 0?[]:typeof r.not=="boolean"?r.not?[{path:o,validation:"not",schema:r,value:e}]:[]:x(e,r.not,t,o,n).length===0?[{path:o,validation:"not",schema:r,value:e}]:[]}function Gr(e,r,t,n,o=[]){if(r.if===void 0)return[];let i=x(e,r.if,t,o,n).length===0;return i&&r.then!==void 0?x(e,r.then,t,[...o,"then"],n):!i&&r.else!==void 0?x(e,r.else,t,[...o,"else"],n):[]}function kr(e,r,t=[]){let n=typeof r.const<"u"?r.const:r.value;return n===void 0?[]:E(n,e)?[]:[{path:t,validation:"const",schema:r,value:e}]}function Wr(e,r,t=[]){return r.enum===void 0?[]:r.enum.some(n=>E(n,e))?[]:[{path:t,validation:"enum",schema:r,value:e}]}function Kr(e,r,t=[]){let n=r["x-jsf-presentation"],o=n?.inputType==="file",i=typeof n?.maxFileSize=="number"||typeof n?.accept=="string";if(!(o||i))return[];if(!Array.isArray(e))return[];if(e.length===0)return[];if(!e.every(c=>v(c)&&typeof c.name=="string"&&typeof c.size=="number"))return[{path:t,validation:"fileStructure",schema:r,value:e}];let l=e;if(typeof n?.maxFileSize=="number"){let c=n.maxFileSize*1024;if(l.some(p=>p.size>c))return[{path:t,validation:"maxFileSize",schema:r,value:e}]}if(typeof n?.accept=="string"&&n.accept.trim()!==""){let c=n.accept.toLowerCase().split(",").map(f=>f.trim()).filter(f=>f).map(f=>f.startsWith(".")?f:`.${f}`);if(c.length>0&&!l.some(p=>{let h=p.name.toLowerCase(),b=h.includes(".")?`.${h.split(".").pop()}`:"";return b!==""&&c.includes(b)}))return[{path:t,validation:"accept",schema:r,value:e}]}return[]}function Xr(e,r,t=[]){let n=[],o=Q(r);return typeof e!="number"?[]:o!==void 0&&!["number","integer"].includes(o)?[]:(r.multipleOf!==void 0&&e%r.multipleOf!==0&&n.push({path:t,validation:"multipleOf",schema:r,value:e}),r.maximum!==void 0&&e>r.maximum&&n.push({path:t,validation:"maximum",schema:r,value:e}),r.exclusiveMaximum!==void 0&&e>=r.exclusiveMaximum&&n.push({path:t,validation:"exclusiveMaximum",schema:r,value:e}),r.minimum!==void 0&&e<r.minimum&&n.push({path:t,validation:"minimum",schema:r,value:e}),r.exclusiveMinimum!==void 0&&e<=r.exclusiveMinimum&&n.push({path:t,validation:"exclusiveMinimum",schema:r,value:e}),n)}function Yr(e,r,t,n,o=[]){if(typeof r=="object"&&r.properties&&v(e)){let i=[];for(let[a,s]of Object.entries(r.properties))i.push(...x(e[a],s,t,[...o,a],n));return i}return[]}var Zr;(function(e){e["7bit"]="7bit",e["8bit"]="8bit",e.Base64="base64",e.Binary="binary",e.IETFToken="ietf-token",e.QuotedPrintable="quoted-printable",e.XToken="x-token"})(Zr||(Zr={}));var y;(function(e){e.Date="date",e.DateTime="date-time",e.Duration="duration",e.Email="email",e.Hostname="hostname",e.IDNEmail="idn-email",e.IDNHostname="idn-hostname",e.IPv4="ipv4",e.IPv6="ipv6",e.IRI="iri",e.IRIReference="iri-reference",e.JSONPointer="json-pointer",e.JSONPointerURIFragment="json-pointer-uri-fragment",e.RegEx="regex",e.RelativeJSONPointer="relative-json-pointer",e.Time="time",e.URI="uri",e.URIReference="uri-reference",e.URITemplate="uri-template",e.UUID="uuid"})(y||(y={}));var Qr;(function(e){e.Array="array",e.Boolean="boolean",e.Integer="integer",e.Null="null",e.Number="number",e.Object="object",e.String="string"})(Qr||(Qr={}));var S={DATE_TIME:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,DATE:/^\d{4}-\d{2}-\d{2}$/,TIME:/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/,DURATION:/^P(?!$)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/,EMAIL:/^[\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,IDN_EMAIL:/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/,HOSTNAME:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,IDN_HOSTNAME:/^[^\s._-].*[^\s._-]$/,IPV6_PART:/^[0-9a-f]{1,4}$/i,PROTOCOL:/^[a-z]+:/,URI_REFERENCE:/^\S*$/,UUID:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,JSON_POINTER:/^(?:\/(?:[^~/]|~0|~1)*)*$/,JSON_POINTER_URI_FRAGMENT:/^#(?:\/(?:[\w\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,RELATIVE_JSON_POINTER:/^(?:0|[1-9]\d*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,URI_TEMPLATE:/^(?:[!#$&'()*+,/:;=?@\w\-.~]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?(?:,(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?)*\})*$/i},As={[y.DateTime]:e=>S.DATE_TIME.test(e),[y.Date]:e=>S.DATE.test(e),[y.Time]:e=>S.TIME.test(e),[y.Duration]:e=>S.DURATION.test(e),[y.Email]:e=>e.length<=254&&S.EMAIL.test(e),[y.IDNEmail]:e=>e.length<=254&&S.IDN_EMAIL.test(e),[y.Hostname]:e=>e.length>255?!1:e.split(".").every(t=>S.HOSTNAME.test(t)),[y.IDNHostname]:e=>e.length>255?!1:e.split(".").every(t=>t.length<=63&&S.IDN_HOSTNAME.test(t)),[y.IPv4]:e=>{let r=e.split(".");return r.length!==4?!1:r.every(t=>{let n=Number.parseInt(t,10);return n>=0&&n<=255&&t===n.toString()})},[y.IPv6]:e=>{let r=e.split(":");if(r.length>8)return!1;let t=!1;return r.every(n=>n===""?t?!1:(t=!0,!0):S.IPV6_PART.test(n))},[y.URI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[y.URIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[y.IRI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[y.IRIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[y.RegEx]:e=>{try{return new RegExp(e,"u"),!0}catch{return!1}},[y.UUID]:e=>S.UUID.test(e),[y.JSONPointer]:e=>S.JSON_POINTER.test(e),[y.JSONPointerURIFragment]:e=>S.JSON_POINTER_URI_FRAGMENT.test(e),[y.RelativeJSONPointer]:e=>S.RELATIVE_JSON_POINTER.test(e),[y.URITemplate]:e=>S.URI_TEMPLATE.test(e)};function et(e,r,t=[]){let n=[];if(typeof e!="string")return n;let o=As[r.format];return o&&!o(e)&&n.push({path:t,validation:"format",schema:r,value:e}),n}function rt(e,r,t=[]){let n=[],o=Q(r);if(typeof e!="string")return[];if(o!==void 0&&o!=="string")return[];let i=[...new Intl.Segmenter().segment(e)].length;if(r.minLength!==void 0&&i<r.minLength&&n.push({path:t,validation:"minLength",schema:r,value:e}),r.maxLength!==void 0&&i>r.maxLength&&n.push({path:t,validation:"maxLength",schema:r,value:e}),r.pattern!==void 0&&(new RegExp(r.pattern).test(e)||n.push({path:t,validation:"pattern",schema:r,value:e})),r.format!==void 0){let a=et(e,r,t);n.push(...a)}return n}function Q(e){if(typeof e=="boolean")return"boolean";if(e.type!==void 0)return e.type}function Vs(e,r,t=[]){let n=Q(r);if(n===void 0)return[];if(n==="null"&&e===null)return[];let o=e===null?"null":Array.isArray(e)?"array":typeof e;if(Array.isArray(n)){if(e===null&&n.includes("null"))return[];for(let i of n){if(i==="array"&&Array.isArray(e))return[];if(o==="number"&&i==="integer"&&Number.isInteger(e))return[];if(o===i||i==="null"&&e===null)return[]}}else{if(n==="array"&&Array.isArray(e))return[];if(o==="number"&&n==="integer"&&Number.isInteger(e))return[];if(o===n)return[]}return[{path:t,validation:"type",schema:r,value:e}]}function _s(e,r,t={},n=[],o){return r?x(e,r,t,n,o):[]}function x(e,r,t={},n=[],o){let i=o,a;if(!o&&r["x-jsf-logic"]){i=be(r["x-jsf-logic"],e);let{validations:h,computedValues:b,...g}=r["x-jsf-logic"];a=g}let s=e===void 0||e===null&&t.treatNullAsUndefined,l=[];if(s)return[];if(typeof r=="boolean")return!r&&!t.allowForbiddenValues?[{path:n,validation:"forbidden",schema:r,value:e}]:[];let f=r["x-jsf-presentation"]?.inputType==="file",p=[];if(!f&&(p=Vs(e,r,n),p.length>0))return p;if(r.required&&v(e)){let h=r.required.filter(b=>{let g=e[b];return Array.isArray(g)?g.length===0:v(g)?Object.keys(g).length===0:g===void 0||g===null&&t.treatNullAsUndefined});for(let b of h)l.push({path:[...n,b],validation:"required",schema:r?.properties?.[b]||r,value:e})}return[...l,...kr(e,r,n),...Wr(e,r,n),...Yr(e,r,t,i,n),...Br(e,r,t,i,n),...rt(e,r,n),...Xr(e,r,n),...Kr(e,r,n),...zr(e,r,t,i,n),...$r(e,r,t,i,n),...Ur(e,r,t,i,n),...Hr(e,r,t,i,n),...Gr(e,r,t,i,n),...wr(e,r,t,n),..._s(e,a,t,n,i),...Pr(r,i,n)]}function Le({schema:e,values:r,options:t={}}){let n=e["x-jsf-logic"]?be(e["x-jsf-logic"],r):void 0,o=Dr(e);return xe(o,r,t,n),n?.schema.computedValues&&Mr(o,n.schema.computedValues,r),o}function tt(e,r,t,n={}){let o=x(e,t.if,n).length===0,i=!1;return o&&t.if?.required&&(i=t.if.required.some(s=>{if(!r.properties||!r.properties[s])return!1;let l=r.properties[s],c=e[s];return x(c,l,n).some(p=>p.validation==="type")})),{rule:t,matches:o&&!i}}function xe(e,r={},t={},n){if(!v(r))return;let o=[];e.if&&o.push(tt(r,e,e,t)),(e.allOf??[]).filter(i=>typeof i.if<"u").forEach(i=>{let a=tt(r,e,i,t);o.push(a)});for(let{rule:i,matches:a}of o)a&&i.then?(nt(e,r,i.then,t,n),delete i.then):!a&&i.else&&(nt(e,r,i.else,t,n),delete i.else);if(e.properties){for(let[i,a]of Object.entries(e.properties))if(typeof a=="object"){let s=a;s.type==="object"&&xe(s,r[i],t,n),s.items&&xe(s.items,r[i],t,n)}}}function nt(e,r,t,n={},o){let i=t;xe(i,r,n,o),Z(e,i)}function De(e,r,t){let n=w({schema:r,name:"root",required:!0,originalSchema:t,strictInputType:!1})?.fields||[];for(let o of e){let i=n.find(a=>a.name===o.name);if(i){it(o,i),Z(o,i);let a=r.properties?.[o.name];a&&typeof a=="object"&&o.fields&&a.type==="object"&&De(o.fields,a,t)}}}function it(e,r){for(let[t]of Object.entries(e))r[t]?e[t]&&typeof e[t]=="object"&&!Array.isArray(e[t])&&r[t]&&typeof r[t]=="object"&&!Array.isArray(r[t])&&it(e[t],r[t]):delete e[t]}function ws(e){let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(["allOf","anyOf","oneOf"].includes(n)){t+1<e.length&&typeof e[t+1]=="number"&&t++;continue}n==="then"||n==="else"||(n==="items"&&typeof e[t+1]=="number"?(t++,r.push(e[t])):r.push(n))}return r}function Cs(e){if(e.length===0)return null;let r={};for(let t of e){let{path:n}=t;if(n.length===0){r[""]=t.message;continue}let o=ws(n),i=r;for(let a=0;a<o.length-1;a++){let s=o[a];if(typeof s=="number"){if(!Array.isArray(i))throw new TypeError(`Expected an array at path: ${o.slice(0,a).join(".")}`);i[s]||(i[s]={}),i=i[s]}else typeof o[a+1]=="number"?s in i||(i[s]=[]):(!(s in i)||typeof i[s]=="string")&&(i[s]={}),i=i[s]}if(o.length>0){let a=o[o.length-1];i[a]=t.message}}return r}function Rs(e){return e.map(r=>{let{schema:t,value:n,validation:o,customErrorMessage:i}=r;return{...r,message:Jr(t,n,o,i)}})}function js(e,r){return typeof r!="object"||!r||!e.length?e:e.map(t=>{let n=t.schema,o=n["x-jsf-errorMessage"]?.[t.validation];return n&&o?{...t,message:o}:t})}function Js(e,r,t={}){let n={},o=x(e,r,t),i=Rs(o),a=js(i,r),s=Cs(a);return s&&(n.formErrors=s),n}function Fs(e){let{schema:r,originalSchema:t,strictInputType:n}=e;return w({schema:r,name:"root",required:!0,originalSchema:t,strictInputType:n})?.fields||[]}function Ns(e,r={}){let t=r.initialValues||{},n=r.strictInputType||!1,o=Le({schema:e,values:t,options:r.validationOptions}),i=Fs({schema:o,originalSchema:e,strictInputType:n});return{fields:i,isError:!1,error:null,handleValidation:l=>{let c=Le({schema:e,values:l,options:r.validationOptions}),f=Js(l,c,r.validationOptions);return De(i,c,e),f}}}var Ua=A(qi(),1),I=A(Ki(),1),G=A(to(),1),Ha=A(Fa(),1),pr=A(Pa(),1),Re=A($a(),1);function za(e){return e.replace(".",".properties.")}function Ga(e,r){return Array.isArray(r)?r:void 0}function lm(e,r){let{if:t,then:n,else:o}=e;return(0,G.default)(t?.required||[],r).length>0||((0,G.default)(n?.required||[],r)||(0,G.default)(Object.keys(n?.properties||{}),r)).length>0||((0,G.default)(o?.required||[],r)||(0,G.default)(Object.keys(o?.properties||{}),r)).length>0}function ka(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([o,i])=>{let a=za(o);if(!(0,I.default)(e.properties,a)){t.push({type:"FIELD_TO_CHANGE_NOT_FOUND",message:`Changing field "${o}" was ignored because it does not exist.`});return}let s=(0,I.default)(e.properties,a);if(!s)return{warnings:null};let l=typeof i=="function"?i(s):i,{properties:c,...f}=l;if((0,pr.default)((0,I.default)(e.properties,a),{...s,...f},Ga),l.properties){let p=ka((0,I.default)(e.properties,a),l.properties);p.warnings&&t.push(...p.warnings)}}),{warnings:t.flat()}}function Wa(e,r,t){if(!r||typeof e!="object"||e===null)return{warnings:null};let n=t?.parent;return typeof e=="object"&&e.properties&&Object.entries(e.properties).forEach(([o,i])=>{let a=n?`${n}.${o}`:o;(0,pr.default)((0,I.default)(e.properties,o),{...i,...r(a,i)},Ga),i.properties&&Wa(i,r,{parent:o})}),{warnings:null}}function fm(e,r){if(!r)return{warnings:null};let t=[],n=e["x-jsf-order"]||[],o=typeof r=="function"?r(n):r,i=(0,Ua.default)(n,o);return i.length>0&&t.push({type:"ORDER_MISSING_FIELDS",message:`Some fields got forgotten in the new order. They were automatically appended: ${i.join(", ")}`}),e["x-jsf-order"]=[...o,...i],{warnings:t}}function Ka(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([o,i])=>{let a=za(o);if(!i)return{warnings:null};if(i.properties){let c=(0,I.default)(e.properties,a);if(!c)return{warnings:null};let f=Ka(c,i.properties);f.warnings&&t.push(...f.warnings)}if((0,I.default)(e.properties,a)){t.push({type:"FIELD_TO_CREATE_EXISTS",message:`Creating field "${o}" was ignored because it already exists.`});return}let l=(0,Re.default)({},a,i);(0,Ha.default)(e.properties,l)}),{warnings:t.flat()}}function cm(e,r){if(!r)return{schema:e,warnings:null};let t={properties:{}};Object.entries(e).forEach(([i,a])=>{switch(i){case"properties":r.forEach(s=>{(0,Re.default)(t.properties,s,a[s])});break;case"x-jsf-order":case"required":t[i]=a.filter(s=>r.includes(s));break;case"allOf":{let s=e[i]?.filter(l=>lm(l,r));t[i]=s;break}case"x-jsf-logic":t[i]=a;break}});let n={};t.allOf?.length&&t.allOf.forEach(i=>{let{if:a,then:s,else:l}=i,c=e.allOf?.indexOf(i);n={...n,...cr(a,{fields:r,path:`allOf[${c}].if`}),...cr(s,{fields:r,path:`allOf[${c}].then`}),...cr(l,{fields:r,path:`allOf[${c}].else`})}});let o=[];return Object.keys(n).length>0&&(Object.entries(n).forEach(([i])=>{(0,Re.default)(t.properties,i,e.properties?.[i])}),o.push({type:"PICK_MISSED_FIELD",message:`The picked fields are in conditionals that refeer other fields. They added automatically: ${Object.keys(n).map(i=>`"${i}"`).join(", ")}. Check "meta" for more details.`,meta:n})),{schema:t,warnings:o}}function cr(e,{fields:r,path:t}){if(!e)return null;let n={};return e.required?.forEach(o=>{r.includes(o)||(n[o]={path:t})}),Object.entries(e.properties||[]).forEach(([o])=>{r.includes(o)||(n[o]={path:t})}),n}function pm(e,r){let t=JSON.parse(JSON.stringify(e)),n=ka(t,r.fields),o=Wa(t,r.allFields),i=Ka(t,r.create),a=cm(t,r.pick),s=a.schema,l=fm(s,r.orderRoot);r.muteLogging||console.warn("json-schema-form modify(): We highly recommend you to handle/report the returned `warnings` as they highlight possible bugs in your modifications. To mute this log, pass `muteLogging: true` to the config.");let c=[n.warnings,o.warnings,i.warnings,a.warnings,l.warnings].flat().filter(Boolean);return{schema:s,warnings:c}}export{Ns as createHeadlessForm,pm as modify};
2
+ You can fix the json schema or skip this error by calling createHeadlessForm(schema, { strictInputType: false })`);if(!t.type){if(t.items?.properties)return"group-array";if(t.properties)return"select"}return hs(e||t.type||"string",t)}function me(e){return e.filter(r=>r!==null&&typeof r=="object"&&r.const!==null).map(r=>{let t=r.title,n=r.const,i=r["x-jsf-presentation"]?.meta,a={label:t||"",value:n};i&&(a.meta=i);let{title:s,const:l,"x-jsf-presentation":c,...f}=r;return{...a,...f}})}function ms(e){if(e.oneOf)return me(e.oneOf||[]);if(e.items?.anyOf)return me(e.items.anyOf);if(e.anyOf)return me(e.anyOf);if(e.enum){let r=e.enum?.map(t=>({title:typeof t=="string"?t:JSON.stringify(t),const:t}))||[];return me(r)}return null}function gs(e,r,t){let n=[];for(let i in e.properties){let a=e.required?.includes(i)||!1,s=w({schema:e.properties[i],name:i,required:a,originalSchema:r.properties?.[i]||e.properties[i],strictInputType:t});s&&n.push(s)}return Me(e,n)}function ys(e,r,t){let n=[];if(typeof e.items!="object"||e.items===null)return[];if(e.items?.type==="object"){let i=e.items;for(let a in i.properties){let s=i.required?.includes(a)||!1,l=w({schema:i.properties[a],name:a,required:s,originalSchema:r,strictInputType:t});l&&(l.nameKey=a,n.push(l))}}else{let i=w({schema:e.items,name:"item",required:!1,originalSchema:r,strictInputType:t});i&&n.push(i)}return Me(e.items,n)}function bs(e,r,t){return typeof e.properties=="object"&&e.properties!==null?gs(e,r,t):typeof e.items=="object"&&e.items!==null?ys(e,r,t):null}var xs=["title","type","x-jsf-errorMessage","x-jsf-presentation","oneOf","anyOf","properties"];function w({schema:e,name:r,required:t=!1,originalSchema:n,strictInputType:o=!1,type:i=void 0}){if(e===!1){let f=Fr(i,r,n,o),p=["fieldset","group-array"].includes(f);return{type:f,name:r,inputType:f,jsonType:"boolean",required:t,isVisible:!1,...p&&{fields:[]}}}if(typeof e=="boolean")return null;let a=e["x-jsf-presentation"]||{},s=e["x-jsf-errorMessage"],l=Fr(i,r,e,o),c={...Object.entries(e).filter(([f])=>!xs.includes(f)).reduce((f,[p,h])=>({...f,[p]:h}),{}),name:r,inputType:l,type:l,jsonType:i||e.type,required:t,isVisible:!0,...s&&{errorMessage:s}};return l==="checkbox"&&cs(l,c,e),e.title&&(c.label=e.title),Object.keys(a).length>0&&Object.entries(a).forEach(([f,p])=>{f!=="inputType"&&(c[f]=p)}),ps(c,e),ds(c,e,n),c}import ge from"json-logic-js";function be(e,r){let{validations:t,computedValues:n}=e;return{schema:{validations:t,computedValues:n},value:r}}function Nr(e){return/\{\{.*?\}\}/.test(e)}function ye(e={}){return Object.entries(e).reduce((r,[t,n])=>({...r,[t]:n??Number.NaN}),{})}function Pr(e,r,t=[]){let n=e["x-jsf-logic-validations"];return!n||n.length===0?[]:n.map(o=>{let i=r?.schema?.validations?.[o],a=r?.value;if(!i)throw new Error(`[json-schema-form] json-logic error: "${e.title}" required validation "${o}" doesn't exist.`);if(ge.apply(i.rule,ye(a))===!1){let l=i.errorMessage;return l&&Nr(l)&&(l=l.replace(/\{\{(.*?)\}\}/g,(c,f)=>{let p=f.trim(),h=r.schema.computedValues?.[p];return h?ge.apply(h.rule,ye(a)):ge.apply({var:p},ye(a))})),[{path:t,validation:"json-logic",customErrorMessage:l,schema:e,value:a}]}return[]}).flat()}function Ss(e,r,t){if(!r)throw new Error(`[json-schema-form] json-logic error: Computed value "${e}" doesn't exist`);return ge.apply(r,ye(t))}function Mr(e,r,t){if(r){let n={};Object.entries(r).forEach(([o,i])=>{let a=Ss(o,i.rule,t);n[o]=a}),Lr(e,n)}return e}function Lr(e,r){function t(n){let o=n["x-jsf-logic-computedAttrs"];o&&Os(n,r,o),n.type==="object"&&n.properties&&Lr(n,r),delete n["x-jsf-logic-computedAttrs"]}if(e.properties)for(let n in e.properties)t(e.properties[n]);else t(e)}function Os(e,r,t){function n(i){return Nr(i)?i.replace(/\{\{(.*?)\}\}/g,(a,s)=>{let l=s.trim();return r[l]||`{{${l}}}`}):r[i]}function o(i,a,s,l){let c=a;i[c]||(i[c]={}),Object.entries(s).forEach(([f,p])=>{typeof p=="string"?i[c][f]=n(p):o(i[c],f,p,l)})}for(let i in t){let a=i,s=t[i];typeof s=="string"?e[a]=n(s):o(e,a,s,r)}}function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function E(e,r){if(typeof e!=typeof r)return!1;if(e===r)return!0;if(e===null||r===null)return!1;if(Array.isArray(e)&&Array.isArray(r))return e.length!==r.length?!1:e.every((t,n)=>E(t,r[n]));if(v(e)&&v(r)){let t=Object.keys(e).sort(),n=Object.keys(r).sort();return t.length!==n.length||!E(t,n)?!1:t.every(o=>E(e[o],r[o]))}return!1}function Dr(e){if(typeof structuredClone=="function")try{return structuredClone(e)}catch(r){console.warn("structuredClone failed, falling back to JSON method:",r)}try{return JSON.parse(JSON.stringify(e))}catch{throw new Error("Deep clone failed: Object may contain circular references or non-serializable values")}}function Br(e,r,t,n,o){return Array.isArray(e)?[...vs(r,e,o),...Is(r,e,o),...qs(e,r,t,n,o),...Ts(r,e,t,n,o),...Es(r,e,t,n,o)]:[]}function vs(e,r,t){let n=[],o=r.length;return e.maxItems!==void 0&&o>e.maxItems&&n.push({path:t,validation:"maxItems",schema:e,value:r}),e.minItems!==void 0&&o<e.minItems&&n.push({path:t,validation:"minItems",schema:e,value:r}),n}function Es(e,r,t,n,o){if(e.items===void 0)return[];let i=[],a=Array.isArray(e.prefixItems)?e.prefixItems.length:0;for(let[s,l]of r.slice(a).entries())i.push(...x(l,e.items,t,[...o,"items",s+a],n));return i}function Ts(e,r,t,n,o){if(!Array.isArray(e.prefixItems))return[];let i=[];for(let[a,s]of r.entries())a<e.prefixItems.length&&i.push(...x(s,e.prefixItems[a],t,[...o,"prefixItems",a],n));return i}function qs(e,r,t,n,o){if(!("contains"in r))return[];let i=[],a=e.filter(s=>x(s,r.contains,t,[...o,"contains"],n).length===0).length;return r.minContains===void 0&&r.maxContains===void 0?a<1&&i.push({path:o,validation:"contains",schema:r,value:e}):(r.minContains!==void 0&&a<r.minContains&&i.push({path:o,validation:"minContains",schema:r,value:e}),r.maxContains!==void 0&&a>r.maxContains&&i.push({path:o,validation:"maxContains",schema:r,value:e})),i}function Is(e,r,t){if(e.uniqueItems!==!0)return[];let n=new Map;for(let o=0;o<r.length;o++){for(let i of n.values())if(E(r[o],i))return[{path:t,validation:"uniqueItems",schema:e,value:r[o]}];n.set(o,r[o])}return[]}function $r(e,r,t,n,o=[]){if(!r.allOf)return[];for(let i=0;i<r.allOf.length;i++){let a=r.allOf[i],s=x(e,a,t,[...o,"allOf",i],n);if(s.length>0)return s}return[]}function Ur(e,r,t,n,o=[]){if(!r.anyOf)return[];for(let i of r.anyOf)if(x(e,i,t,o,n).length===0)return[];return[{path:o,validation:"anyOf",schema:r,value:e}]}function Hr(e,r,t,n,o=[]){if(!r.oneOf)return[];if(r.oneOf.length===0)return[];let i=0;for(let a=0;a<r.oneOf.length&&!(x(e,r.oneOf[a],t,o,n).length===0&&(i++,i>1));a++);return i===0?[{path:o,validation:"oneOf",schema:r,value:e}]:i>1?[{path:o,validation:"oneOf",schema:r,value:e}]:[]}function zr(e,r,t,n,o=[]){return r.not===void 0?[]:typeof r.not=="boolean"?r.not?[{path:o,validation:"not",schema:r,value:e}]:[]:x(e,r.not,t,o,n).length===0?[{path:o,validation:"not",schema:r,value:e}]:[]}function Gr(e,r,t,n,o=[]){if(r.if===void 0)return[];let i=x(e,r.if,t,o,n).length===0;return i&&r.then!==void 0?x(e,r.then,t,[...o,"then"],n):!i&&r.else!==void 0?x(e,r.else,t,[...o,"else"],n):[]}function kr(e,r,t=[]){let n=typeof r.const<"u"?r.const:r.value;return n===void 0?[]:E(n,e)?[]:[{path:t,validation:"const",schema:r,value:e}]}function Wr(e,r,t=[]){return r.enum===void 0?[]:r.enum.some(n=>E(n,e))?[]:[{path:t,validation:"enum",schema:r,value:e}]}function Kr(e,r,t=[]){let n=r["x-jsf-presentation"],o=n?.inputType==="file",i=typeof n?.maxFileSize=="number"||typeof n?.accept=="string";if(!(o||i))return[];if(!Array.isArray(e))return[];if(e.length===0)return[];if(!e.every(c=>v(c)&&typeof c.name=="string"&&typeof c.size=="number"))return[{path:t,validation:"fileStructure",schema:r,value:e}];let l=e;if(typeof n?.maxFileSize=="number"){let c=n.maxFileSize*1024;if(l.some(p=>p.size>c))return[{path:t,validation:"maxFileSize",schema:r,value:e}]}if(typeof n?.accept=="string"&&n.accept.trim()!==""){let c=n.accept.toLowerCase().split(",").map(f=>f.trim()).filter(f=>f).map(f=>f.startsWith(".")?f:`.${f}`);if(c.length>0&&!l.some(p=>{let h=p.name.toLowerCase(),b=h.includes(".")?`.${h.split(".").pop()}`:"";return b!==""&&c.includes(b)}))return[{path:t,validation:"accept",schema:r,value:e}]}return[]}function Xr(e,r,t=[]){let n=[],o=Q(r);return typeof e!="number"?[]:o!==void 0&&!["number","integer"].includes(o)?[]:(r.multipleOf!==void 0&&e%r.multipleOf!==0&&n.push({path:t,validation:"multipleOf",schema:r,value:e}),r.maximum!==void 0&&e>r.maximum&&n.push({path:t,validation:"maximum",schema:r,value:e}),r.exclusiveMaximum!==void 0&&e>=r.exclusiveMaximum&&n.push({path:t,validation:"exclusiveMaximum",schema:r,value:e}),r.minimum!==void 0&&e<r.minimum&&n.push({path:t,validation:"minimum",schema:r,value:e}),r.exclusiveMinimum!==void 0&&e<=r.exclusiveMinimum&&n.push({path:t,validation:"exclusiveMinimum",schema:r,value:e}),n)}function Yr(e,r,t,n,o=[]){if(typeof r=="object"&&r.properties&&v(e)){let i=[];for(let[a,s]of Object.entries(r.properties))i.push(...x(e[a],s,t,[...o,a],n));return i}return[]}var Zr;(function(e){e["7bit"]="7bit",e["8bit"]="8bit",e.Base64="base64",e.Binary="binary",e.IETFToken="ietf-token",e.QuotedPrintable="quoted-printable",e.XToken="x-token"})(Zr||(Zr={}));var y;(function(e){e.Date="date",e.DateTime="date-time",e.Duration="duration",e.Email="email",e.Hostname="hostname",e.IDNEmail="idn-email",e.IDNHostname="idn-hostname",e.IPv4="ipv4",e.IPv6="ipv6",e.IRI="iri",e.IRIReference="iri-reference",e.JSONPointer="json-pointer",e.JSONPointerURIFragment="json-pointer-uri-fragment",e.RegEx="regex",e.RelativeJSONPointer="relative-json-pointer",e.Time="time",e.URI="uri",e.URIReference="uri-reference",e.URITemplate="uri-template",e.UUID="uuid"})(y||(y={}));var Qr;(function(e){e.Array="array",e.Boolean="boolean",e.Integer="integer",e.Null="null",e.Number="number",e.Object="object",e.String="string"})(Qr||(Qr={}));var S={DATE_TIME:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,DATE:/^\d{4}-\d{2}-\d{2}$/,TIME:/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/,DURATION:/^P(?!$)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/,EMAIL:/^[\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,IDN_EMAIL:/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/,HOSTNAME:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,IDN_HOSTNAME:/^[^\s._-].*[^\s._-]$/,IPV6_PART:/^[0-9a-f]{1,4}$/i,PROTOCOL:/^[a-z]+:/,URI_REFERENCE:/^\S*$/,UUID:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,JSON_POINTER:/^(?:\/(?:[^~/]|~0|~1)*)*$/,JSON_POINTER_URI_FRAGMENT:/^#(?:\/(?:[\w\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,RELATIVE_JSON_POINTER:/^(?:0|[1-9]\d*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,URI_TEMPLATE:/^(?:[!#$&'()*+,/:;=?@\w\-.~]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?(?:,(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?)*\})*$/i},As={[y.DateTime]:e=>S.DATE_TIME.test(e),[y.Date]:e=>S.DATE.test(e),[y.Time]:e=>S.TIME.test(e),[y.Duration]:e=>S.DURATION.test(e),[y.Email]:e=>e.length<=254&&S.EMAIL.test(e),[y.IDNEmail]:e=>e.length<=254&&S.IDN_EMAIL.test(e),[y.Hostname]:e=>e.length>255?!1:e.split(".").every(t=>S.HOSTNAME.test(t)),[y.IDNHostname]:e=>e.length>255?!1:e.split(".").every(t=>t.length<=63&&S.IDN_HOSTNAME.test(t)),[y.IPv4]:e=>{let r=e.split(".");return r.length!==4?!1:r.every(t=>{let n=Number.parseInt(t,10);return n>=0&&n<=255&&t===n.toString()})},[y.IPv6]:e=>{let r=e.split(":");if(r.length>8)return!1;let t=!1;return r.every(n=>n===""?t?!1:(t=!0,!0):S.IPV6_PART.test(n))},[y.URI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[y.URIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[y.IRI]:e=>{try{let r=new URL(e);return r.protocol!==""&&S.PROTOCOL.test(r.protocol)}catch{return!1}},[y.IRIReference]:e=>{try{return e.startsWith("//")?S.URI_REFERENCE.test(e.slice(2)):(new URL(e,"http://example.com"),!0)}catch{return!1}},[y.RegEx]:e=>{try{return new RegExp(e,"u"),!0}catch{return!1}},[y.UUID]:e=>S.UUID.test(e),[y.JSONPointer]:e=>S.JSON_POINTER.test(e),[y.JSONPointerURIFragment]:e=>S.JSON_POINTER_URI_FRAGMENT.test(e),[y.RelativeJSONPointer]:e=>S.RELATIVE_JSON_POINTER.test(e),[y.URITemplate]:e=>S.URI_TEMPLATE.test(e)};function et(e,r,t=[]){let n=[];if(typeof e!="string")return n;let o=As[r.format];return o&&!o(e)&&n.push({path:t,validation:"format",schema:r,value:e}),n}function rt(e,r,t=[]){let n=[],o=Q(r);if(typeof e!="string")return[];if(o!==void 0&&o!=="string")return[];let i=[...new Intl.Segmenter().segment(e)].length;if(r.minLength!==void 0&&i<r.minLength&&n.push({path:t,validation:"minLength",schema:r,value:e}),r.maxLength!==void 0&&i>r.maxLength&&n.push({path:t,validation:"maxLength",schema:r,value:e}),r.pattern!==void 0&&(new RegExp(r.pattern).test(e)||n.push({path:t,validation:"pattern",schema:r,value:e})),r.format!==void 0){let a=et(e,r,t);n.push(...a)}return n}function Q(e){if(typeof e=="boolean")return"boolean";if(e.type!==void 0)return e.type}function Vs(e,r,t=[]){let n=Q(r);if(n===void 0)return[];if(n==="null"&&e===null)return[];let o=e===null?"null":Array.isArray(e)?"array":typeof e;if(Array.isArray(n)){if(e===null&&n.includes("null"))return[];for(let i of n){if(i==="array"&&Array.isArray(e))return[];if(o==="number"&&i==="integer"&&Number.isInteger(e))return[];if(o===i||i==="null"&&e===null)return[]}}else{if(n==="array"&&Array.isArray(e))return[];if(o==="number"&&n==="integer"&&Number.isInteger(e))return[];if(o===n)return[]}return[{path:t,validation:"type",schema:r,value:e}]}function _s(e,r,t={},n=[],o){return r?x(e,r,t,n,o):[]}function x(e,r,t={},n=[],o){let i=o,a;if(!o&&r["x-jsf-logic"]){i=be(r["x-jsf-logic"],e);let{validations:h,computedValues:b,...g}=r["x-jsf-logic"];a=g}let s=e===void 0||e===null&&t.treatNullAsUndefined,l=[];if(s)return[];if(typeof r=="boolean")return!r&&!t.allowForbiddenValues?[{path:n,validation:"forbidden",schema:r,value:e}]:[];let f=r["x-jsf-presentation"]?.inputType==="file",p=[];if(!f&&(p=Vs(e,r,n),p.length>0))return p;if(r.required&&v(e)){let h=r.required.filter(b=>{let g=e[b];return Array.isArray(g)?g.length===0:v(g)?Object.keys(g).length===0:g===void 0||g===null&&t.treatNullAsUndefined});for(let b of h)l.push({path:[...n,b],validation:"required",schema:r?.properties?.[b]||r,value:e})}return[...l,...kr(e,r,n),...Wr(e,r,n),...Yr(e,r,t,i,n),...Br(e,r,t,i,n),...rt(e,r,n),...Xr(e,r,n),...Kr(e,r,n),...zr(e,r,t,i,n),...$r(e,r,t,i,n),...Ur(e,r,t,i,n),...Hr(e,r,t,i,n),...Gr(e,r,t,i,n),...wr(e,r,t,n),..._s(e,a,t,n,i),...Pr(r,i,n)]}function Le({schema:e,values:r,options:t={}}){let n=e["x-jsf-logic"]?be(e["x-jsf-logic"],r):void 0,o=Dr(e);return xe(o,r,t,n),n?.schema.computedValues&&Mr(o,n.schema.computedValues,r),o}function tt(e,r,t,n={}){let o=x(e,t.if,n).length===0,i=!1;return o&&t.if?.required&&(i=t.if.required.some(s=>{if(!r.properties||!r.properties[s])return!1;let l=r.properties[s],c=e[s];return x(c,l,n).some(p=>p.validation==="type")})),{rule:t,matches:o&&!i}}function xe(e,r={},t={},n){if(!v(r))return;let o=[];e.if&&o.push(tt(r,e,e,t)),(e.allOf??[]).filter(i=>typeof i.if<"u").forEach(i=>{let a=tt(r,e,i,t);o.push(a)});for(let{rule:i,matches:a}of o)a&&i.then?(nt(e,r,i.then,t,n),delete i.then):!a&&i.else&&(nt(e,r,i.else,t,n),delete i.else);if(e.properties){for(let[i,a]of Object.entries(e.properties))if(typeof a=="object"){let s=a;s.type==="object"&&xe(s,r[i],t,n),s.items&&xe(s.items,r[i],t,n)}}}function nt(e,r,t,n={},o){let i=t;xe(i,r,n,o),Z(e,i)}function De(e,r,t){let n=w({schema:r,name:"root",required:!0,originalSchema:t,strictInputType:!1})?.fields||[];for(let o of e){let i=n.find(a=>a.name===o.name);if(i){it(o,i),Z(o,i);let a=r.properties?.[o.name];a&&typeof a=="object"&&o.fields&&a.type==="object"&&De(o.fields,a,t)}}}function it(e,r){for(let[t]of Object.entries(e))r[t]?e[t]&&typeof e[t]=="object"&&!Array.isArray(e[t])&&r[t]&&typeof r[t]=="object"&&!Array.isArray(r[t])&&it(e[t],r[t]):delete e[t]}function ws(e){let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(["allOf","anyOf","oneOf"].includes(n)){t+1<e.length&&typeof e[t+1]=="number"&&t++;continue}n==="then"||n==="else"||(n==="items"&&typeof e[t+1]=="number"?(t++,r.push(e[t])):r.push(n))}return r}function Cs(e){if(e.length===0)return null;let r={};for(let t of e){let{path:n}=t;if(n.length===0){r[""]=t.message;continue}let o=ws(n),i=r;for(let a=0;a<o.length-1;a++){let s=o[a];if(typeof s=="number"){if(!Array.isArray(i))throw new TypeError(`Expected an array at path: ${o.slice(0,a).join(".")}`);i[s]||(i[s]={}),i=i[s]}else typeof o[a+1]=="number"?s in i||(i[s]=[]):(!(s in i)||typeof i[s]=="string")&&(i[s]={}),i=i[s]}if(o.length>0){let a=o[o.length-1];i[a]=t.message}}return r}function Rs(e){return e.map(r=>{let{schema:t,value:n,validation:o,customErrorMessage:i}=r;return{...r,message:Jr(t,n,o,i)}})}function js(e,r){return typeof r!="object"||!r||!e.length?e:e.map(t=>{let n=t.schema,o=n["x-jsf-errorMessage"]?.[t.validation];return n&&o?{...t,message:o}:t})}function Js(e,r,t={}){let n={},o=x(e,r,t),i=Rs(o),a=js(i,r),s=Cs(a);return s&&(n.formErrors=s),n}function Fs(e){let{schema:r,originalSchema:t,strictInputType:n}=e;return w({schema:r,name:"root",required:!0,originalSchema:t,strictInputType:n})?.fields||[]}function Ns(e,r={}){let t=r.initialValues||{},n=r.strictInputType||!1,o=Le({schema:e,values:t,options:r.validationOptions}),i=Fs({schema:o,originalSchema:e,strictInputType:n});return{fields:i,isError:!1,error:null,handleValidation:l=>{let c=Le({schema:e,values:l,options:r.validationOptions}),f=Js(l,c,r.validationOptions);return De(i,c,e),f}}}var Ua=A(qi(),1),I=A(Ki(),1),G=A(to(),1),Ha=A(Fa(),1),pr=A(Pa(),1),Re=A($a(),1);function za(e){return e.replace(".",".properties.")}function Ga(e,r){return Array.isArray(r)?r:void 0}function lm(e,r){let{if:t,then:n,else:o}=e;return(0,G.default)(t?.required||[],r).length>0||((0,G.default)(n?.required||[],r)||(0,G.default)(Object.keys(n?.properties||{}),r)).length>0||((0,G.default)(o?.required||[],r)||(0,G.default)(Object.keys(o?.properties||{}),r)).length>0}function ka(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([o,i])=>{let a=za(o);if(!(0,I.default)(e.properties,a)){t.push({type:"FIELD_TO_CHANGE_NOT_FOUND",message:`Changing field "${o}" was ignored because it does not exist.`});return}let s=(0,I.default)(e.properties,a);if(!s)return{warnings:null};let l=typeof i=="function"?i(s):i,{properties:c,...f}=l;if((0,pr.default)((0,I.default)(e.properties,a),{...s,...f},Ga),l.properties){let p=ka((0,I.default)(e.properties,a),l.properties);p.warnings&&t.push(...p.warnings)}}),{warnings:t.flat()}}function Wa(e,r,t){if(!r||typeof e!="object"||e===null)return{warnings:null};let n=t?.parent;return typeof e=="object"&&e.properties&&Object.entries(e.properties).forEach(([o,i])=>{let a=n?`${n}.${o}`:o;(0,pr.default)((0,I.default)(e.properties,o),{...i,...r(a,i)},Ga),i.properties&&Wa(i,r,{parent:o})}),{warnings:null}}function fm(e,r){if(!r)return{warnings:null};let t=[],n=e["x-jsf-order"]||[],o=typeof r=="function"?r(n):r,i=(0,Ua.default)(n,o);return i.length>0&&t.push({type:"ORDER_MISSING_FIELDS",message:`Some fields got forgotten in the new order. They were automatically appended: ${i.join(", ")}`}),e["x-jsf-order"]=[...o,...i],{warnings:t}}function Ka(e,r){if(!r)return{warnings:null};let t=[];return Object.entries(r).forEach(([o,i])=>{let a=za(o);if(!i)return{warnings:null};if(i.properties){let c=(0,I.default)(e.properties,a);if(!c)return{warnings:null};let f=Ka(c,i.properties);f.warnings&&t.push(...f.warnings)}if((0,I.default)(e.properties,a)){t.push({type:"FIELD_TO_CREATE_EXISTS",message:`Creating field "${o}" was ignored because it already exists.`});return}let l=(0,Re.default)({},a,i);(0,Ha.default)(e.properties,l)}),{warnings:t.flat()}}function cm(e,r){if(!r)return{schema:e,warnings:null};let t={properties:{}};Object.entries(e).forEach(([i,a])=>{switch(i){case"properties":r.forEach(s=>{(0,Re.default)(t.properties,s,a[s])});break;case"x-jsf-order":case"required":t[i]=a.filter(s=>r.includes(s));break;case"allOf":{let s=e[i]?.filter(l=>lm(l,r));t[i]=s;break}case"x-jsf-logic":t[i]=a;break}});let n={};t.allOf?.length&&t.allOf.forEach(i=>{let{if:a,then:s,else:l}=i,c=e.allOf?.indexOf(i);n={...n,...cr(a,{fields:r,path:`allOf[${c}].if`}),...cr(s,{fields:r,path:`allOf[${c}].then`}),...cr(l,{fields:r,path:`allOf[${c}].else`})}});let o=[];return Object.keys(n).length>0&&(Object.entries(n).forEach(([i])=>{(0,Re.default)(t.properties,i,e.properties?.[i])}),o.push({type:"PICK_MISSED_FIELD",message:`The picked fields are in conditionals that refeer other fields. They added automatically: ${Object.keys(n).map(i=>`"${i}"`).join(", ")}. Check "meta" for more details.`,meta:n})),{schema:t,warnings:o}}function cr(e,{fields:r,path:t}){if(!e)return null;let n={};return e.required?.forEach(o=>{r.includes(o)||(n[o]={path:t})}),Object.entries(e.properties||[]).forEach(([o])=>{r.includes(o)||(n[o]={path:t})}),n}function pm(e,r){let t=JSON.parse(JSON.stringify(e)),n=ka(t,r.fields),o=Wa(t,r.allFields),i=Ka(t,r.create),a=cm(t,r.pick),s=a.schema,l=fm(s,r.orderRoot);r.muteLogging||console.warn("json-schema-form modify(): We highly recommend you to handle/report the returned `warnings` as they highlight possible bugs in your modifications. To mute this log, pass `muteLogging: true` to the config.");let c=[n.warnings,o.warnings,i.warnings,a.warnings,l.warnings].flat().filter(Boolean);return{schema:s,warnings:c}}export{Ns as createHeadlessForm,pm as modify};
3
3
  //# sourceMappingURL=index.mjs.map