@lifesg/web-frontend-engine 2.2.1 → 2.2.2
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/README.md +1 -1
- package/chunks/{file-upload-manager.27debdaa.js → file-upload-manager.581859a5.js} +2 -2
- package/chunks/{file-upload-manager.27debdaa.js.map → file-upload-manager.581859a5.js.map} +1 -1
- package/chunks/{index.b5f8bb97.js → index.8cc1cf41.js} +8 -8
- package/chunks/{index.b5f8bb97.js.map → index.8cc1cf41.js.map} +1 -1
- package/chunks/{index.93ef32cd.js → index.bba30c64.js} +2 -2
- package/chunks/{index.93ef32cd.js.map → index.bba30c64.js.map} +1 -1
- package/chunks/{index.2f7eb734.js → index.d31714ac.js} +2 -2
- package/chunks/{index.2f7eb734.js.map → index.d31714ac.js.map} +1 -1
- package/chunks/{location-modal.4a00fa7b.js → location-modal.60f7c5c4.js} +2 -2
- package/chunks/{location-modal.4a00fa7b.js.map → location-modal.60f7c5c4.js.map} +1 -1
- package/cjs/chunks/{file-upload-manager.75e07efb.js → file-upload-manager.75d19b87.js} +2 -2
- package/cjs/chunks/{file-upload-manager.75e07efb.js.map → file-upload-manager.75d19b87.js.map} +1 -1
- package/cjs/chunks/{index.bb0ba7ce.js → index.00d4458f.js} +8 -8
- package/cjs/chunks/{index.bb0ba7ce.js.map → index.00d4458f.js.map} +1 -1
- package/cjs/chunks/{index.fafcc083.js → index.260bcc27.js} +2 -2
- package/cjs/chunks/{index.fafcc083.js.map → index.260bcc27.js.map} +1 -1
- package/cjs/chunks/{index.d2321141.js → index.b1899917.js} +2 -2
- package/cjs/chunks/{index.d2321141.js.map → index.b1899917.js.map} +1 -1
- package/cjs/chunks/{location-modal.5d849c88.js → location-modal.ff55a907.js} +2 -2
- package/cjs/chunks/{location-modal.5d849c88.js.map → location-modal.ff55a907.js.map} +1 -1
- package/cjs/index.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
|
@@ -276,7 +276,7 @@ cp((function(e){Object.getOwnPropertyNames(fh.prototype).forEach((function(t){"c
|
|
|
276
276
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
277
277
|
* Released under the MIT License.
|
|
278
278
|
*/
|
|
279
|
-
function HO(e){return"[object Object]"===Object.prototype.toString.call(e)}Object.defineProperty(GO,"__esModule",{value:!0}),GO.isPlainObject=function(e){var t,n;return!1!==HO(e)&&(void 0===(t=e.constructor)||!1!==HO(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))};var YO=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===WO}(e)}(e)};var WO="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function qO(e,t){return!1!==t.clone&&t.isMergeableObject(e)?eN((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function KO(e,t,n){return e.concat(t).map((function(e){return qO(e,n)}))}function JO(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function XO(e,t){try{return t in e}catch(e){return!1}}function QO(e,t,n){var r={};return n.isMergeableObject(e)&&JO(e).forEach((function(t){r[t]=qO(e[t],n)})),JO(t).forEach((function(i){(function(e,t){return XO(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(XO(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return eN;var n=t.customMerge(e);return"function"==typeof n?n:eN}(i,n)(e[i],t[i],n):r[i]=qO(t[i],n))})),r}function eN(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||KO,n.isMergeableObject=n.isMergeableObject||YO,n.cloneUnlessOtherwiseSpecified=qO;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):QO(e,t,n):qO(t,n)}eN.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return eN(e,n,t)}),{})};var tN,nN=eN,rN={exports:{}};tN=rN,function(e,t){tN.exports?tN.exports=t():e.parseSrcset=t()}(Gt,(function(){return function(e){function t(e){return" "===e||"\t"===e||"\n"===e||"\f"===e||"\r"===e}function n(t){var n,r=t.exec(e.substring(m));if(r)return n=r[0],m+=n.length,n}for(var r,i,a,o,s,u=e.length,c=/^[ \t\n\r\u000c]+/,l=/^[, \t\n\r\u000c]+/,d=/^[^ \t\n\r\u000c]+/,f=/[,]+$/,p=/^\d+$/,h=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,m=0,g=[];;){if(n(l),m>=u)return g;r=n(d),i=[],","===r.slice(-1)?(r=r.replace(f,""),_()):y()}function y(){for(n(c),a="",o="in descriptor";;){if(s=e.charAt(m),"in descriptor"===o)if(t(s))a&&(i.push(a),a="",o="after descriptor");else{if(","===s)return m+=1,a&&i.push(a),void _();if("("===s)a+=s,o="in parens";else{if(""===s)return a&&i.push(a),void _();a+=s}}else if("in parens"===o)if(")"===s)a+=s,o="in descriptor";else{if(""===s)return i.push(a),void _();a+=s}else if("after descriptor"===o)if(t(s));else{if(""===s)return void _();o="in descriptor",m-=1}m+=1}}function _(){var t,n,a,o,s,u,c,l,d,f=!1,m={};for(o=0;o<i.length;o++)u=(s=i[o])[s.length-1],c=s.substring(0,s.length-1),l=parseInt(c,10),d=parseFloat(c),p.test(c)&&"w"===u?((t||n)&&(f=!0),0===l?f=!0:t=l):h.test(c)&&"x"===u?((t||n||a)&&(f=!0),d<0?f=!0:n=d):p.test(c)&&"h"===u?((a||n)&&(f=!0),0===l?f=!0:a=l):f=!0;f?console&&console.log&&console.log("Invalid srcset descriptor found in '"+e+"' at '"+s+"'."):(m.url=r,t&&(m.w=t),n&&(m.d=n),a&&(m.h=a),g.push(m))}}}));var iN={exports:{}},aN=String,oN=function(){return{isColorSupported:!1,reset:aN,bold:aN,dim:aN,italic:aN,underline:aN,inverse:aN,hidden:aN,strikethrough:aN,black:aN,red:aN,green:aN,yellow:aN,blue:aN,magenta:aN,cyan:aN,white:aN,gray:aN,bgBlack:aN,bgRed:aN,bgGreen:aN,bgYellow:aN,bgBlue:aN,bgMagenta:aN,bgCyan:aN,bgWhite:aN,blackBright:aN,redBright:aN,greenBright:aN,yellowBright:aN,blueBright:aN,magentaBright:aN,cyanBright:aN,whiteBright:aN,bgBlackBright:aN,bgRedBright:aN,bgGreenBright:aN,bgYellowBright:aN,bgBlueBright:aN,bgMagentaBright:aN,bgCyanBright:aN,bgWhiteBright:aN}};iN.exports=oN(),iN.exports.createColors=oN;var sN=Ht(Object.freeze({__proto__:null,default:{}}));let uN=iN.exports,cN=sN;class lN extends Error{constructor(e,t,n,r,i,a){super(e),this.name="CssSyntaxError",this.reason=e,i&&(this.file=i),r&&(this.source=r),a&&(this.plugin=a),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,lN)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=uN.isColorSupported);let n=e=>e,r=e=>e,i=e=>e;if(e){let{bold:e,gray:t,red:a}=uN.createColors(!0);r=t=>e(a(t)),n=e=>t(e),cN&&(i=e=>cN(e))}let a=t.split(/\r?\n/),o=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(o,s).map(((e,t)=>{let a=o+1+t,s=" "+(" "+a).slice(-u)+" | ";if(a===this.line){if(e.length>160){let t=20,a=Math.max(0,this.column-t),o=Math.max(this.column+t,this.endColumn+t),u=e.slice(a,o),c=n(s.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return r(">")+n(s)+i(u)+"\n "+c+r("^")}let t=n(s.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return r(">")+n(s)+i(e)+"\n "+t+r("^")}return" "+n(s)+i(e)})).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}var dN=lN;lN.default=lN;const fN={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class pN{constructor(e){this.builder=e}atrule(e,t){let n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],a=this.raw(i,"before");a&&this.builder(a),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,n){let r;if(n||(n=t),t&&(r=e.raws[t],void 0!==r))return r;let i=e.parent;if("before"===n){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return fN[n];let a=e.root();if(a.rawCache||(a.rawCache={}),void 0!==a.rawCache[n])return a.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let i="raw"+((o=n)[0].toUpperCase()+o.slice(1));this[i]?r=this[i](a,e):a.walk((e=>{if(r=e.raws[t],void 0!==r)return!1}))}var o;return void 0===r&&(r=fN[n]),a.rawCache[n]=r,r}rawBeforeClose(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let n;return e.walkComments((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(e){let t;return e.walk((e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1})),t}rawBeforeRule(e){let t;return e.walk((n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls((e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1})),t}rawEmptyBody(e){let t;return e.walk((e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1})),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk((n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}})),t}rawSemicolon(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1})),t}rawValue(e,t){let n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}var hN=pN;pN.default=pN;let mN=hN;function gN(e,t){new mN(t).stringify(e)}var yN=gN;gN.default=gN;var _N={};_N.isClean=Symbol("isClean"),_N.my=Symbol("my");let vN=dN,bN=hN,EN=yN,{isClean:AN,my:SN}=_N;function wN(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],a=typeof i;"parent"===r&&"object"===a?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map((e=>wN(e,n))):("object"===a&&null!==i&&(i=wN(i)),n[r]=i)}return n}function xN(e,t){if(t&&void 0!==t.offset)return t.offset;let n=1,r=1,i=0;for(let a=0;a<e.length;a++){if(r===t.line&&n===t.column){i=a;break}"\n"===e[a]?(n=1,r+=1):n+=1}return i}class TN{get proxyOf(){return this}constructor(e={}){this.raws={},this[AN]=!1,this[SN]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=wN(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new vN(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markClean(){this[AN]=!0}markDirty(){if(this[AN]){this[AN]=!1;let e=this;for(;e=e.parent;)e[AN]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r=n.slice(xN(n,this.source.start),xN(n,this.source.end)).indexOf(e.word);-1!==r&&(t=this.positionInside(r))}return t}positionInside(e){let t=this.source.start.column,n=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,i=xN(r,this.source.start),a=i+e;for(let e=i;e<a;e++)"\n"===r[e]?(t=1,n+=1):t+=1;return{column:t,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,i=r.slice(xN(r,this.source.start),xN(r,this.source.end)).indexOf(e.word);-1!==i&&(t=this.positionInside(i),n=this.positionInside(i+e.word.length))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new bN).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let r=this[e];if(Array.isArray(r))n[e]=r.map((e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e));else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){let a=t.get(r.input);null==a&&(a=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:a,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map((e=>e.toJSON()))),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=EN){e.stringify&&(e=e.stringify);let t="";return e(this,(e=>{t+=e})),t}warn(e,t,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}}var MN=TN;TN.default=TN;let ON=MN;class NN extends ON{constructor(e){super(e),this.type="comment"}}var CN=NN;NN.default=NN;let DN=MN;class LN extends DN{get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}}var IN=LN;LN.default=LN;let kN,$N,RN,zN,PN=CN,FN=IN,ZN=MN,{isClean:UN,my:BN}=_N;function jN(e){return e.map((e=>(e.nodes&&(e.nodes=jN(e.nodes)),delete e.source,e)))}function VN(e){if(e[UN]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)VN(t)}class GN extends ZN{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...n)=>e[t](...n.map((e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e))):"every"===t||"some"===t?n=>e[t](((e,...t)=>n(e.toProxy(),...t))):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map((e=>e.toProxy())):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",a=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of a)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+a.length);return this.markDirty(),this}normalize(e,t){if("string"==typeof e)e=jN($N(e).nodes);else if(void 0===e)e=[];else if(Array.isArray(e)){e=e.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if("root"===e.type&&"document"!==this.type){e=e.nodes.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error("Value field is missed in node creation");"string"!=typeof e.value&&(e.value=String(e.value)),e=[new FN(e)]}else if(e.selector||e.selectors)e=[new zN(e)];else if(e.name)e=[new kN(e)];else{if(!e.text)throw new Error("Unknown node type in node creation");e=[new PN(e)]}return e.map((e=>(e[BN]||GN.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[UN]&&VN(e),e.raws||(e.raws={}),void 0===e.raws.before&&t&&void 0!==t.raws.before&&(e.raws.before=t.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e)))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls((r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))})),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each(((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r}))}walkAtRules(e,t){return t?e instanceof RegExp?this.walk(((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)})):this.walk(((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)})):(t=e,this.walk(((e,n)=>{if("atrule"===e.type)return t(e,n)})))}walkComments(e){return this.walk(((t,n)=>{if("comment"===t.type)return e(t,n)}))}walkDecls(e,t){return t?e instanceof RegExp?this.walk(((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)})):this.walk(((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)})):(t=e,this.walk(((e,n)=>{if("decl"===e.type)return t(e,n)})))}walkRules(e,t){return t?e instanceof RegExp?this.walk(((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)})):this.walk(((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)})):(t=e,this.walk(((e,n)=>{if("rule"===e.type)return t(e,n)})))}}GN.registerParse=e=>{$N=e},GN.registerRule=e=>{zN=e},GN.registerAtRule=e=>{kN=e},GN.registerRoot=e=>{RN=e};var HN=GN;GN.default=GN,GN.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,kN.prototype):"rule"===e.type?Object.setPrototypeOf(e,zN.prototype):"decl"===e.type?Object.setPrototypeOf(e,FN.prototype):"comment"===e.type?Object.setPrototypeOf(e,PN.prototype):"root"===e.type&&Object.setPrototypeOf(e,RN.prototype),e[BN]=!0,e.nodes&&e.nodes.forEach((e=>{GN.rebuild(e)}))};let YN=HN;class WN extends YN{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}var qN=WN;WN.default=WN,YN.registerAtRule(WN);let KN,JN,XN=HN;class QN extends XN{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new KN(new JN,this,e).stringify()}}QN.registerLazyResult=e=>{KN=e},QN.registerProcessor=e=>{JN=e};var eC=QN;QN.default=QN;var tC={nanoid:(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r}};let{existsSync:nC,readFileSync:rC}=sN,{dirname:iC,join:aC}=sN,{SourceMapConsumer:oC,SourceMapGenerator:sC}=sN;class uC{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=iC(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new oC(this.text)),this.consumerCache}decodeInline(e){let t=e.match(/^data:application\/json;charset=utf-?8,/)||e.match(/^data:application\/json,/);if(t)return decodeURIComponent(e.substr(t[0].length));let n=e.match(/^data:application\/json;charset=utf-?8;base64,/)||e.match(/^data:application\/json;base64,/);if(n)return r=e.substr(n[0].length),Buffer?Buffer.from(r,"base64").toString():window.atob(r);var r;let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/g);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=iC(e),nC(e))return this.mapFile=e,rC(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof oC)return sC.fromSourceMap(t).toString();if(t instanceof sC)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=aC(iC(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}var cC=uC;uC.default=uC;let{nanoid:lC}=tC,{isAbsolute:dC,resolve:fC}=sN,{SourceMapConsumer:pC,SourceMapGenerator:hC}=sN,{fileURLToPath:mC,pathToFileURL:gC}=sN,yC=dN,_C=cC,vC=sN,bC=Symbol("fromOffsetCache"),EC=Boolean(pC&&hC),AC=Boolean(fC&&dC);class SC{get from(){return this.file||this.id}constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,t.document&&(this.document=t.document.toString()),t.from&&(!AC||/^\w+:\/\//.test(t.from)||dC(t.from)?this.file=t.from:this.file=fC(t.from)),AC&&EC){let e=new _C(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+lC(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,a,o;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);a=e.line,i=e.col}else a=r.line,i=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let s=this.origin(t,n,a,i);return o=s?new yC(e,void 0===s.endLine?s.line:{column:s.column,line:s.line},void 0===s.endLine?s.column:{column:s.endColumn,line:s.endLine},s.source,s.file,r.plugin):new yC(e,void 0===a?t:{column:n,line:t},void 0===a?n:{column:i,line:a},this.css,this.file,r.plugin),o.input={column:n,endColumn:i,endLine:a,line:t,source:this.css},this.file&&(gC&&(o.input.url=gC(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[bC])n=this[bC];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[bC]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:fC(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let i,a,o=this.map.consumer(),s=o.originalPositionFor({column:t,line:e});if(!s.source)return!1;"number"==typeof n&&(i=o.originalPositionFor({column:r,line:n})),a=dC(s.source)?gC(s.source):new URL(s.source,this.map.consumer().sourceRoot||gC(this.map.mapFile));let u={column:s.column,endColumn:i&&i.column,endLine:i&&i.line,line:s.line,url:a.toString()};if("file:"===a.protocol){if(!mC)throw new Error("file: protocol is not available in this PostCSS build");u.file=mC(a)}let c=o.sourceContentFor(s.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}}var wC=SC;SC.default=SC,vC&&vC.registerInput&&vC.registerInput(SC);let xC,TC,MC=HN;class OC extends MC{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new xC(new TC,this,e).stringify()}}OC.registerLazyResult=e=>{xC=e},OC.registerProcessor=e=>{TC=e};var NC=OC;OC.default=OC,MC.registerRoot(OC);let CC={comma:e=>CC.split(e,[","],!0),space:e=>CC.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],i="",a=!1,o=0,s=!1,u="",c=!1;for(let n of e)c?c=!1:"\\"===n?c=!0:s?n===u&&(s=!1):'"'===n||"'"===n?(s=!0,u=n):"("===n?o+=1:")"===n?o>0&&(o-=1):0===o&&t.includes(n)&&(a=!0),a?(""!==i&&r.push(i.trim()),i="",a=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};var DC=CC;CC.default=CC;let LC=HN,IC=DC;class kC extends LC{get selectors(){return IC.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}}var $C=kC;kC.default=kC,LC.registerRule(kC);let RC=qN,zC=CN,PC=IN,FC=wC,ZC=cC,UC=NC,BC=$C;function jC(e,t){if(Array.isArray(e))return e.map((e=>jC(e)));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:FC.prototype};n.map&&(n.map={...n.map,__proto__:ZC.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map((e=>jC(e,t)))),r.source){let{inputId:e,...n}=r.source;r.source=n,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new UC(r);if("decl"===r.type)return new PC(r);if("rule"===r.type)return new BC(r);if("comment"===r.type)return new zC(r);if("atrule"===r.type)return new RC(r);throw new Error("Unknown node type: "+e.type)}var VC=jC;jC.default=jC;let{dirname:GC,relative:HC,resolve:YC,sep:WC}=sN,{SourceMapConsumer:qC,SourceMapGenerator:KC}=sN,{pathToFileURL:JC}=sN,XC=wC,QC=Boolean(qC&&KC),eD=Boolean(GC&&YC&&HC&&WC);var tD=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,n=this.toUrl(this.path(e.file)),r=e.root||GC(e.file);!1===this.mapOpts.sourcesContent?(t=new qC(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&e.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),eD&&QC&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,(t=>{e+=t})),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=KC.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new KC({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new KC({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",a={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,((o,s,u)=>{if(this.css+=o,s&&"end"!==u&&(a.generated.line=n,a.generated.column=r-1,s.source&&s.source.start?(a.source=this.sourcePath(s),a.original.line=s.source.start.line,a.original.column=s.source.start.column-1,this.map.addMapping(a)):(a.source=i,a.original.line=1,a.original.column=0,this.map.addMapping(a))),t=o.match(/\n/g),t?(n+=t.length,e=o.lastIndexOf("\n"),r=o.length-e):r+=o.length,s&&"start"!==u){let e=s.parent||{raws:{}};("decl"===s.type||"atrule"===s.type&&!s.nodes)&&s===e.last&&!e.raws.semicolon||(s.source&&s.source.end?(a.source=this.sourcePath(s),a.original.line=s.source.end.line,a.original.column=s.source.end.column-1,a.generated.line=n,a.generated.column=r-2,this.map.addMapping(a)):(a.source=i,a.original.line=1,a.original.column=0,a.generated.line=n,a.generated.column=r-1,this.map.addMapping(a)))}}))}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some((e=>e.annotation)))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some((e=>e.inline)))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some((e=>e.withContent()))}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?GC(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=GC(YC(n,this.mapOpts.annotation)));let r=HC(n,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk((e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}}));else{let e=new XC(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk((t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,t.source.input.css)}}}));else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(JC){let t=JC(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===WC&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}};const nD="'".charCodeAt(0),rD='"'.charCodeAt(0),iD="\\".charCodeAt(0),aD="/".charCodeAt(0),oD="\n".charCodeAt(0),sD=" ".charCodeAt(0),uD="\f".charCodeAt(0),cD="\t".charCodeAt(0),lD="\r".charCodeAt(0),dD="[".charCodeAt(0),fD="]".charCodeAt(0),pD="(".charCodeAt(0),hD=")".charCodeAt(0),mD="{".charCodeAt(0),gD="}".charCodeAt(0),yD=";".charCodeAt(0),_D="*".charCodeAt(0),vD=":".charCodeAt(0),bD="@".charCodeAt(0),ED=/[\t\n\f\r "#'()/;[\\\]{}]/g,AD=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,SD=/.[\r\n"'(/\\]/,wD=/[\da-f]/i;let xD=qN,TD=CN,MD=IN,OD=NC,ND=$C,CD=function(e,t={}){let n,r,i,a,o,s,u,c,l,d,f=e.css.valueOf(),p=t.ignoreErrors,h=f.length,m=0,g=[],y=[];function _(t){throw e.error("Unclosed "+t,m)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&m>=h},nextToken:function(e){if(y.length)return y.pop();if(m>=h)return;let t=!!e&&e.ignoreUnclosed;switch(n=f.charCodeAt(m),n){case oD:case sD:case cD:case lD:case uD:a=m;do{a+=1,n=f.charCodeAt(a)}while(n===sD||n===oD||n===cD||n===lD||n===uD);s=["space",f.slice(m,a)],m=a-1;break;case dD:case fD:case mD:case gD:case vD:case yD:case hD:{let e=String.fromCharCode(n);s=[e,e,m];break}case pD:if(d=g.length?g.pop()[1]:"",l=f.charCodeAt(m+1),"url"===d&&l!==nD&&l!==rD&&l!==sD&&l!==oD&&l!==cD&&l!==uD&&l!==lD){a=m;do{if(u=!1,a=f.indexOf(")",a+1),-1===a){if(p||t){a=m;break}_("bracket")}for(c=a;f.charCodeAt(c-1)===iD;)c-=1,u=!u}while(u);s=["brackets",f.slice(m,a+1),m,a],m=a}else a=f.indexOf(")",m+1),r=f.slice(m,a+1),-1===a||SD.test(r)?s=["(","(",m]:(s=["brackets",r,m,a],m=a);break;case nD:case rD:o=n===nD?"'":'"',a=m;do{if(u=!1,a=f.indexOf(o,a+1),-1===a){if(p||t){a=m+1;break}_("string")}for(c=a;f.charCodeAt(c-1)===iD;)c-=1,u=!u}while(u);s=["string",f.slice(m,a+1),m,a],m=a;break;case bD:ED.lastIndex=m+1,ED.test(f),a=0===ED.lastIndex?f.length-1:ED.lastIndex-2,s=["at-word",f.slice(m,a+1),m,a],m=a;break;case iD:for(a=m,i=!0;f.charCodeAt(a+1)===iD;)a+=1,i=!i;if(n=f.charCodeAt(a+1),i&&n!==aD&&n!==sD&&n!==oD&&n!==cD&&n!==lD&&n!==uD&&(a+=1,wD.test(f.charAt(a)))){for(;wD.test(f.charAt(a+1));)a+=1;f.charCodeAt(a+1)===sD&&(a+=1)}s=["word",f.slice(m,a+1),m,a],m=a;break;default:n===aD&&f.charCodeAt(m+1)===_D?(a=f.indexOf("*/",m+2)+1,0===a&&(p||t?a=f.length:_("comment")),s=["comment",f.slice(m,a+1),m,a],m=a):(AD.lastIndex=m+1,AD.test(f),a=0===AD.lastIndex?f.length-1:AD.lastIndex-2,s=["word",f.slice(m,a+1),m,a],g.push(s),m=a)}return m++,s},position:function(){return m}}};const DD={empty:!0,space:!0};var LD=class{constructor(e){this.input=e,this.root=new OD,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,n,r,i=new xD;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let a=!1,o=!1,s=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){o=!0;break}if("}"===t){if(s.length>0){for(r=s.length-1,n=s[r];n&&"space"===n[0];)n=s[--r];n&&(i.source.end=this.getPosition(n[3]||n[2]),i.source.end.offset++)}this.end(e);break}s.push(e)}else s.push(e);if(this.tokenizer.endOfFile()){a=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(i.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(i,"params",s),a&&(e=s[s.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),o&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[a,o]of e.entries()){if(n=o,r=n[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(t){if("word"===t[0]&&"progid"===t[1])continue;return a}this.doubleColon(n)}t=n}return!1}comment(e){let t=new TD;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=CD(this.input)}decl(e,t){let n=new MD;this.init(n,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(i[3]||i[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),n.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;n.prop+=e.shift()[1]}for(n.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){n.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),n.raws.between+=r[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let a,o=[];for(;e.length&&(a=e[0][0],"space"===a||"comment"===a);)o.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){n.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r," !important"!==r&&(n.raws.important=r);break}if("important"===r[1].toLowerCase()){let r=e.slice(0),i="";for(let e=t;e>0;e--){let t=r[e][0];if(i.trim().startsWith("!")&&"space"!==t)break;i=r.pop()[1]+i}i.trim().startsWith("!")&&(n.important=!0,n.raws.important=i,e=r)}if("space"!==r[0]&&"comment"!==r[0])break}e.some((e=>"space"!==e[0]&&"comment"!==e[0]))&&(n.raws.between+=o.map((e=>e[1])).join(""),o=[]),this.raw(n,"value",o.concat(e),t),n.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new ND;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,n=null,r=!1,i=null,a=[],o=e[1].startsWith("--"),s=[],u=e;for(;u;){if(n=u[0],s.push(u),"("===n||"["===n)i||(i=u),a.push("("===n?")":"]");else if(o&&r&&"{"===n)i||(i=u),a.push("}");else if(0===a.length){if(";"===n){if(r)return void this.decl(s,o);break}if("{"===n)return void this.rule(s);if("}"===n){this.tokenizer.back(s.pop()),t=!0;break}":"===n&&(r=!0)}else n===a[a.length-1]&&(a.pop(),0===a.length&&(i=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),a.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;s.length&&(u=s[s.length-1][0],"space"===u||"comment"===u);)this.tokenizer.back(s.pop());this.decl(s,o)}else this.unknownWord(s)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,r){let i,a,o,s,u=n.length,c="",l=!0;for(let e=0;e<u;e+=1)i=n[e],a=i[0],"space"!==a||e!==u-1||r?"comment"===a?(s=n[e-1]?n[e-1][0]:"empty",o=n[e+1]?n[e+1][0]:"empty",DD[s]||DD[o]||","===c.slice(-1)?l=!1:c+=i[1]):c+=i[1]:l=!1;if(!l){let r=n.reduce(((e,t)=>e+t[1]),"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new ND;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word "+e[0][1],{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let ID=HN,kD=wC,$D=LD;function RD(e,t){let n=new kD(e,t),r=new $D(n);try{r.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&t&&t.from&&(/\.scss$/i.test(t.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(t.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(t.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return r.root}var zD=RD;RD.default=RD,ID.registerParse(RD);class PD{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}var FD=PD;PD.default=PD;let ZD=FD;class UD{get content(){return this.css}constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new ZD(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter((e=>"warning"===e.type))}}var BD=UD;UD.default=UD;let jD={};var VD=function(e){jD[e]||(jD[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let GD=HN,HD=eC,YD=tD,WD=zD,qD=BD,KD=NC,JD=yN,{isClean:XD,my:QD}=_N,eL=VD;const tL={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},nL={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},rL={Once:!0,postcssPlugin:!0,prepare:!0};function iL(e){return"object"==typeof e&&"function"==typeof e.then}function aL(e){let t=!1,n=tL[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function oL(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:aL(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function sL(e){return e[XD]=!1,e.nodes&&e.nodes.forEach((e=>sL(e))),e}let uL={};class cL{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(e,t,n){let r;if(this.stringified=!1,this.processed=!1,"object"!=typeof t||null===t||"root"!==t.type&&"document"!==t.type)if(t instanceof cL||t instanceof qD)r=sL(t.root),t.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=t.map);else{let e=WD;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{r=e(t,n)}catch(e){this.processed=!0,this.error=e}r&&!r[QD]&&GD.rebuild(r)}else r=sL(t);this.result=new qD(e,r,n),this.helpers={...uL,postcss:uL,result:this.result},this.plugins=this.processor.plugins.map((e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e))}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),a=r.split(".");(i[0]!==a[0]||parseInt(i[1])>parseInt(a[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!nL[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!rL[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],n=this.runOnRoot(t);if(iL(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[XD];){e[XD]=!0;let t=[oL(e)];for(;t.length>0;){let e=this.visitTick(t);if(iL(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map((e=>n(e,this.helpers)));await Promise.all(t)}else await n(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map((t=>e.Once(t,this.helpers)));return iL(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=JD;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new YD(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(iL(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[XD];)e[XD]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||eL("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(iL(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[XD])return r[XD]=!0,void e.push(oL(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[XD]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[XD]=!0;let t=aL(e);for(let n of t)if(0===n)e.nodes&&e.each((e=>{e[XD]||this.walkSync(e)}));else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}}cL.registerPostcss=e=>{uL=e};var lL=cL;cL.default=cL,KD.registerLazyResult(cL),HD.registerLazyResult(cL);let dL=tD,fL=zD;const pL=BD;let hL=yN,mL=VD;class gL{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=fL;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(e,t,n){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let i=hL;this.result=new pL(this._processor,r,this._opts),this.result.css=t;let a=this;Object.defineProperty(this.result,"root",{get:()=>a.root});let o=new dL(i,r,this._opts,t);if(o.isMap()){let[e,t]=o.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||mL("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}}var yL=gL;gL.default=gL;let _L=eC,vL=lL,bL=yL,EL=NC;class AL{constructor(e=[]){this.version="8.5.3",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new vL(this,e,t):new bL(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}var SL=AL;AL.default=AL,EL.registerProcessor(AL),_L.registerProcessor(AL);let wL=qN,xL=CN,TL=HN,ML=dN,OL=IN,NL=eC,CL=VC,DL=wC,LL=lL,IL=DC,kL=MN,$L=zD,RL=SL,zL=BD,PL=NC,FL=$C,ZL=yN,UL=FD;function BL(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new RL(e)}BL.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new RL).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return BL([i(n)]).process(e,t)},i},BL.stringify=ZL,BL.parse=$L,BL.fromJSON=CL,BL.list=IL,BL.comment=e=>new xL(e),BL.atRule=e=>new wL(e),BL.decl=e=>new OL(e),BL.rule=e=>new FL(e),BL.root=e=>new PL(e),BL.document=e=>new NL(e),BL.CssSyntaxError=ML,BL.Declaration=OL,BL.Container=TL,BL.Processor=RL,BL.Document=NL,BL.Comment=xL,BL.Warning=UL,BL.AtRule=wL,BL.Result=zL,BL.Input=DL,BL.Rule=FL,BL.Root=PL,BL.Node=kL,LL.registerPostcss(BL);var jL=BL;BL.default=BL;const VL=jT,GL=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},{isPlainObject:HL}=GO,YL=nN,WL=rN.exports,{parse:qL}=jL,KL=["img","audio","video","picture","svg","object","map","iframe","embed"],JL=["script","style"];function XL(e,t){e&&Object.keys(e).forEach((function(n){t(e[n],n)}))}function QL(e,t){return{}.hasOwnProperty.call(e,t)}function eI(e,t){const n=[];return XL(e,(function(e){t(e)&&n.push(e)})),n}var tI=rI;const nI=/^[^\0\t\n\f\r /<=>]+$/;function rI(e,t,n){if(null==e)return"";"number"==typeof e&&(e=e.toString());let r="",i="";function a(e,t){const n=this;this.tag=e,this.attribs=t||{},this.tagPosition=r.length,this.text="",this.openingTagLength=0,this.mediaChildren=[],this.updateParentNodeText=function(){if(g.length){g[g.length-1].text+=n.text}},this.updateParentNodeMediaChildren=function(){if(g.length&&KL.includes(this.tag)){g[g.length-1].mediaChildren.push(this.tag)}}}(t=Object.assign({},rI.defaults,t)).parser=Object.assign({},iI,t.parser);const o=function(e){return!1===t.allowedTags||(t.allowedTags||[]).indexOf(e)>-1};JL.forEach((function(e){o(e)&&!t.allowVulnerableTags&&console.warn(`\n\n⚠️ Your \`allowedTags\` option includes, \`${e}\`, which is inherently\nvulnerable to XSS attacks. Please remove it from \`allowedTags\`.\nOr, to disable this warning, add the \`allowVulnerableTags\` option\nand ensure you are accounting for this risk.\n\n`)}));const s=t.nonTextTags||["script","style","textarea","option"];let u,c;t.allowedAttributes&&(u={},c={},XL(t.allowedAttributes,(function(e,t){u[t]=[];const n=[];e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(GL(e).replace(/\\\*/g,".*")):u[t].push(e)})),n.length&&(c[t]=new RegExp("^("+n.join("|")+")$"))})));const l={},d={},f={};XL(t.allowedClasses,(function(e,t){if(u&&(QL(u,t)||(u[t]=[]),u[t].push("class")),l[t]=e,Array.isArray(e)){const n=[];l[t]=[],f[t]=[],e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(GL(e).replace(/\\\*/g,".*")):e instanceof RegExp?f[t].push(e):l[t].push(e)})),n.length&&(d[t]=new RegExp("^("+n.join("|")+")$"))}}));const p={};let h,m,g,y,_,v,b;XL(t.transformTags,(function(e,t){let n;"function"==typeof e?n=e:"string"==typeof e&&(n=rI.simpleTransform(e)),"*"===t?h=n:p[t]=n}));let E=!1;S();const A=new VL.Parser({onopentag:function(e,n){if(t.enforceHtmlBoundary&&"html"===e&&S(),v)return void b++;const A=new a(e,n);g.push(A);let O=!1;const N=!!A.text;let C;if(QL(p,e)&&(C=p[e](e,n),A.attribs=n=C.attribs,void 0!==C.text&&(A.innerText=C.text),e!==C.tagName&&(A.name=e=C.tagName,_[m]=C.tagName)),h&&(C=h(e,n),A.attribs=n=C.attribs,e!==C.tagName&&(A.name=e=C.tagName,_[m]=C.tagName)),(!o(e)||"recursiveEscape"===t.disallowedTagsMode&&!function(e){for(const t in e)if(QL(e,t))return!1;return!0}(y)||null!=t.nestingLimit&&m>=t.nestingLimit)&&(O=!0,y[m]=!0,"discard"!==t.disallowedTagsMode&&"completelyDiscard"!==t.disallowedTagsMode||-1!==s.indexOf(e)&&(v=!0,b=1)),m++,O){if("discard"===t.disallowedTagsMode||"completelyDiscard"===t.disallowedTagsMode){if(A.innerText&&!N){const n=w(A.innerText);t.textFilter?r+=t.textFilter(n,e):r+=n,E=!0}return}i=r,r=""}r+="<"+e,"script"===e&&(t.allowedScriptHostnames||t.allowedScriptDomains)&&(A.innerText=""),(!u||QL(u,e)||u["*"])&&XL(n,(function(n,i){if(!nI.test(i))return void delete A.attribs[i];if(""===n&&!t.allowedEmptyAttributes.includes(i)&&(t.nonBooleanAttributes.includes(i)||t.nonBooleanAttributes.includes("*")))return void delete A.attribs[i];let a=!1;if(!u||QL(u,e)&&-1!==u[e].indexOf(i)||u["*"]&&-1!==u["*"].indexOf(i)||QL(c,e)&&c[e].test(i)||c["*"]&&c["*"].test(i))a=!0;else if(u&&u[e])for(const t of u[e])if(HL(t)&&t.name&&t.name===i){a=!0;let e="";if(!0===t.multiple){const r=n.split(" ");for(const n of r)-1!==t.values.indexOf(n)&&(""===e?e=n:e+=" "+n)}else t.values.indexOf(n)>=0&&(e=n);n=e}if(a){if(-1!==t.allowedSchemesAppliedToAttributes.indexOf(i)&&x(e,n))return void delete A.attribs[i];if("script"===e&&"src"===i){let e=!0;try{const r=T(n);if(t.allowedScriptHostnames||t.allowedScriptDomains){const n=(t.allowedScriptHostnames||[]).find((function(e){return e===r.url.hostname})),i=(t.allowedScriptDomains||[]).find((function(e){return r.url.hostname===e||r.url.hostname.endsWith(`.${e}`)}));e=n||i}}catch(t){e=!1}if(!e)return void delete A.attribs[i]}if("iframe"===e&&"src"===i){let e=!0;try{const r=T(n);if(r.isRelativeUrl)e=QL(t,"allowIframeRelativeUrls")?t.allowIframeRelativeUrls:!t.allowedIframeHostnames&&!t.allowedIframeDomains;else if(t.allowedIframeHostnames||t.allowedIframeDomains){const n=(t.allowedIframeHostnames||[]).find((function(e){return e===r.url.hostname})),i=(t.allowedIframeDomains||[]).find((function(e){return r.url.hostname===e||r.url.hostname.endsWith(`.${e}`)}));e=n||i}}catch(t){e=!1}if(!e)return void delete A.attribs[i]}if("srcset"===i)try{let e=WL(n);if(e.forEach((function(e){x("srcset",e.url)&&(e.evil=!0)})),e=eI(e,(function(e){return!e.evil})),!e.length)return void delete A.attribs[i];n=eI(e,(function(e){return!e.evil})).map((function(e){if(!e.url)throw new Error("URL missing");return e.url+(e.w?` ${e.w}w`:"")+(e.h?` ${e.h}h`:"")+(e.d?` ${e.d}x`:"")})).join(", "),A.attribs[i]=n}catch(e){return void delete A.attribs[i]}if("class"===i){const t=l[e],r=l["*"],a=d[e],o=f[e],s=f["*"],u=[a,d["*"]].concat(o,s).filter((function(e){return e}));if(!(n=M(n,t&&r?YL(t,r):t||r,u)).length)return void delete A.attribs[i]}if("style"===i)if(t.parseStyleAttributes)try{const r=function(e,t){if(!t)return e;const n=e.nodes[0];let r;r=t[n.selector]&&t["*"]?YL(t[n.selector],t["*"]):t[n.selector]||t["*"];r&&(e.nodes[0].nodes=n.nodes.reduce(function(e){return function(t,n){if(QL(e,n.prop)){e[n.prop].some((function(e){return e.test(n.value)}))&&t.push(n)}return t}}(r),[]));return e}(qL(e+" {"+n+"}",{map:!1}),t.allowedStyles);if(n=function(e){return e.nodes[0].nodes.reduce((function(e,t){return e.push(`${t.prop}:${t.value}${t.important?" !important":""}`),e}),[]).join(";")}(r),0===n.length)return void delete A.attribs[i]}catch(t){return"undefined"!=typeof window&&console.warn('Failed to parse "'+e+" {"+n+"}\", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547"),void delete A.attribs[i]}else if(t.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.");r+=" "+i,n&&n.length?r+='="'+w(n,!0)+'"':t.allowedEmptyAttributes.includes(i)&&(r+='=""')}else delete A.attribs[i]})),-1!==t.selfClosing.indexOf(e)?r+=" />":(r+=">",!A.innerText||N||t.textFilter||(r+=w(A.innerText),E=!0)),O&&(r=i+w(r),i=""),A.openingTagLength=r.length-A.tagPosition},ontext:function(e){if(v)return;const n=g[g.length-1];let i;if(n&&(i=n.tag,e=void 0!==n.innerText?n.innerText:e),"completelyDiscard"!==t.disallowedTagsMode||o(i))if("discard"!==t.disallowedTagsMode&&"completelyDiscard"!==t.disallowedTagsMode||"script"!==i&&"style"!==i){if(!E){const n=w(e,!1);t.textFilter?r+=t.textFilter(n,i):r+=n}}else r+=e;else e="";if(g.length){g[g.length-1].text+=e}},onclosetag:function(e,n){if(v){if(b--,b)return;v=!1}const a=g.pop();if(!a)return;if(a.tag!==e)return void g.push(a);v=!!t.enforceHtmlBoundary&&"html"===e,m--;const s=y[m];if(s){if(delete y[m],"discard"===t.disallowedTagsMode||"completelyDiscard"===t.disallowedTagsMode)return void a.updateParentNodeText();i=r,r=""}if(_[m]&&(e=_[m],delete _[m]),t.exclusiveFilter){const e=t.exclusiveFilter(a);if("excludeTag"===e)return s&&(r=i,i=""),void(r=r.substring(0,a.tagPosition)+r.substring(a.tagPosition+a.openingTagLength));if(e)return void(r=r.substring(0,a.tagPosition))}a.updateParentNodeMediaChildren(),a.updateParentNodeText(),-1!==t.selfClosing.indexOf(e)||n&&!o(e)&&["escape","recursiveEscape"].indexOf(t.disallowedTagsMode)>=0?s&&(r=i,i=""):(r+="</"+e+">",s&&(r=i+w(r),i=""),E=!1)}},t.parser);return A.write(e),A.end(),r;function S(){r="",m=0,g=[],y={},_={},v=!1,b=0}function w(e,n){return"string"!=typeof e&&(e+=""),t.parser.decodeEntities&&(e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),n&&(e=e.replace(/"/g,"""))),e=e.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(/</g,"<").replace(/>/g,">"),n&&(e=e.replace(/"/g,""")),e}function x(e,n){for(n=n.replace(/[\x00-\x20]+/g,"");;){const e=n.indexOf("\x3c!--");if(-1===e)break;const t=n.indexOf("--\x3e",e+4);if(-1===t)break;n=n.substring(0,e)+n.substring(t+3)}const r=n.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!r)return!!n.match(/^[/\\]{2}/)&&!t.allowProtocolRelative;const i=r[1].toLowerCase();return QL(t.allowedSchemesByTag,e)?-1===t.allowedSchemesByTag[e].indexOf(i):!t.allowedSchemes||-1===t.allowedSchemes.indexOf(i)}function T(e){if((e=e.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//")).startsWith("relative:"))throw new Error("relative: exploit attempt");let t="relative://relative-site";for(let e=0;e<100;e++)t+=`/${e}`;const n=new URL(e,t);return{isRelativeUrl:n&&"relative-site"===n.hostname&&"relative:"===n.protocol,url:n}}function M(e,t,n){return t?(e=e.split(/\s+/)).filter((function(e){return-1!==t.indexOf(e)||n.some((function(t){return t.test(e)}))})).join(" "):e}}const iI={decodeEntities:!0};rI.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0},rI.simpleTransform=function(e,t,n){return n=void 0===n||n,t=t||{},function(r,i){let a;if(n)for(a in t)i[a]=t[a];else i=t;return{tagName:e,attribs:i}}};var aI=tI;const oI=t=>{const{baseTextColor:n,baseTextSize:r,children:i,className:a,id:o,inline:s,sanitizeOptions:u}=t,c=()=>o?zE.generateId(o,"sanitized"):zE.generateId("sanitized");return e(R,{baseTextColor:n,baseTextSize:r,inline:s,id:c(),className:a,"data-testid":c(),dangerouslySetInnerHTML:{__html:aI("string"!=typeof i?z(i):i,u)}})};var sI={exports:{}};
|
|
279
|
+
function HO(e){return"[object Object]"===Object.prototype.toString.call(e)}Object.defineProperty(GO,"__esModule",{value:!0}),GO.isPlainObject=function(e){var t,n;return!1!==HO(e)&&(void 0===(t=e.constructor)||!1!==HO(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))};var YO=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===WO}(e)}(e)};var WO="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function qO(e,t){return!1!==t.clone&&t.isMergeableObject(e)?eN((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function KO(e,t,n){return e.concat(t).map((function(e){return qO(e,n)}))}function JO(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function XO(e,t){try{return t in e}catch(e){return!1}}function QO(e,t,n){var r={};return n.isMergeableObject(e)&&JO(e).forEach((function(t){r[t]=qO(e[t],n)})),JO(t).forEach((function(i){(function(e,t){return XO(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(XO(e,i)&&n.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return eN;var n=t.customMerge(e);return"function"==typeof n?n:eN}(i,n)(e[i],t[i],n):r[i]=qO(t[i],n))})),r}function eN(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||KO,n.isMergeableObject=n.isMergeableObject||YO,n.cloneUnlessOtherwiseSpecified=qO;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):QO(e,t,n):qO(t,n)}eN.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return eN(e,n,t)}),{})};var tN,nN=eN,rN={exports:{}};tN=rN,function(e,t){tN.exports?tN.exports=t():e.parseSrcset=t()}(Gt,(function(){return function(e){function t(e){return" "===e||"\t"===e||"\n"===e||"\f"===e||"\r"===e}function n(t){var n,r=t.exec(e.substring(m));if(r)return n=r[0],m+=n.length,n}for(var r,i,a,o,s,u=e.length,c=/^[ \t\n\r\u000c]+/,l=/^[, \t\n\r\u000c]+/,d=/^[^ \t\n\r\u000c]+/,f=/[,]+$/,p=/^\d+$/,h=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,m=0,g=[];;){if(n(l),m>=u)return g;r=n(d),i=[],","===r.slice(-1)?(r=r.replace(f,""),_()):y()}function y(){for(n(c),a="",o="in descriptor";;){if(s=e.charAt(m),"in descriptor"===o)if(t(s))a&&(i.push(a),a="",o="after descriptor");else{if(","===s)return m+=1,a&&i.push(a),void _();if("("===s)a+=s,o="in parens";else{if(""===s)return a&&i.push(a),void _();a+=s}}else if("in parens"===o)if(")"===s)a+=s,o="in descriptor";else{if(""===s)return i.push(a),void _();a+=s}else if("after descriptor"===o)if(t(s));else{if(""===s)return void _();o="in descriptor",m-=1}m+=1}}function _(){var t,n,a,o,s,u,c,l,d,f=!1,m={};for(o=0;o<i.length;o++)u=(s=i[o])[s.length-1],c=s.substring(0,s.length-1),l=parseInt(c,10),d=parseFloat(c),p.test(c)&&"w"===u?((t||n)&&(f=!0),0===l?f=!0:t=l):h.test(c)&&"x"===u?((t||n||a)&&(f=!0),d<0?f=!0:n=d):p.test(c)&&"h"===u?((a||n)&&(f=!0),0===l?f=!0:a=l):f=!0;f?console&&console.log&&console.log("Invalid srcset descriptor found in '"+e+"' at '"+s+"'."):(m.url=r,t&&(m.w=t),n&&(m.d=n),a&&(m.h=a),g.push(m))}}}));var iN={exports:{}},aN=String,oN=function(){return{isColorSupported:!1,reset:aN,bold:aN,dim:aN,italic:aN,underline:aN,inverse:aN,hidden:aN,strikethrough:aN,black:aN,red:aN,green:aN,yellow:aN,blue:aN,magenta:aN,cyan:aN,white:aN,gray:aN,bgBlack:aN,bgRed:aN,bgGreen:aN,bgYellow:aN,bgBlue:aN,bgMagenta:aN,bgCyan:aN,bgWhite:aN,blackBright:aN,redBright:aN,greenBright:aN,yellowBright:aN,blueBright:aN,magentaBright:aN,cyanBright:aN,whiteBright:aN,bgBlackBright:aN,bgRedBright:aN,bgGreenBright:aN,bgYellowBright:aN,bgBlueBright:aN,bgMagentaBright:aN,bgCyanBright:aN,bgWhiteBright:aN}};iN.exports=oN(),iN.exports.createColors=oN;var sN=Ht(Object.freeze({__proto__:null,default:{}}));let uN=iN.exports,cN=sN;class lN extends Error{constructor(e,t,n,r,i,a){super(e),this.name="CssSyntaxError",this.reason=e,i&&(this.file=i),r&&(this.source=r),a&&(this.plugin=a),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,lN)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=uN.isColorSupported);let n=e=>e,r=e=>e,i=e=>e;if(e){let{bold:e,gray:t,red:a}=uN.createColors(!0);r=t=>e(a(t)),n=e=>t(e),cN&&(i=e=>cN(e))}let a=t.split(/\r?\n/),o=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(o,s).map(((e,t)=>{let a=o+1+t,s=" "+(" "+a).slice(-u)+" | ";if(a===this.line){if(e.length>160){let t=20,a=Math.max(0,this.column-t),o=Math.max(this.column+t,this.endColumn+t),u=e.slice(a,o),c=n(s.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return r(">")+n(s)+i(u)+"\n "+c+r("^")}let t=n(s.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return r(">")+n(s)+i(e)+"\n "+t+r("^")}return" "+n(s)+i(e)})).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}var dN=lN;lN.default=lN;const fN={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class pN{constructor(e){this.builder=e}atrule(e,t){let n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],a=this.raw(i,"before");a&&this.builder(a),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,n){let r;if(n||(n=t),t&&(r=e.raws[t],void 0!==r))return r;let i=e.parent;if("before"===n){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return fN[n];let a=e.root();if(a.rawCache||(a.rawCache={}),void 0!==a.rawCache[n])return a.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let i="raw"+((o=n)[0].toUpperCase()+o.slice(1));this[i]?r=this[i](a,e):a.walk((e=>{if(r=e.raws[t],void 0!==r)return!1}))}var o;return void 0===r&&(r=fN[n]),a.rawCache[n]=r,r}rawBeforeClose(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let n;return e.walkComments((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(e){let t;return e.walk((e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1})),t}rawBeforeRule(e){let t;return e.walk((n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls((e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1})),t}rawEmptyBody(e){let t;return e.walk((e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1})),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk((n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}})),t}rawSemicolon(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1})),t}rawValue(e,t){let n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}var hN=pN;pN.default=pN;let mN=hN;function gN(e,t){new mN(t).stringify(e)}var yN=gN;gN.default=gN;var _N={};_N.isClean=Symbol("isClean"),_N.my=Symbol("my");let vN=dN,bN=hN,EN=yN,{isClean:AN,my:SN}=_N;function wN(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let i=e[r],a=typeof i;"parent"===r&&"object"===a?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map((e=>wN(e,n))):("object"===a&&null!==i&&(i=wN(i)),n[r]=i)}return n}function xN(e,t){if(t&&void 0!==t.offset)return t.offset;let n=1,r=1,i=0;for(let a=0;a<e.length;a++){if(r===t.line&&n===t.column){i=a;break}"\n"===e[a]?(n=1,r+=1):n+=1}return i}class TN{get proxyOf(){return this}constructor(e={}){this.raws={},this[AN]=!1,this[SN]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=wN(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new vN(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markClean(){this[AN]=!0}markDirty(){if(this[AN]){this[AN]=!1;let e=this;for(;e=e.parent;)e[AN]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r=n.slice(xN(n,this.source.start),xN(n,this.source.end)).indexOf(e.word);-1!==r&&(t=this.positionInside(r))}return t}positionInside(e){let t=this.source.start.column,n=this.source.start.line,r="document"in this.source.input?this.source.input.document:this.source.input.css,i=xN(r,this.source.start),a=i+e;for(let e=i;e<a;e++)"\n"===r[e]?(t=1,n+=1):t+=1;return{column:t,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,i=r.slice(xN(r,this.source.start),xN(r,this.source.end)).indexOf(e.word);-1!==i&&(t=this.positionInside(i),n=this.positionInside(i+e.word.length))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new bN).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=null==t;t=t||new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let r=this[e];if(Array.isArray(r))n[e]=r.map((e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e));else if("object"==typeof r&&r.toJSON)n[e]=r.toJSON(null,t);else if("source"===e){let a=t.get(r.input);null==a&&(a=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:a,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map((e=>e.toJSON()))),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=EN){e.stringify&&(e=e.stringify);let t="";return e(this,(e=>{t+=e})),t}warn(e,t,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}}var MN=TN;TN.default=TN;let ON=MN;class NN extends ON{constructor(e){super(e),this.type="comment"}}var CN=NN;NN.default=NN;let DN=MN;class LN extends DN{get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}}var IN=LN;LN.default=LN;let kN,$N,RN,zN,PN=CN,FN=IN,ZN=MN,{isClean:UN,my:BN}=_N;function jN(e){return e.map((e=>(e.nodes&&(e.nodes=jN(e.nodes)),delete e.source,e)))}function VN(e){if(e[UN]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)VN(t)}class GN extends ZN{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...n)=>e[t](...n.map((e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e))):"every"===t||"some"===t?n=>e[t](((e,...t)=>n(e.toProxy(),...t))):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map((e=>e.toProxy())):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n,r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let e of i)this.proxyOf.nodes.splice(r+1,0,e);for(let e in this.indexes)n=this.indexes[e],r<n&&(this.indexes[e]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",a=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let e of a)this.proxyOf.nodes.splice(r,0,e);for(let e in this.indexes)n=this.indexes[e],r<=n&&(this.indexes[e]=n+a.length);return this.markDirty(),this}normalize(e,t){if("string"==typeof e)e=jN($N(e).nodes);else if(void 0===e)e=[];else if(Array.isArray(e)){e=e.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if("root"===e.type&&"document"!==this.type){e=e.nodes.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error("Value field is missed in node creation");"string"!=typeof e.value&&(e.value=String(e.value)),e=[new FN(e)]}else if(e.selector||e.selectors)e=[new zN(e)];else if(e.name)e=[new kN(e)];else{if(!e.text)throw new Error("Unknown node type in node creation");e=[new PN(e)]}return e.map((e=>(e[BN]||GN.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[UN]&&VN(e),e.raws||(e.raws={}),void 0===e.raws.before&&t&&void 0!==t.raws.before&&(e.raws.before=t.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e)))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls((r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))})),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each(((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return!1!==r&&t.walk&&(r=t.walk(e)),r}))}walkAtRules(e,t){return t?e instanceof RegExp?this.walk(((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)})):this.walk(((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)})):(t=e,this.walk(((e,n)=>{if("atrule"===e.type)return t(e,n)})))}walkComments(e){return this.walk(((t,n)=>{if("comment"===t.type)return e(t,n)}))}walkDecls(e,t){return t?e instanceof RegExp?this.walk(((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)})):this.walk(((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)})):(t=e,this.walk(((e,n)=>{if("decl"===e.type)return t(e,n)})))}walkRules(e,t){return t?e instanceof RegExp?this.walk(((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)})):this.walk(((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)})):(t=e,this.walk(((e,n)=>{if("rule"===e.type)return t(e,n)})))}}GN.registerParse=e=>{$N=e},GN.registerRule=e=>{zN=e},GN.registerAtRule=e=>{kN=e},GN.registerRoot=e=>{RN=e};var HN=GN;GN.default=GN,GN.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,kN.prototype):"rule"===e.type?Object.setPrototypeOf(e,zN.prototype):"decl"===e.type?Object.setPrototypeOf(e,FN.prototype):"comment"===e.type?Object.setPrototypeOf(e,PN.prototype):"root"===e.type&&Object.setPrototypeOf(e,RN.prototype),e[BN]=!0,e.nodes&&e.nodes.forEach((e=>{GN.rebuild(e)}))};let YN=HN;class WN extends YN{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}var qN=WN;WN.default=WN,YN.registerAtRule(WN);let KN,JN,XN=HN;class QN extends XN{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new KN(new JN,this,e).stringify()}}QN.registerLazyResult=e=>{KN=e},QN.registerProcessor=e=>{JN=e};var eC=QN;QN.default=QN;var tC={nanoid:(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r}};let{existsSync:nC,readFileSync:rC}=sN,{dirname:iC,join:aC}=sN,{SourceMapConsumer:oC,SourceMapGenerator:sC}=sN;class uC{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=iC(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new oC(this.text)),this.consumerCache}decodeInline(e){let t=e.match(/^data:application\/json;charset=utf-?8,/)||e.match(/^data:application\/json,/);if(t)return decodeURIComponent(e.substr(t[0].length));let n=e.match(/^data:application\/json;charset=utf-?8;base64,/)||e.match(/^data:application\/json;base64,/);if(n)return r=e.substr(n[0].length),Buffer?Buffer.from(r,"base64").toString():window.atob(r);var r;let i=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/g);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=iC(e),nC(e))return this.mapFile=e,rC(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof oC)return sC.fromSourceMap(t).toString();if(t instanceof sC)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=aC(iC(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}var cC=uC;uC.default=uC;let{nanoid:lC}=tC,{isAbsolute:dC,resolve:fC}=sN,{SourceMapConsumer:pC,SourceMapGenerator:hC}=sN,{fileURLToPath:mC,pathToFileURL:gC}=sN,yC=dN,_C=cC,vC=sN,bC=Symbol("fromOffsetCache"),EC=Boolean(pC&&hC),AC=Boolean(fC&&dC);class SC{get from(){return this.file||this.id}constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,t.document&&(this.document=t.document.toString()),t.from&&(!AC||/^\w+:\/\//.test(t.from)||dC(t.from)?this.file=t.from:this.file=fC(t.from)),AC&&EC){let e=new _C(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+lC(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,a,o;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);a=e.line,i=e.col}else a=r.line,i=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let s=this.origin(t,n,a,i);return o=s?new yC(e,void 0===s.endLine?s.line:{column:s.column,line:s.line},void 0===s.endLine?s.column:{column:s.endColumn,line:s.endLine},s.source,s.file,r.plugin):new yC(e,void 0===a?t:{column:n,line:t},void 0===a?n:{column:i,line:a},this.css,this.file,r.plugin),o.input={column:n,endColumn:i,endLine:a,line:t,source:this.css},this.file&&(gC&&(o.input.url=gC(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[bC])n=this[bC];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[bC]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:fC(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let i,a,o=this.map.consumer(),s=o.originalPositionFor({column:t,line:e});if(!s.source)return!1;"number"==typeof n&&(i=o.originalPositionFor({column:r,line:n})),a=dC(s.source)?gC(s.source):new URL(s.source,this.map.consumer().sourceRoot||gC(this.map.mapFile));let u={column:s.column,endColumn:i&&i.column,endLine:i&&i.line,line:s.line,url:a.toString()};if("file:"===a.protocol){if(!mC)throw new Error("file: protocol is not available in this PostCSS build");u.file=mC(a)}let c=o.sourceContentFor(s.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}}var wC=SC;SC.default=SC,vC&&vC.registerInput&&vC.registerInput(SC);let xC,TC,MC=HN;class OC extends MC{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new xC(new TC,this,e).stringify()}}OC.registerLazyResult=e=>{xC=e},OC.registerProcessor=e=>{TC=e};var NC=OC;OC.default=OC,MC.registerRoot(OC);let CC={comma:e=>CC.split(e,[","],!0),space:e=>CC.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],i="",a=!1,o=0,s=!1,u="",c=!1;for(let n of e)c?c=!1:"\\"===n?c=!0:s?n===u&&(s=!1):'"'===n||"'"===n?(s=!0,u=n):"("===n?o+=1:")"===n?o>0&&(o-=1):0===o&&t.includes(n)&&(a=!0),a?(""!==i&&r.push(i.trim()),i="",a=!1):i+=n;return(n||""!==i)&&r.push(i.trim()),r}};var DC=CC;CC.default=CC;let LC=HN,IC=DC;class kC extends LC{get selectors(){return IC.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}}var $C=kC;kC.default=kC,LC.registerRule(kC);let RC=qN,zC=CN,PC=IN,FC=wC,ZC=cC,UC=NC,BC=$C;function jC(e,t){if(Array.isArray(e))return e.map((e=>jC(e)));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:FC.prototype};n.map&&(n.map={...n.map,__proto__:ZC.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map((e=>jC(e,t)))),r.source){let{inputId:e,...n}=r.source;r.source=n,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new UC(r);if("decl"===r.type)return new PC(r);if("rule"===r.type)return new BC(r);if("comment"===r.type)return new zC(r);if("atrule"===r.type)return new RC(r);throw new Error("Unknown node type: "+e.type)}var VC=jC;jC.default=jC;let{dirname:GC,relative:HC,resolve:YC,sep:WC}=sN,{SourceMapConsumer:qC,SourceMapGenerator:KC}=sN,{pathToFileURL:JC}=sN,XC=wC,QC=Boolean(qC&&KC),eD=Boolean(GC&&YC&&HC&&WC);var tD=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,n=this.toUrl(this.path(e.file)),r=e.root||GC(e.file);!1===this.mapOpts.sourcesContent?(t=new qC(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&e.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),eD&&QC&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,(t=>{e+=t})),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=KC.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new KC({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new KC({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",a={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,((o,s,u)=>{if(this.css+=o,s&&"end"!==u&&(a.generated.line=n,a.generated.column=r-1,s.source&&s.source.start?(a.source=this.sourcePath(s),a.original.line=s.source.start.line,a.original.column=s.source.start.column-1,this.map.addMapping(a)):(a.source=i,a.original.line=1,a.original.column=0,this.map.addMapping(a))),t=o.match(/\n/g),t?(n+=t.length,e=o.lastIndexOf("\n"),r=o.length-e):r+=o.length,s&&"start"!==u){let e=s.parent||{raws:{}};("decl"===s.type||"atrule"===s.type&&!s.nodes)&&s===e.last&&!e.raws.semicolon||(s.source&&s.source.end?(a.source=this.sourcePath(s),a.original.line=s.source.end.line,a.original.column=s.source.end.column-1,a.generated.line=n,a.generated.column=r-2,this.map.addMapping(a)):(a.source=i,a.original.line=1,a.original.column=0,a.generated.line=n,a.generated.column=r-1,this.map.addMapping(a)))}}))}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some((e=>e.annotation)))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some((e=>e.inline)))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some((e=>e.withContent()))}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?GC(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=GC(YC(n,this.mapOpts.annotation)));let r=HC(n,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk((e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}}));else{let e=new XC(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk((t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,t.source.input.css)}}}));else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(JC){let t=JC(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===WC&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}};const nD="'".charCodeAt(0),rD='"'.charCodeAt(0),iD="\\".charCodeAt(0),aD="/".charCodeAt(0),oD="\n".charCodeAt(0),sD=" ".charCodeAt(0),uD="\f".charCodeAt(0),cD="\t".charCodeAt(0),lD="\r".charCodeAt(0),dD="[".charCodeAt(0),fD="]".charCodeAt(0),pD="(".charCodeAt(0),hD=")".charCodeAt(0),mD="{".charCodeAt(0),gD="}".charCodeAt(0),yD=";".charCodeAt(0),_D="*".charCodeAt(0),vD=":".charCodeAt(0),bD="@".charCodeAt(0),ED=/[\t\n\f\r "#'()/;[\\\]{}]/g,AD=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,SD=/.[\r\n"'(/\\]/,wD=/[\da-f]/i;let xD=qN,TD=CN,MD=IN,OD=NC,ND=$C,CD=function(e,t={}){let n,r,i,a,o,s,u,c,l,d,f=e.css.valueOf(),p=t.ignoreErrors,h=f.length,m=0,g=[],y=[];function _(t){throw e.error("Unclosed "+t,m)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&m>=h},nextToken:function(e){if(y.length)return y.pop();if(m>=h)return;let t=!!e&&e.ignoreUnclosed;switch(n=f.charCodeAt(m),n){case oD:case sD:case cD:case lD:case uD:a=m;do{a+=1,n=f.charCodeAt(a)}while(n===sD||n===oD||n===cD||n===lD||n===uD);s=["space",f.slice(m,a)],m=a-1;break;case dD:case fD:case mD:case gD:case vD:case yD:case hD:{let e=String.fromCharCode(n);s=[e,e,m];break}case pD:if(d=g.length?g.pop()[1]:"",l=f.charCodeAt(m+1),"url"===d&&l!==nD&&l!==rD&&l!==sD&&l!==oD&&l!==cD&&l!==uD&&l!==lD){a=m;do{if(u=!1,a=f.indexOf(")",a+1),-1===a){if(p||t){a=m;break}_("bracket")}for(c=a;f.charCodeAt(c-1)===iD;)c-=1,u=!u}while(u);s=["brackets",f.slice(m,a+1),m,a],m=a}else a=f.indexOf(")",m+1),r=f.slice(m,a+1),-1===a||SD.test(r)?s=["(","(",m]:(s=["brackets",r,m,a],m=a);break;case nD:case rD:o=n===nD?"'":'"',a=m;do{if(u=!1,a=f.indexOf(o,a+1),-1===a){if(p||t){a=m+1;break}_("string")}for(c=a;f.charCodeAt(c-1)===iD;)c-=1,u=!u}while(u);s=["string",f.slice(m,a+1),m,a],m=a;break;case bD:ED.lastIndex=m+1,ED.test(f),a=0===ED.lastIndex?f.length-1:ED.lastIndex-2,s=["at-word",f.slice(m,a+1),m,a],m=a;break;case iD:for(a=m,i=!0;f.charCodeAt(a+1)===iD;)a+=1,i=!i;if(n=f.charCodeAt(a+1),i&&n!==aD&&n!==sD&&n!==oD&&n!==cD&&n!==lD&&n!==uD&&(a+=1,wD.test(f.charAt(a)))){for(;wD.test(f.charAt(a+1));)a+=1;f.charCodeAt(a+1)===sD&&(a+=1)}s=["word",f.slice(m,a+1),m,a],m=a;break;default:n===aD&&f.charCodeAt(m+1)===_D?(a=f.indexOf("*/",m+2)+1,0===a&&(p||t?a=f.length:_("comment")),s=["comment",f.slice(m,a+1),m,a],m=a):(AD.lastIndex=m+1,AD.test(f),a=0===AD.lastIndex?f.length-1:AD.lastIndex-2,s=["word",f.slice(m,a+1),m,a],g.push(s),m=a)}return m++,s},position:function(){return m}}};const DD={empty:!0,space:!0};var LD=class{constructor(e){this.input=e,this.root=new OD,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,n,r,i=new xD;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let a=!1,o=!1,s=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?u.push("("===t?")":"]"):"{"===t&&u.length>0?u.push("}"):t===u[u.length-1]&&u.pop(),0===u.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){o=!0;break}if("}"===t){if(s.length>0){for(r=s.length-1,n=s[r];n&&"space"===n[0];)n=s[--r];n&&(i.source.end=this.getPosition(n[3]||n[2]),i.source.end.offset++)}this.end(e);break}s.push(e)}else s.push(e);if(this.tokenizer.endOfFile()){a=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(i.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(i,"params",s),a&&(e=s[s.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),o&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[a,o]of e.entries()){if(n=o,r=n[0],"("===r&&(i+=1),")"===r&&(i-=1),0===i&&":"===r){if(t){if("word"===t[0]&&"progid"===t[1])continue;return a}this.doubleColon(n)}t=n}return!1}comment(e){let t=new TD;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=CD(this.input)}decl(e,t){let n=new MD;this.init(n,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(i[3]||i[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),n.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;n.prop+=e.shift()[1]}for(n.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){n.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),n.raws.between+=r[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let a,o=[];for(;e.length&&(a=e[0][0],"space"===a||"comment"===a);)o.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){n.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r," !important"!==r&&(n.raws.important=r);break}if("important"===r[1].toLowerCase()){let r=e.slice(0),i="";for(let e=t;e>0;e--){let t=r[e][0];if(i.trim().startsWith("!")&&"space"!==t)break;i=r.pop()[1]+i}i.trim().startsWith("!")&&(n.important=!0,n.raws.important=i,e=r)}if("space"!==r[0]&&"comment"!==r[0])break}e.some((e=>"space"!==e[0]&&"comment"!==e[0]))&&(n.raws.between+=o.map((e=>e[1])).join(""),o=[]),this.raw(n,"value",o.concat(e),t),n.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new ND;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,n=null,r=!1,i=null,a=[],o=e[1].startsWith("--"),s=[],u=e;for(;u;){if(n=u[0],s.push(u),"("===n||"["===n)i||(i=u),a.push("("===n?")":"]");else if(o&&r&&"{"===n)i||(i=u),a.push("}");else if(0===a.length){if(";"===n){if(r)return void this.decl(s,o);break}if("{"===n)return void this.rule(s);if("}"===n){this.tokenizer.back(s.pop()),t=!0;break}":"===n&&(r=!0)}else n===a[a.length-1]&&(a.pop(),0===a.length&&(i=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),a.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;s.length&&(u=s[s.length-1][0],"space"===u||"comment"===u);)this.tokenizer.back(s.pop());this.decl(s,o)}else this.unknownWord(s)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,r){let i,a,o,s,u=n.length,c="",l=!0;for(let e=0;e<u;e+=1)i=n[e],a=i[0],"space"!==a||e!==u-1||r?"comment"===a?(s=n[e-1]?n[e-1][0]:"empty",o=n[e+1]?n[e+1][0]:"empty",DD[s]||DD[o]||","===c.slice(-1)?l=!1:c+=i[1]):c+=i[1]:l=!1;if(!l){let r=n.reduce(((e,t)=>e+t[1]),"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new ND;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word "+e[0][1],{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let ID=HN,kD=wC,$D=LD;function RD(e,t){let n=new kD(e,t),r=new $D(n);try{r.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&t&&t.from&&(/\.scss$/i.test(t.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(t.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(t.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return r.root}var zD=RD;RD.default=RD,ID.registerParse(RD);class PD{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}var FD=PD;PD.default=PD;let ZD=FD;class UD{get content(){return this.css}constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new ZD(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter((e=>"warning"===e.type))}}var BD=UD;UD.default=UD;let jD={};var VD=function(e){jD[e]||(jD[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};let GD=HN,HD=eC,YD=tD,WD=zD,qD=BD,KD=NC,JD=yN,{isClean:XD,my:QD}=_N,eL=VD;const tL={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},nL={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},rL={Once:!0,postcssPlugin:!0,prepare:!0};function iL(e){return"object"==typeof e&&"function"==typeof e.then}function aL(e){let t=!1,n=tL[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function oL(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:aL(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function sL(e){return e[XD]=!1,e.nodes&&e.nodes.forEach((e=>sL(e))),e}let uL={};class cL{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(e,t,n){let r;if(this.stringified=!1,this.processed=!1,"object"!=typeof t||null===t||"root"!==t.type&&"document"!==t.type)if(t instanceof cL||t instanceof qD)r=sL(t.root),t.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=t.map);else{let e=WD;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{r=e(t,n)}catch(e){this.processed=!0,this.error=e}r&&!r[QD]&&GD.rebuild(r)}else r=sL(t);this.result=new qD(e,r,n),this.helpers={...uL,postcss:uL,result:this.result},this.plugins=this.processor.plugins.map((e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e))}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let n=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(n.postcssVersion&&"production"!==process.env.NODE_ENV){let e=n.postcssPlugin,t=n.postcssVersion,r=this.result.processor.version,i=t.split("."),a=r.split(".");(i[0]!==a[0]||parseInt(i[1])>parseInt(a[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+r+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=n.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!nL[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!rL[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],n=this.runOnRoot(t);if(iL(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[XD];){e[XD]=!0;let t=[oL(e)];for(;t.length>0;){let e=this.visitTick(t);if(iL(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map((e=>n(e,this.helpers)));await Promise.all(t)}else await n(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map((t=>e.Once(t,this.helpers)));return iL(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=JD;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new YD(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(iL(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[XD];)e[XD]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||eL("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,r]of e){let e;this.result.lastPlugin=n;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(iL(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[XD])return r[XD]=!0,void e.push(oL(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[XD]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[XD]=!0;let t=aL(e);for(let n of t)if(0===n)e.nodes&&e.each((e=>{e[XD]||this.walkSync(e)}));else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}}cL.registerPostcss=e=>{uL=e};var lL=cL;cL.default=cL,KD.registerLazyResult(cL),HD.registerLazyResult(cL);let dL=tD,fL=zD;const pL=BD;let hL=yN,mL=VD;class gL{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=fL;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(e,t,n){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let i=hL;this.result=new pL(this._processor,r,this._opts),this.result.css=t;let a=this;Object.defineProperty(this.result,"root",{get:()=>a.root});let o=new dL(i,r,this._opts,t);if(o.isMap()){let[e,t]=o.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else o.clearAnnotation(),this.result.css=o.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||mL("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}}var yL=gL;gL.default=gL;let _L=eC,vL=lL,bL=yL,EL=NC;class AL{constructor(e=[]){this.version="8.5.3",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new vL(this,e,t):new bL(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}var SL=AL;AL.default=AL,EL.registerProcessor(AL),_L.registerProcessor(AL);let wL=qN,xL=CN,TL=HN,ML=dN,OL=IN,NL=eC,CL=VC,DL=wC,LL=lL,IL=DC,kL=MN,$L=zD,RL=SL,zL=BD,PL=NC,FL=$C,ZL=yN,UL=FD;function BL(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new RL(e)}BL.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new RL).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return BL([i(n)]).process(e,t)},i},BL.stringify=ZL,BL.parse=$L,BL.fromJSON=CL,BL.list=IL,BL.comment=e=>new xL(e),BL.atRule=e=>new wL(e),BL.decl=e=>new OL(e),BL.rule=e=>new FL(e),BL.root=e=>new PL(e),BL.document=e=>new NL(e),BL.CssSyntaxError=ML,BL.Declaration=OL,BL.Container=TL,BL.Processor=RL,BL.Document=NL,BL.Comment=xL,BL.Warning=UL,BL.AtRule=wL,BL.Result=zL,BL.Input=DL,BL.Rule=FL,BL.Root=PL,BL.Node=kL,LL.registerPostcss(BL);var jL=BL;BL.default=BL;const VL=jT,GL=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},{isPlainObject:HL}=GO,YL=nN,WL=rN.exports,{parse:qL}=jL,KL=["img","audio","video","picture","svg","object","map","iframe","embed"],JL=["script","style"];function XL(e,t){e&&Object.keys(e).forEach((function(n){t(e[n],n)}))}function QL(e,t){return{}.hasOwnProperty.call(e,t)}function eI(e,t){const n=[];return XL(e,(function(e){t(e)&&n.push(e)})),n}var tI=rI;const nI=/^[^\0\t\n\f\r /<=>]+$/;function rI(e,t,n){if(null==e)return"";"number"==typeof e&&(e=e.toString());let r="",i="";function a(e,t){const n=this;this.tag=e,this.attribs=t||{},this.tagPosition=r.length,this.text="",this.openingTagLength=0,this.mediaChildren=[],this.updateParentNodeText=function(){if(g.length){g[g.length-1].text+=n.text}},this.updateParentNodeMediaChildren=function(){if(g.length&&KL.includes(this.tag)){g[g.length-1].mediaChildren.push(this.tag)}}}(t=Object.assign({},rI.defaults,t)).parser=Object.assign({},iI,t.parser);const o=function(e){return!1===t.allowedTags||(t.allowedTags||[]).indexOf(e)>-1};JL.forEach((function(e){o(e)&&!t.allowVulnerableTags&&console.warn(`\n\n⚠️ Your \`allowedTags\` option includes, \`${e}\`, which is inherently\nvulnerable to XSS attacks. Please remove it from \`allowedTags\`.\nOr, to disable this warning, add the \`allowVulnerableTags\` option\nand ensure you are accounting for this risk.\n\n`)}));const s=t.nonTextTags||["script","style","textarea","option"];let u,c;t.allowedAttributes&&(u={},c={},XL(t.allowedAttributes,(function(e,t){u[t]=[];const n=[];e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(GL(e).replace(/\\\*/g,".*")):u[t].push(e)})),n.length&&(c[t]=new RegExp("^("+n.join("|")+")$"))})));const l={},d={},f={};XL(t.allowedClasses,(function(e,t){if(u&&(QL(u,t)||(u[t]=[]),u[t].push("class")),l[t]=e,Array.isArray(e)){const n=[];l[t]=[],f[t]=[],e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(GL(e).replace(/\\\*/g,".*")):e instanceof RegExp?f[t].push(e):l[t].push(e)})),n.length&&(d[t]=new RegExp("^("+n.join("|")+")$"))}}));const p={};let h,m,g,y,_,v,b;XL(t.transformTags,(function(e,t){let n;"function"==typeof e?n=e:"string"==typeof e&&(n=rI.simpleTransform(e)),"*"===t?h=n:p[t]=n}));let E=!1;S();const A=new VL.Parser({onopentag:function(e,n){if(t.enforceHtmlBoundary&&"html"===e&&S(),v)return void b++;const A=new a(e,n);g.push(A);let O=!1;const N=!!A.text;let C;if(QL(p,e)&&(C=p[e](e,n),A.attribs=n=C.attribs,void 0!==C.text&&(A.innerText=C.text),e!==C.tagName&&(A.name=e=C.tagName,_[m]=C.tagName)),h&&(C=h(e,n),A.attribs=n=C.attribs,e!==C.tagName&&(A.name=e=C.tagName,_[m]=C.tagName)),(!o(e)||"recursiveEscape"===t.disallowedTagsMode&&!function(e){for(const t in e)if(QL(e,t))return!1;return!0}(y)||null!=t.nestingLimit&&m>=t.nestingLimit)&&(O=!0,y[m]=!0,"discard"!==t.disallowedTagsMode&&"completelyDiscard"!==t.disallowedTagsMode||-1!==s.indexOf(e)&&(v=!0,b=1)),m++,O){if("discard"===t.disallowedTagsMode||"completelyDiscard"===t.disallowedTagsMode){if(A.innerText&&!N){const n=w(A.innerText);t.textFilter?r+=t.textFilter(n,e):r+=n,E=!0}return}i=r,r=""}r+="<"+e,"script"===e&&(t.allowedScriptHostnames||t.allowedScriptDomains)&&(A.innerText=""),(!u||QL(u,e)||u["*"])&&XL(n,(function(n,i){if(!nI.test(i))return void delete A.attribs[i];if(""===n&&!t.allowedEmptyAttributes.includes(i)&&(t.nonBooleanAttributes.includes(i)||t.nonBooleanAttributes.includes("*")))return void delete A.attribs[i];let a=!1;if(!u||QL(u,e)&&-1!==u[e].indexOf(i)||u["*"]&&-1!==u["*"].indexOf(i)||QL(c,e)&&c[e].test(i)||c["*"]&&c["*"].test(i))a=!0;else if(u&&u[e])for(const t of u[e])if(HL(t)&&t.name&&t.name===i){a=!0;let e="";if(!0===t.multiple){const r=n.split(" ");for(const n of r)-1!==t.values.indexOf(n)&&(""===e?e=n:e+=" "+n)}else t.values.indexOf(n)>=0&&(e=n);n=e}if(a){if(-1!==t.allowedSchemesAppliedToAttributes.indexOf(i)&&x(e,n))return void delete A.attribs[i];if("script"===e&&"src"===i){let e=!0;try{const r=T(n);if(t.allowedScriptHostnames||t.allowedScriptDomains){const n=(t.allowedScriptHostnames||[]).find((function(e){return e===r.url.hostname})),i=(t.allowedScriptDomains||[]).find((function(e){return r.url.hostname===e||r.url.hostname.endsWith(`.${e}`)}));e=n||i}}catch(t){e=!1}if(!e)return void delete A.attribs[i]}if("iframe"===e&&"src"===i){let e=!0;try{const r=T(n);if(r.isRelativeUrl)e=QL(t,"allowIframeRelativeUrls")?t.allowIframeRelativeUrls:!t.allowedIframeHostnames&&!t.allowedIframeDomains;else if(t.allowedIframeHostnames||t.allowedIframeDomains){const n=(t.allowedIframeHostnames||[]).find((function(e){return e===r.url.hostname})),i=(t.allowedIframeDomains||[]).find((function(e){return r.url.hostname===e||r.url.hostname.endsWith(`.${e}`)}));e=n||i}}catch(t){e=!1}if(!e)return void delete A.attribs[i]}if("srcset"===i)try{let e=WL(n);if(e.forEach((function(e){x("srcset",e.url)&&(e.evil=!0)})),e=eI(e,(function(e){return!e.evil})),!e.length)return void delete A.attribs[i];n=eI(e,(function(e){return!e.evil})).map((function(e){if(!e.url)throw new Error("URL missing");return e.url+(e.w?` ${e.w}w`:"")+(e.h?` ${e.h}h`:"")+(e.d?` ${e.d}x`:"")})).join(", "),A.attribs[i]=n}catch(e){return void delete A.attribs[i]}if("class"===i){const t=l[e],r=l["*"],a=d[e],o=f[e],s=f["*"],u=[a,d["*"]].concat(o,s).filter((function(e){return e}));if(!(n=M(n,t&&r?YL(t,r):t||r,u)).length)return void delete A.attribs[i]}if("style"===i)if(t.parseStyleAttributes)try{const r=function(e,t){if(!t)return e;const n=e.nodes[0];let r;r=t[n.selector]&&t["*"]?YL(t[n.selector],t["*"]):t[n.selector]||t["*"];r&&(e.nodes[0].nodes=n.nodes.reduce(function(e){return function(t,n){if(QL(e,n.prop)){e[n.prop].some((function(e){return e.test(n.value)}))&&t.push(n)}return t}}(r),[]));return e}(qL(e+" {"+n+"}",{map:!1}),t.allowedStyles);if(n=function(e){return e.nodes[0].nodes.reduce((function(e,t){return e.push(`${t.prop}:${t.value}${t.important?" !important":""}`),e}),[]).join(";")}(r),0===n.length)return void delete A.attribs[i]}catch(t){return"undefined"!=typeof window&&console.warn('Failed to parse "'+e+" {"+n+"}\", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547"),void delete A.attribs[i]}else if(t.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.");r+=" "+i,n&&n.length?r+='="'+w(n,!0)+'"':t.allowedEmptyAttributes.includes(i)&&(r+='=""')}else delete A.attribs[i]})),-1!==t.selfClosing.indexOf(e)?r+=" />":(r+=">",!A.innerText||N||t.textFilter||(r+=w(A.innerText),E=!0)),O&&(r=i+w(r),i=""),A.openingTagLength=r.length-A.tagPosition},ontext:function(e){if(v)return;const n=g[g.length-1];let i;if(n&&(i=n.tag,e=void 0!==n.innerText?n.innerText:e),"completelyDiscard"!==t.disallowedTagsMode||o(i))if("discard"!==t.disallowedTagsMode&&"completelyDiscard"!==t.disallowedTagsMode||"script"!==i&&"style"!==i){if(!E){const n=w(e,!1);t.textFilter?r+=t.textFilter(n,i):r+=n}}else r+=e;else e="";if(g.length){g[g.length-1].text+=e}},onclosetag:function(e,n){if(v){if(b--,b)return;v=!1}const a=g.pop();if(!a)return;if(a.tag!==e)return void g.push(a);v=!!t.enforceHtmlBoundary&&"html"===e,m--;const s=y[m];if(s){if(delete y[m],"discard"===t.disallowedTagsMode||"completelyDiscard"===t.disallowedTagsMode)return void a.updateParentNodeText();i=r,r=""}if(_[m]&&(e=_[m],delete _[m]),t.exclusiveFilter){const e=t.exclusiveFilter(a);if("excludeTag"===e)return s&&(r=i,i=""),void(r=r.substring(0,a.tagPosition)+r.substring(a.tagPosition+a.openingTagLength));if(e)return void(r=r.substring(0,a.tagPosition))}a.updateParentNodeMediaChildren(),a.updateParentNodeText(),-1!==t.selfClosing.indexOf(e)||n&&!o(e)&&["escape","recursiveEscape"].indexOf(t.disallowedTagsMode)>=0?s&&(r=i,i=""):(r+="</"+e+">",s&&(r=i+w(r),i=""),E=!1)}},t.parser);return A.write(e),A.end(),r;function S(){r="",m=0,g=[],y={},_={},v=!1,b=0}function w(e,n){return"string"!=typeof e&&(e+=""),t.parser.decodeEntities&&(e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),n&&(e=e.replace(/"/g,"""))),e=e.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(/</g,"<").replace(/>/g,">"),n&&(e=e.replace(/"/g,""")),e}function x(e,n){for(n=n.replace(/[\x00-\x20]+/g,"");;){const e=n.indexOf("\x3c!--");if(-1===e)break;const t=n.indexOf("--\x3e",e+4);if(-1===t)break;n=n.substring(0,e)+n.substring(t+3)}const r=n.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!r)return!!n.match(/^[/\\]{2}/)&&!t.allowProtocolRelative;const i=r[1].toLowerCase();return QL(t.allowedSchemesByTag,e)?-1===t.allowedSchemesByTag[e].indexOf(i):!t.allowedSchemes||-1===t.allowedSchemes.indexOf(i)}function T(e){if((e=e.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//")).startsWith("relative:"))throw new Error("relative: exploit attempt");let t="relative://relative-site";for(let e=0;e<100;e++)t+=`/${e}`;const n=new URL(e,t);return{isRelativeUrl:n&&"relative-site"===n.hostname&&"relative:"===n.protocol,url:n}}function M(e,t,n){return t?(e=e.split(/\s+/)).filter((function(e){return-1!==t.indexOf(e)||n.some((function(t){return t.test(e)}))})).join(" "):e}}const iI={decodeEntities:!0};rI.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0},rI.simpleTransform=function(e,t,n){return n=void 0===n||n,t=t||{},function(r,i){let a;if(n)for(a in t)i[a]=t[a];else i=t;return{tagName:e,attribs:i}}};var aI=tI;const oI=t=>{const{baseTextColor:n,baseTextSize:r,children:i,className:a,id:o,inline:s,sanitizeOptions:u}=t;return e(R,{baseTextColor:n,baseTextSize:r,inline:s,id:o,className:a,"data-testid":o?zE.generateId(o,"sanitized"):zE.generateId("sanitized"),dangerouslySetInnerHTML:{__html:aI("string"!=typeof i?z(i):i,u)}})};var sI={exports:{}};
|
|
280
280
|
/**
|
|
281
281
|
* @license
|
|
282
282
|
* Lodash <https://lodash.com/>
|
|
@@ -335,7 +335,7 @@ function HO(e){return"[object Object]"===Object.prototype.toString.call(e)}Objec
|
|
|
335
335
|
}
|
|
336
336
|
`,p$={D1:"heading-xxl",D2:"heading-xl",D3:"heading-md",D4:"heading-sm",DBody:"heading-sm",H1:"heading-lg",H2:"heading-md",H3:"heading-sm",H4:"heading-xs",H5:"body-md",H6:"body-sm",Body:"body-baseline",BodySmall:"body-md",XSmall:"body-xs"},h$={"TEXT-D1":{type:N.HeadingXXL,weight:"bold"},"TEXT-D2":{type:N.HeadingXL,weight:"bold"},"TEXT-D3":{type:N.HeadingMD,weight:"bold"},"TEXT-D4":{type:N.HeadingSM,weight:"bold"},"TEXT-DBODY":{type:N.HeadingSM,weight:"light"},"TEXT-H1":{type:N.HeadingLG,weight:"bold"},"TEXT-H2":{type:N.HeadingMD,weight:"bold"},"TEXT-H3":{type:N.HeadingSM,weight:"bold"},"TEXT-H4":{type:N.HeadingXS,weight:"bold"},"TEXT-H5":{type:N.BodyMD,weight:"bold"},"TEXT-H6":{type:N.BodySM,weight:"bold"},"TEXT-BODY":{type:N.BodyBL,weight:"regular"},"TEXT-BODYSMALL":{type:N.BodyMD,weight:"regular"},"TEXT-XSMALL":{type:N.BodyXS,weight:"regular"}},m$={"HEADING-XXL":N.HeadingXXL,"HEADING-XL":N.HeadingXL,"HEADING-MD":N.HeadingMD,"HEADING-SM":N.HeadingSM,"HEADING-LG":N.HeadingLG,"HEADING-XS":N.HeadingXS,"BODY-MD":N.BodyMD,"BODY-SM":N.BodySM,"BODY-BL":N.BodyBL,"BODY-XS":N.BodyXS},g$={300:"light",400:"regular",500:"medium",700:"bold",900:"bold"},y$={"text-d1":"h1","text-d2":"h1","text-dbody":"h1","text-h1":"h1","text-h2":"h2","text-h3":"h3","text-h4":"h4","text-h5":"h5","text-h6":"h6","text-body":"p","text-bodysmall":"p","text-xsmall":"p"},_$=C(k.Small)`
|
|
337
337
|
padding: 0;
|
|
338
|
-
`;var v$;!function(e){e.ALERT="Alert",e["TEXT-D1"]="Text",e["TEXT-D2"]="Text",e["TEXT-DBODY"]="Text",e["TEXT-H1"]="Text",e["TEXT-H2"]="Text",e["TEXT-H3"]="Text",e["TEXT-H4"]="Text",e["TEXT-H5"]="Text",e["TEXT-H6"]="Text",e["TEXT-BODY"]="Text",e["TEXT-BODYSMALL"]="Text",e["TEXT-XSMALL"]="Text",e["HEADING-XXL"]="Text",e["HEADING-XL"]="Text",e["HEADING-MD"]="Text",e["HEADING-SM"]="Text",e["HEADING-LG"]="Text",e["HEADING-XS"]="Text",e["BODY-MD"]="Text",e["BODY-SM"]="Text",e["BODY-BL"]="Text",e["BODY-XS"]="Text",e.DIV="Wrapper",e.DIVIDER="Divider",e.SPAN="Wrapper",e.HEADER="Wrapper",e.FOOTER="Wrapper",e.H1="Wrapper",e.H2="Wrapper",e.H3="Wrapper",e.H4="Wrapper",e.H5="Wrapper",e.H6="Wrapper",e.P="Wrapper",e.GRID="Grid",e.TAB="Tab",e["TAB-ITEM"]="TabItem",e["LIST-ITEM"]="ListItem",e["ORDERED-LIST"]="List",e["UNORDERED-LIST"]="List",e.ACCORDION="Accordion",e.POPOVER="Popover"}(v$||(v$={}));var b$=Object.freeze({__proto__:null,Accordion:t=>{const{schema:n,id:r}=t,{children:i,button:a,title:o,disableContentInset:s,...u}=n,{dispatchFieldEvent:c}=BI();return e(Z,{id:r,title:"string"==typeof o?o:e(kB,{children:o}),...u,callToActionComponent:a?e(k.Default,{styleType:"light",type:"button",onClick:()=>c("accordion","edit",r),children:"object"==typeof a?a.label:"Edit"}):void 0,children:s?e(kB,{id:r,children:i}):e(c$,{children:e(kB,{id:r,children:i})})})},Alert:t=>{const{id:n,schema:{children:r,...a}}=t
|
|
338
|
+
`;var v$;!function(e){e.ALERT="Alert",e["TEXT-D1"]="Text",e["TEXT-D2"]="Text",e["TEXT-DBODY"]="Text",e["TEXT-H1"]="Text",e["TEXT-H2"]="Text",e["TEXT-H3"]="Text",e["TEXT-H4"]="Text",e["TEXT-H5"]="Text",e["TEXT-H6"]="Text",e["TEXT-BODY"]="Text",e["TEXT-BODYSMALL"]="Text",e["TEXT-XSMALL"]="Text",e["HEADING-XXL"]="Text",e["HEADING-XL"]="Text",e["HEADING-MD"]="Text",e["HEADING-SM"]="Text",e["HEADING-LG"]="Text",e["HEADING-XS"]="Text",e["BODY-MD"]="Text",e["BODY-SM"]="Text",e["BODY-BL"]="Text",e["BODY-XS"]="Text",e.DIV="Wrapper",e.DIVIDER="Divider",e.SPAN="Wrapper",e.HEADER="Wrapper",e.FOOTER="Wrapper",e.H1="Wrapper",e.H2="Wrapper",e.H3="Wrapper",e.H4="Wrapper",e.H5="Wrapper",e.H6="Wrapper",e.P="Wrapper",e.GRID="Grid",e.TAB="Tab",e["TAB-ITEM"]="TabItem",e["LIST-ITEM"]="ListItem",e["ORDERED-LIST"]="List",e["UNORDERED-LIST"]="List",e.ACCORDION="Accordion",e.POPOVER="Popover"}(v$||(v$={}));var b$=Object.freeze({__proto__:null,Accordion:t=>{const{schema:n,id:r}=t,{children:i,button:a,title:o,disableContentInset:s,...u}=n,{dispatchFieldEvent:c}=BI();return e(Z,{id:r,title:"string"==typeof o?o:e(kB,{children:o}),...u,callToActionComponent:a?e(k.Default,{styleType:"light",type:"button",onClick:()=>c("accordion","edit",r),children:"object"==typeof a?a.label:"Edit"}):void 0,children:s?e(kB,{id:r,children:i}):e(c$,{children:e(kB,{id:r,children:i})})})},Alert:t=>{const{id:n,schema:{children:r,...a}}=t,o=`${n}-content`;return e(P,{id:n,"data-testid":zE.generateId(n,"alert"),...a,children:"string"==typeof r?e(oI,{id:o,children:r}):i.isValidElement(r)||Array.isArray(r)||"number"==typeof r||"boolean"==typeof r||null==typeof r?r:e(kB,{children:r})})},Divider:t=>{const{id:n,schema:{verticalMargin:r,...i}}=t;return e(l$,{id:n,"data-testid":zE.generateId(n,"divider"),$verticalMargin:r,...i})},Grid:t=>{const{id:n,schema:{children:r,customOptions:i={gridType:"v2"},uiType:a,...o}}=t,s="v3"===i.gridType?d$:f$,u="v3"===i.gridType?"grid":"flex";return e(s,{type:u,"data-testid":zE.generateId(n,"grid"),...o,children:e(kB,{children:r})})},List:t=>{const{id:n,schema:{children:r,uiType:i,size:a,...o}}=t,s="ordered-list"===i?j.Ol:j.Ul;return e(s,{id:n,"data-testid":zE.generateId(n,i),size:(e=>e in p$)(a)?p$[a]:a,...o,children:r.map(((t,n)=>"string"==typeof t?e("li",{children:e(oI,{inline:!0,children:t})},n):e(kB,{children:t},n)))})},ListItem:t=>{const{id:n,schema:{children:r,uiType:i,showIf:a,columns:o,...s}}=t;return e("li",{id:n,...s,children:"string"==typeof r?e(oI,{inline:!0,children:r}):e(kB,{children:r})})},Popover:t=>{const{id:n,schema:{children:r,className:i,icon:a,hint:{content:o,...s},...u}}=t;return e(V,{id:n,"data-testid":zE.generateId(n,"popover"),className:i,icon:(()=>{if(!a)return null;const t=G[a];return e(t,{})})(),content:r&&e(oI,{inline:!0,children:r}),popoverContent:(()=>{const t={allowedTags:aI.defaults.allowedTags.concat(["img"]),allowedAttributes:!1};return"string"==typeof o?e(oI,{inline:!0,sanitizeOptions:t,children:o}):e(kB,{children:o})})(),...s,...u})},Tab:t=>{const{id:n,schema:{currentActiveTabId:r,children:i,...a}}=t,[s,c]=o(m()),{removeFieldValidationConfig:l}=n$(),{unregister:d}=Ye(),{dispatchFieldEvent:f}=BI(),p=Object.keys(i);u((()=>{c(m())}),[r]),Us((()=>{Object.values(i).forEach(((e,t)=>{if(t===s)return;g(e).forEach((e=>{l(e),d(e)}))}))}),[s,i]);function m(){const e=Object.keys(i).findIndex((e=>e===r));return e<0?0:e}const g=e=>{const t=e.children,n=[];return $E(t)||!Dn(t)||Object.entries(t).forEach((([e,t])=>{n.push(e),"chips"===t.uiType&&n.push(e+"-textarea"),t.children&&n.push(...g(t))})),n};return e(H,{...a,id:n,"data-testid":zE.generateId(n,"tab"),currentActive:s,onTabClick:(e,t)=>{t!==s&&(c(t),f("change",n,{previousTabId:p[s],currentTabId:p[t]}))},children:Object.entries(i).map((([t,n])=>{const{title:r,children:i,...a}=n;return h(H.Item,{...a,key:t,id:t,"data-testid":zE.generateId(t,"tab-item"),title:r},e(kB,{children:i}))}))})},Text:r=>{const{id:i,schema:{children:a,uiType:c,maxLines:l,weight:d,...f}}=r,p=s(null),[h,m]=o(!1),[g,y]=o(!1),_=h$[c.toUpperCase()]?.type||m$[c.toUpperCase()]||void 0,v=y$[c]||void 0;u((()=>{if(m(!l),y(l>0),!l||!p.current)return;const e=p.current.clientHeight,t=p.current.scrollHeight;y(t-e>1)}),[a,l]);const b=e=>zE.generateId(e,"text"),E=()=>{const e=hi(a)&&a.length>1,t=Dn(a)&&Object.keys(a).length>1;return e||t},A={allowedTags:aI.defaults.allowedTags.concat(["img"]),allowedAttributes:!1};return t(n,{children:[e(_,{id:i,ref:p,maxLines:h?void 0:l,"data-testid":b(i),weight:d?NI(d)?g$[d]:d:c.toUpperCase()in h$?h$[c.toUpperCase()].weight:void 0,...f,...v&&!E()&&{as:v},...E()&&{as:"div"},children:hi(a)?a.map(((t,n)=>{const r=`${i}-${n}`,a=`${r}-content`;return e(_,{id:r,"data-testid":b(r),children:e(oI,{id:a,inline:!0,sanitizeOptions:A,children:t})},n)})):"object"==typeof a?e(kB,{children:a}):e(oI,{inline:!0,sanitizeOptions:A,children:a})}),g&&e(_$,{styleType:"link",onClick:()=>m(!h),children:h?"View less":"View more"})]})},get EElementType(){return v$}});const E$=m((({onChange:t,formValues:n,schema:r,error:i},a)=>{const c=s(null),l=s(void 0),d=s(null),{customComponents:p}=ZI(),[h,m]=o({}),[y,_]=o(),{isSubmitting:v,isDirty:b}=tt(),{formSchema:{restoreMode:E,revalidationMode:A,validationMode:S,stripUnknown:w}}=e$(),x=o$(b);g(a,(()=>c.current)),u((()=>{b||void 0===x||x===b||c.current?.reset()}),[b]),u((()=>{b?TI(n,h)||n&&Object.entries(n).forEach((([e,t])=>{c.current?.setValue(e,t)})):_(n)}),[n]),u((()=>{v&&c.current?.validate()}),[v]),u((()=>{l.current=i,i?c.current?.setErrors(i):c.current?.clearErrors()}),[i]);const T=f((()=>{l.current&&setTimeout((()=>{l.current&&c.current?.setErrors(l.current)}),0)}),[]);return e("div",{ref:d,onBlurCapture:T,children:e(UB,{ref:c,data:{sections:{section:{uiType:"section",children:r}},defaultValues:y,restoreMode:E,revalidationMode:A,validationMode:S,stripUnknown:w},onValueChange:(e,n=!1)=>{(b||void 0===x||x===b)&&(m(e),t(e,n))},wrapInForm:!1,components:p})})})),A$=C.div`
|
|
339
339
|
${({$inset:e})=>e&&`\n\tpadding-left: ${e};\n\tpadding-right: ${e};\n\t`}
|
|
340
340
|
|
|
341
341
|
&:not(:last-child) {
|
|
@@ -416,7 +416,7 @@ function HO(e){return"[object Object]"===Object.prototype.toString.call(e)}Objec
|
|
|
416
416
|
margin: 0;
|
|
417
417
|
padding: 0;
|
|
418
418
|
}
|
|
419
|
-
`,pR=({Field:t,id:n,schema:r,warning:i})=>{const{control:a,setValue:o}=Ye(),{formSchema:{defaultValues:c,restoreMode:l="none"}}=e$(),{getField:d,setField:f,setRegisteredFields:p}=t$(),{removeFieldValidationConfig:h}=n$(),m=s(l);u((()=>{m.current=l}),[l]),UI((()=>(o(n,d(n)),p((e=>[...e,n])),()=>{switch(m.current){case"default-value":f(n,c?.[n]);break;case"none":{const e=d(n);hi(e)?f(n,[]):L$(e)?f(n,""):(NI(e)||wI(e))&&f(n,void 0);break}}p((e=>e.filter((e=>e!==n)))),h(n)})),[]);const g=(t,n)=>{const r=n.label;return"string"==typeof r?{children:e(oI,{inline:!0,children:r})}:r&&"object"==typeof r&&r.mainLabel?{children:e(oI,{inline:!0,children:r.mainLabel}),subtitle:e(hR,{className:"sub-label",children:r.subLabel}),addon:r.hint?.content?{type:"popover",content:e(mR,{className:"label-hint",children:r.hint?.content}),"data-testid":(n["data-testid"]||t)+"-popover",zIndex:r.hint?.zIndex}:void 0}:void 0};return e(at,{control:a,name:n,shouldUnregister:!0,render:({field:a,fieldState:o})=>{const{ref:s,...u}=a,c={...u,id:n,formattedLabel:g(n,r),value:d(n),warning:i};return e(t,{schema:r,...c,...o})}})},hR=C(oI)`
|
|
419
|
+
`,pR=({Field:t,id:n,schema:r,warning:i})=>{const{control:a,setValue:o}=Ye(),{formSchema:{defaultValues:c,restoreMode:l="none"}}=e$(),{getField:d,setField:f,setRegisteredFields:p}=t$(),{removeFieldValidationConfig:h}=n$(),m=s(l);u((()=>{m.current=l}),[l]),UI((()=>(o(n,d(n)),p((e=>[...e,n])),()=>{switch(m.current){case"default-value":f(n,c?.[n]);break;case"none":{const e=d(n);hi(e)?f(n,[]):L$(e)?f(n,""):(NI(e)||wI(e))&&f(n,void 0);break}}p((e=>e.filter((e=>e!==n)))),h(n)})),[]);const g=(t,n)=>{const r=n.label;return"string"==typeof r?{children:e(oI,{inline:!0,children:r})}:r&&"object"==typeof r&&r.mainLabel?{children:e(oI,{inline:!0,children:r.mainLabel}),subtitle:e(hR,{className:"sub-label",id:`${t}-label-subtitle`,children:r.subLabel}),addon:r.hint?.content?{type:"popover",content:e(mR,{className:"label-hint",children:r.hint?.content}),"data-testid":(n["data-testid"]||t)+"-popover",zIndex:r.hint?.zIndex}:void 0}:void 0};return e(at,{control:a,name:n,shouldUnregister:!0,render:({field:a,fieldState:o})=>{const{ref:s,...u}=a,c={...u,id:n,formattedLabel:g(n,r),value:d(n),warning:i};return e(t,{schema:r,...c,...o})}})},hR=C(oI)`
|
|
420
420
|
&.sub-label {
|
|
421
421
|
display: block;
|
|
422
422
|
${M["body-md-regular"]};
|
|
@@ -478,7 +478,7 @@ function HO(e){return"[object Object]"===Object.prototype.toString.call(e)}Objec
|
|
|
478
478
|
cursor: pointer;
|
|
479
479
|
`,$P=C(P)`
|
|
480
480
|
margin-top: ${S["spacing-8"]};
|
|
481
|
-
`;var RP=pi,zP=hi,PP=vn?vn.isConcatSpreadable:void 0;var FP=Ca,ZP=function(e){return zP(e)||RP(e)||!!(PP&&e&&e[PP])};var UP=function e(t,n,r,i,a){var o=-1,s=t.length;for(r||(r=ZP),a||(a=[]);++o<s;){var u=t[o];n>0&&r(u)?n>1?e(u,n-1,r,i,a):FP(a,u):i||(a[a.length]=u)}return a};var BP=Qa,jP=function(){},VP=BP&&1/sS(new BP([,-0]))[1]==1/0?function(e){return new BP(e)}:jP,GP=QA,HP=q$,YP=K$,WP=tS,qP=VP,KP=sS;var JP=function(e,t,n){var r=-1,i=HP,a=e.length,o=!0,s=[],u=s;if(n)o=!1,i=YP;else if(a>=200){var c=t?null:qP(e);if(c)return KP(c);o=!1,i=WP,u=new GP}else u=t?[]:s;e:for(;++r<a;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,o&&d==d){for(var f=u.length;f--;)if(u[f]===d)continue e;t&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s},XP=rR,QP=UP,eF=JP;var tF=function(e,t,n){var r=e.length;if(r<2)return r?eF(e[0]):[];for(var i=-1,a=Array(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=XP(a[i]||o,e[s],t,n));return eF(QP(a,1),t,n)},nF=va,rF=tF,iF=WI,aF=Bk((function(e){return rF(nF(e,iF))}));const oF=a({files:[],setFiles:()=>null,currentFileIds:[],setCurrentFileIds:()=>null}),sF=({children:t})=>{const[n,r]=o([]),[i,a]=o([]),s=l((()=>({files:n,setFiles:r,currentFileIds:i,setCurrentFileIds:a})),[n,i]);return e(oF.Provider,{value:s,children:t})};var uF,cF;!function(e){e.findAvailableSlot=e=>{const t=e.reduce(((e,{slot:t})=>t>e?t:e),0),n=Math.max(t,e.length),r=Array(n).fill(0).map(((e,t)=>t)),i=e.map((({slot:e})=>e));return r.filter((e=>!i.includes(e)))[0]??n}}(uF||(uF={})),function(e){e[e.INJECTED=-99]="INJECTED",e[e.INJECTING=-98]="INJECTING",e[e.TO_DELETE=-4]="TO_DELETE",e[e.ERROR_FORMAT=-3]="ERROR_FORMAT",e[e.ERROR_GENERIC=-2]="ERROR_GENERIC",e[e.ERROR_SIZE=-1]="ERROR_SIZE",e[e.NONE=0]="NONE",e[e.UPLOAD_READY=4]="UPLOAD_READY",e[e.UPLOADING=5]="UPLOADING",e[e.UPLOADED=6]="UPLOADED"}(cF||(cF={}));const lF=_((()=>import("./file-upload-manager.
|
|
481
|
+
`;var RP=pi,zP=hi,PP=vn?vn.isConcatSpreadable:void 0;var FP=Ca,ZP=function(e){return zP(e)||RP(e)||!!(PP&&e&&e[PP])};var UP=function e(t,n,r,i,a){var o=-1,s=t.length;for(r||(r=ZP),a||(a=[]);++o<s;){var u=t[o];n>0&&r(u)?n>1?e(u,n-1,r,i,a):FP(a,u):i||(a[a.length]=u)}return a};var BP=Qa,jP=function(){},VP=BP&&1/sS(new BP([,-0]))[1]==1/0?function(e){return new BP(e)}:jP,GP=QA,HP=q$,YP=K$,WP=tS,qP=VP,KP=sS;var JP=function(e,t,n){var r=-1,i=HP,a=e.length,o=!0,s=[],u=s;if(n)o=!1,i=YP;else if(a>=200){var c=t?null:qP(e);if(c)return KP(c);o=!1,i=WP,u=new GP}else u=t?[]:s;e:for(;++r<a;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,o&&d==d){for(var f=u.length;f--;)if(u[f]===d)continue e;t&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s},XP=rR,QP=UP,eF=JP;var tF=function(e,t,n){var r=e.length;if(r<2)return r?eF(e[0]):[];for(var i=-1,a=Array(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=XP(a[i]||o,e[s],t,n));return eF(QP(a,1),t,n)},nF=va,rF=tF,iF=WI,aF=Bk((function(e){return rF(nF(e,iF))}));const oF=a({files:[],setFiles:()=>null,currentFileIds:[],setCurrentFileIds:()=>null}),sF=({children:t})=>{const[n,r]=o([]),[i,a]=o([]),s=l((()=>({files:n,setFiles:r,currentFileIds:i,setCurrentFileIds:a})),[n,i]);return e(oF.Provider,{value:s,children:t})};var uF,cF;!function(e){e.findAvailableSlot=e=>{const t=e.reduce(((e,{slot:t})=>t>e?t:e),0),n=Math.max(t,e.length),r=Array(n).fill(0).map(((e,t)=>t)),i=e.map((({slot:e})=>e));return r.filter((e=>!i.includes(e)))[0]??n}}(uF||(uF={})),function(e){e[e.INJECTED=-99]="INJECTED",e[e.INJECTING=-98]="INJECTING",e[e.TO_DELETE=-4]="TO_DELETE",e[e.ERROR_FORMAT=-3]="ERROR_FORMAT",e[e.ERROR_GENERIC=-2]="ERROR_GENERIC",e[e.ERROR_SIZE=-1]="ERROR_SIZE",e[e.NONE=0]="NONE",e[e.UPLOAD_READY=4]="UPLOAD_READY",e[e.UPLOADING=5]="UPLOADING",e[e.UPLOADED=6]="UPLOADED"}(cF||(cF={}));const lF=_((()=>import("./file-upload-manager.581859a5.js"))),dF=r=>{const{id:i,error:a,isDirty:c,isTouched:l,value:p,schema:{compressImages:h,description:m,hideThumbnail:g,label:y,uploadOnAddingFile:_,validation:b,warning:E,...A},warning:S}=r,{files:w,currentFileIds:x,setFiles:T}=d(oF),M=s({}),O=s({}),N=s({}),C=s({}),D=s({}),{setFieldValidationConfig:L}=n$(),{dispatchFieldEvent:I}=BI(),{clearErrors:k,setError:$}=Ye(),[R,z]=o(),P=s(w),F=f(((e,t)=>{const n=[...t],r=n.length;e.forEach(((e,t)=>{!N.current.max||r+t<N.current.max?(n.push({...e,slot:uF.findAvailableSlot(n)}),k(i)):$(i,{type:"max",message:N.current.errorMessage||Nm.UPLOAD().MAX_FILES(N.current.max)})})),T(n)}),[k,i,$,T]);u((()=>{P.current=w}),[w]),u((()=>{I("mount",i)}),[I,i]),u((()=>{const e=b?.find((e=>"required"in e)),t=b?.find((e=>"fileType"in e)),n=b?.find((e=>"fileExtension"in e)),r=b?.find((e=>"maxSizeInKb"in e)),a=b?.find((e=>"upload"in e&&e.upload));M.current=t?.fileType?t:{},O.current=t?.fileType&&n?.fileExtension?n:{},C.current=r?.maxSizeInKb>0?r:{},D.current=a||{};const o=b?.find((e=>"length"in e)),s=b?.find((e=>"max"in e));N.current=o?{max:o.length,errorMessage:o.errorMessage}:s?{max:s.max,errorMessage:s.errorMessage}:{},L(i,xT().of(ST().shape({dataURL:ux(),fileId:ux(),fileName:ux(),fileUrl:ux(),uploadResponse:ST()})).test("is-empty-array",e?.errorMessage||Nm.UPLOAD().REQUIRED,(t=>!t||!e?.required||t.length>0)).test("max-size-in-kb",C.current.errorMessage||Nm.UPLOAD().MAX_FILE_SIZE(C.current.maxSizeInKb),(e=>!(e&&Array.isArray(e)&&C.current.maxSizeInKb)||w.filter((e=>e.status===cF.UPLOADED)).every((e=>{if("base64"===_.type&&e.dataURL)return Om.getFilesizeFromBase64(e.dataURL)<=1024*C.current.maxSizeInKb;if("multipart"===_.type){const t=e.uploadResponse?.data||e.uploadResponse;let n=e.rawFile?.size||t?.fileSize;return isNaN(n)&&(n=0),n<=1024*C.current.maxSizeInKb}})))).test("max-files",N.current.errorMessage||Nm.UPLOAD().MAX_FILES(N.current.max),(e=>!(e&&Array.isArray(e)&&N.current.max)||e.length<=N.current.max)).test("no-interim-statuses",Nm.UPLOAD().UPLOADING,(()=>{const e=new Set([cF.INJECTED,cF.INJECTING,cF.NONE,cF.UPLOAD_READY,cF.UPLOADING]);return!P.current.some((t=>e.has(t.status)))})),b)}),[b,w.map((e=>e.status)).join(",")]),u((()=>{if(!c&&!l){const e=Array.isArray(p)?p:[];if(!(aF(e.map((({fileId:e})=>e)),x).length>0))return;const t=[];e.forEach((({dataURL:e,fileId:n,fileName:r,fileUrl:i,uploadResponse:a})=>{t.push({addedFrom:"schema",dataURL:e,fileItem:{id:n},uploadResponse:a,fileUrl:i,rawFile:{name:r},slot:null,status:cF.INJECTED})})),F(t,[])}}),[F,c,l,x,p]),u((()=>{if(a?.message)try{const{message:e,fileErrors:t}=JSON.parse(a.message);t&&T(P.current.map((e=>{const n=t[e.fileItem.id];return n?{...e,fileItem:{...e.fileItem,errorMessage:n}}:e}))),e&&z(e)}catch(e){z(a.message)}else z(void 0)}),[a?.message,T]);const Z=t=>t?e(oI,{children:t}):null;return t(n,{children:[e(v,{fallback:null,children:e(lF,{compressImages:!!h,fileTypeRule:M.current,fileExtensionRule:O.current,hideThumbnail:g,id:i,maxFileSizeRule:C.current,upload:_,uploadRule:D.current,value:p})}),e(ne,{...A,accept:M.current.fileType?.map((e=>`.${e}`)).join(","),description:Z(m),errorMessage:Z(R),fileItems:w.filter((({fileItem:e,status:t})=>!!e&&t!==cF.INJECTED&&t!==cF.INJECTING)).map((({fileItem:e})=>e)),id:i,maxFiles:N.current.max,onChange:e=>{F(e.map((e=>({addedFrom:"input",rawFile:e,slot:null,status:cF.NONE}))),w)},onDelete:e=>{T(w.map((t=>t.fileItem.id!==e.id?t:{...t,status:cF.TO_DELETE}))),k(i)},title:Z(y),warning:Z(S||E)})]})},fF=a({images:[],setImages:()=>null,errorCount:0,setErrorCount:()=>null,currentFileIds:[],setCurrentFileIds:()=>null}),pF=({children:t})=>{const[n,r]=o([]),[i,a]=o(0),[s,u]=o([]);return e(fF.Provider,{value:{images:n,setImages:r,errorCount:i,setErrorCount:a,currentFileIds:s,setCurrentFileIds:u},children:t})};var hF;!function(e){e.findAvailableSlot=e=>{const t=e.reduce(((e,{slot:t})=>t>e?t:e),0),n=Math.max(t,e.length),r=Array(n).fill(0).map(((e,t)=>t)),i=e.map((({slot:e})=>e));return r.filter((e=>!i.includes(e)))[0]??n}}(hF||(hF={}));const mF=["jpg","gif","png","heic","heif","webp"];var gF;!function(e){e[e.INJECTED=-99]="INJECTED",e[e.ERROR_FILENAME=-8]="ERROR_FILENAME",e[e.ERROR_CUSTOM_MUTED=-7]="ERROR_CUSTOM_MUTED",e[e.ERROR_EXCEED=-6]="ERROR_EXCEED",e[e.ERROR_CUSTOM=-5]="ERROR_CUSTOM",e[e.TO_DELETE=-4]="TO_DELETE",e[e.ERROR_FORMAT=-3]="ERROR_FORMAT",e[e.ERROR_GENERIC=-2]="ERROR_GENERIC",e[e.ERROR_SIZE=-1]="ERROR_SIZE",e[e.NONE=0]="NONE",e[e.TO_RECOMPRESS=1]="TO_RECOMPRESS",e[e.COMPRESSED=2]="COMPRESSED",e[e.RECOMPRESSED=2]="RECOMPRESSED",e[e.CONVERTED=2]="CONVERTED",e[e.EDITED=3]="EDITED",e[e.UPLOAD_READY=4]="UPLOAD_READY",e[e.UPLOADING=5]="UPLOADING",e[e.UPLOADED=6]="UPLOADED",e[e.PENDING=7]="PENDING"}(gF||(gF={}));var yF,_F={exports:{}},vF={exports:{}},bF={};var EF,AF,SF,wF,xF,TF,MF,OF,NF,CF,DF,LF,IF,kF,$F={};
|
|
482
482
|
/** @license React v16.13.1
|
|
483
483
|
* react-is.development.js
|
|
484
484
|
*
|
|
@@ -1011,7 +1011,7 @@ object-assign
|
|
|
1011
1011
|
stroke: ${E["icon-primary"]};
|
|
1012
1012
|
stroke-width: 1;
|
|
1013
1013
|
}
|
|
1014
|
-
`,nB=r=>{const{accepts:i,activeFileIndex:a,capture:o,id:u="image-thumbnails",images:c,maxFiles:l,onClickThumbnail:d,onSelectFile:f,multiple:p}=r,h=s(null),m=async e=>{const t=Array.from(e.target.files||[]);t.length&&setTimeout((()=>{f(t)}),100)},g=()=>h?.current?.click();return t(YU,{id:zE.generateId(u),children:[c.map(((n,r)=>n.status===gF.NONE?e(XU,{children:[...Array(4)].map(((t,n)=>e(JU,{},`dot-${n}`)))},r):n.status>gF.NONE||n.status===gF.ERROR_CUSTOM_MUTED?e(WU,{id:zE.generateId(u,`item-${r+1}`),"data-testid":zE.generateId(u,`item-${r+1}`),src:n.thumbnailDataURL||n.dataURL||"https://assets.life.gov.sg/web-frontend-engine/img/icons/photo-placeholder-add.svg",type:"button","aria-label":`thumbnail of ${n.name}`,onClick:()=>d(r),children:e(QU,{isSelected:a===r})},r):"reviewModal"===n.addedFrom||n.status<gF.NONE?t(WU,{id:zE.generateId(u,`item-${r+1}`),"data-testid":zE.generateId(u,`item-${r+1}`),type:"button","aria-label":`error with ${n.name}`,onClick:()=>d(r),error:!0,children:[e(QU,{isSelected:a===r}),e(qU,{})]},r):void 0)),(c.filter((({status:e,addedFrom:t})=>e>=gF.NONE||e===gF.ERROR_CUSTOM_MUTED||"reviewModal"===t)).length<l||!l)&&t(n,{children:[e(eB,{id:zE.generateId(u,"file-input"),"data-testid":zE.generateId(u,"file-input"),type:"file","aria-hidden":"true",tabIndex:-1,capture:o,ref:h,accept:i.map((e=>`.${e}`)).join(", "),onChange:m,multiple:p,value:""}),e(tB,{type:"button",id:zE.generateId(u,"add-image-button"),"data-testid":zE.generateId(u,"add-image-button"),"aria-label":"add image",styleType:"secondary",onClick:g,children:e(ce,{})})]})]})},rB=_((()=>import("./index.93ef32cd.js"))),iB=[{color:"#282828",label:"black"},{color:"#FFF",colorScheme:"light",label:"white"},{color:"#017cd3",label:"blue"},{color:"#fb0101",label:"red"},{color:"#22910c",label:"green"},{color:"#f8e821",label:"yellow"}],aB=r=>{const{accepts:i,capture:a,className:c,compress:l,dimensions:p,id:h="image-review",maxFiles:m,maxSizeInKb:g,onExit:y,outputType:_,show:b,multiple:E,maxFilesErrorMessage:A,imageReviewModalStyles:S}=r,{images:w,setImages:x}=d(fF),{dispatchFieldEvent:T,addFieldEventListener:M,removeFieldEventListener:O}=BI(),N=o$(b),[C,D]=o(w.length-1),[L,I]=o(!1),[k,R]=o(),z=!!w?.find((({status:e})=>e===gF.NONE)),[P,F]=o(iB[0].color),[Z,U]=o(!1),B=s(null),j=!!w?.find((({addedFrom:e,status:t})=>"reviewModal"===e&&t<=gF.NONE))||!w.length,V=f((e=>{e.detail.removePendingImages&&x((e=>e.filter((({status:e})=>e===gF.UPLOADED||e===gF.ERROR_CUSTOM_MUTED)))),y()}),[y,x]),G=e=>{!m||e.length+w.filter((({status:e,addedFrom:t})=>e>=gF.NONE||"reviewModal"===t)).length<=m?e.forEach((e=>{x((t=>{const n=hF.findAvailableSlot(t);return[...t,{id:Lm(),file:e,name:e.name,dimensions:p,status:gF.NONE,uploadProgress:0,addedFrom:"reviewModal",slot:n}]}))})):x((t=>{const n=hF.findAvailableSlot(t);return[...t,{id:Lm(),file:e[0],name:e[0].name,dimensions:p,status:gF.ERROR_EXCEED,uploadProgress:0,addedFrom:"reviewModal",slot:n}]}))},H=e=>{e&&(x((e=>e.map(((e,t)=>({...e,...t===C?{status:gF.TO_DELETE}:{}}))))),D(Math.max(0,C-1))),R(null)},Y=f((()=>{x((e=>e.filter((({status:e})=>e>=gF.NONE||e===gF.ERROR_CUSTOM_MUTED)).map((e=>{const t={...e};return e.drawingDataURL&&(t.dataURL=e.drawingDataURL),e.status<gF.UPLOAD_READY&&e.status>gF.NONE&&(t.status=gF.UPLOAD_READY),t.drawingDataURL=void 0,t.drawing=void 0,t}))))}),[x]),W=()=>{!T("save-review-images",h,{images:w,retry:W})||(Y(),y())},q=()=>{I(!0),F(iB[0].color)},K=async()=>{const{dataURL:e,drawing:t}=B.current?.export()||{},n=await yE.dataUrlToImage(e),r=await yE.resampleImage(n,{scale:96/n.width,type:Om.fileExtensionToMimeType(_)}),i=await Om.fileToDataUrl(r);x((n=>{const r=[...n];return r[C]={...r[C],thumbnailDataURL:i,drawingDataURL:e,drawing:t,status:l?gF.TO_RECOMPRESS:gF.EDITED},r})),I(!1),X()},J=()=>{X(),U(!0)},X=()=>{F(""),U(!1)};u((()=>{const e={"trigger-save-review-images":Y,"dismiss-review-modal":V};return Object.entries(e).forEach((([e,t])=>{M(e,h,t)})),()=>{Object.entries(e).forEach((([e,t])=>{O(e,h,t)}))}}),[M,V,Y,h,O]),u((()=>{D(w.length-1)}),[w.length]),u((()=>{b?T("show-review-modal",h):N&&T("hide-review-modal",h)}),[b]);return e($,{id:zE.generateId(h,void 0,b?"show":"hide"),className:c?`${c}-review`:void 0,show:b,children:e(TU,{className:c?`${c}-review-modal-box`:void 0,imageReviewModalStyles:S,showCloseButton:!1,children:b?t(n,{children:[e(MU,{className:c?`${c}-header`:void 0,$drawActive:L,children:t(n,L?{children:[e(DU,{id:zE.generateId(h,"clear-drawing-button"),"data-testid":zE.generateId(h,"clear-drawing-button"),onClick:()=>R("clear-drawing"),children:"Clear"}),e(DU,{id:zE.generateId(h,"save-drawing"),"data-testid":zE.generateId(h,"save-drawing"),onClick:K,children:"Save"})]}:{children:[e(OU,{id:zE.generateId(h,"close-button"),"data-testid":zE.generateId(h,"close-button"),"aria-label":"exit review modal",onClick:()=>R("exit"),children:e(re,{type:"cross"})}),e(NU,{weight:"semibold",children:"Review photos"})]})}),t(LU,{children:[w.length>0&&e(FU,{className:c?`${c}-editor`:void 0,children:e(v,{fallback:null,children:e(rB,{baseImageDataURL:w[C]?.dataURL,drawing:w[C]?.drawing,color:L?P:void 0,erase:!!L&&Z,ref:B,maxSizeInKb:g})})}),w.length>0&&e(IU,{children:"Loading Preview..."}),!L&&w[C]?.status>=gF.NONE&&t(kU,{children:[t($U,{id:zE.generateId(h,"draw-button"),"data-testid":zE.generateId(h,"draw-button"),onClick:q,disabled:z,children:[e(zU,{$disabled:z}),e(RU,{weight:"semibold",$disabled:z,children:"Draw"})]}),t($U,{id:zE.generateId(h,"delete-button"),"data-testid":zE.generateId(h,"delete-button"),onClick:()=>R("delete"),disabled:z,children:[e(PU,{$disabled:z}),e(RU,{weight:"semibold",$disabled:z,children:"Delete"})]})]}),w[C]?.status<gF.NONE&&e(wU,{id:`${h}-photo-error`,image:w[C],accepts:i,maxSizeInKb:g,onClickOk:()=>H(!0),maxFilesErrorMessage:A,maxFiles:m})]}),e(ZU,{className:c?`${c}-footer`:void 0,children:t(n,L?{children:[e(BU,{id:zE.generateId(h,"eraser-button"),"data-testid":zE.generateId(h,"eraser-button"),"aria-label":"eraser",onClick:J,children:e(jU,{$eraseMode:Z})}),e(GU,{children:iB.map((({color:t,colorScheme:n,label:r},i)=>e(HU,{id:zE.generateId(h,`palette-color-${i}`),"aria-label":`${r} brush`,$color:t,$colorScheme:n,onClick:()=>(e=>{X(),F(e)})(t),children:P===t&&e(VU,{$colorScheme:n})},t)))})]}:{children:[e(nB,{id:`${h}-image-thumbnails`,activeFileIndex:C,accepts:i,capture:a,maxFiles:m,images:w,onClickThumbnail:D,onSelectFile:G,multiple:E}),e(UU,{id:zE.generateId(h,"save-button"),"data-testid":zE.generateId(h,"save-button"),onClick:W,disabled:j,children:"Save"})]})}),e(xU,{images:w,show:k,onDecideClearDrawing:e=>{e&&B.current.clearDrawing(),R(null)},onDecideDelete:H,onDecideExit:e=>{e&&(x(w.filter((({addedFrom:e,status:t})=>t>=gF.UPLOADED||t<gF.NONE&&"dragInput"===e)).map((e=>({...e,drawingDataURL:void 0,drawing:void 0})))),y()),R(null)}})]}):e(n,{})})})},oB=_((()=>import("./index.2f7eb734.js"))),sB=r=>{const{schema:{buttonLabel:i,capture:a,className:s,compress:c,crop:l,description:f,dimensions:p={width:1e3,height:1e3},editImage:h,label:m,outputType:g="jpg",uploadOnAddingFile:y,validation:_,multiple:b,imageReviewModalStyles:E,tooltip:A},id:S,isDirty:w,isTouched:x,value:T,warning:M,...O}=r,{images:N,setImages:C,currentFileIds:D}=d(fF),L=o$(N),[I,k]=o([...mF]),[$,R]=o(0),[z,P]=o(0),[F,Z]=o(!1),[U,B]=o(!1),{setFieldValidationConfig:j}=n$(),{dispatchFieldEvent:V}=BI(),G=u$();u((()=>{V("mount",S)}),[V,S]),u((()=>{if(!w&&!x){const e=Array.isArray(T)?T:[];if(!(aF(e.map((({fileId:e})=>e)),D).length>0))return;const t=[];e.forEach((({fileId:e,fileName:n,dataURL:r,uploadResponse:i},a)=>{const o={id:e||Lm(),file:{},name:n,dimensions:{width:10,height:10},dataURL:r,status:gF.INJECTED,addedFrom:"schema",uploadProgress:100,slot:a,uploadResponse:i};t.push(o)})),C(t)}}),[w,x,D,C,T]),u((()=>{const e=_?.find((e=>"required"in e)),t=_?.find((e=>"fileType"in e)),n=_?.find((e=>"maxSizeInKb"in e));t?.fileType&&t?.fileType!==I&&k(t?.fileType),n?.maxSizeInKb&&n?.maxSizeInKb!==z&&P(n?.maxSizeInKb);const r=_?.find((e=>"length"in e)),i=_?.find((e=>"max"in e));let a;r?a={maxFiles:r.length,errorMessage:r.errorMessage}:i&&(a={maxFiles:i.max,errorMessage:i.errorMessage}),a?.maxFiles&&$!==a.maxFiles&&R(a.maxFiles),j(S,xT().of(ST().shape({fileName:ux(),dataURL:ux()})).test("is-empty-array",e?.errorMessage||Nm.UPLOAD("photo").REQUIRED,(t=>!t||!e?.required||t.length>0)).test("max-size-in-kb",n?.errorMessage||Nm.UPLOAD("photo").MAX_FILE_SIZE(n?.maxSizeInKb),(e=>!(e&&Array.isArray(e)&&n?.maxSizeInKb)||e.every((e=>Om.getFilesizeFromBase64(e.dataURL)<=1024*n?.maxSizeInKb)))),_)}),[_]),u((()=>{N.some((e=>e.status===gF.NONE))||(N.some(((e,t)=>{const n=L?.[t];if(e.status!==n?.status||e.dataURL!==n.dataURL)switch(e.status){case gF.COMPRESSED:case gF.CONVERTED:if(h&&!U)return G()?B(!0):Z(!0),!0}})),0===N.length&&B(!1))}),[N.map((e=>e.status)).join(","),N.map((e=>e.dataURL)).join(",")]);const H=(e=!1)=>{e?h&&(document.body.classList.remove("lifesg-ds-overlay-open"),B(!0)):C((e=>e.map((e=>e.status<gF.UPLOAD_READY&&e.status>gF.NONE?{...e,status:gF.UPLOAD_READY}:e)))),Z(!1)};return t(n,{children:[e(v,{fallback:null,children:e(oB,{accepts:I,compress:!!c,crop:!!l,dimensions:p,editImage:h,id:S,maxSizeInKb:z,outputType:g,upload:y,filenameMatches:_?.find((e=>"matches"in e))?.matches,filenameMatchesErrorMessage:_?.find((e=>"matches"in e))?.errorMessage,value:T})}),e(gU,{id:S,capture:a,className:s,label:m,description:f,buttonLabel:i,accepts:I,maxFiles:$,maxSizeInKb:z,dimensions:p,errorMessage:O.error?.message,validation:_,multiple:b,warning:M,tooltip:A}),e(BT,{id:`${S}-review-prompt`,title:"Review photos?",size:"large",show:F,description:"This lets you check if you've selected the correct photos, and draw on them to highlight the issue.",buttons:[{id:"ok",title:"Ok",onClick:()=>H(!0)},{id:"skip",title:"Skip",buttonStyle:"secondary",onClick:()=>H()}]}),(()=>{const t=_?.find((e=>"max"in e));return e(aB,{accepts:I,dimensions:p,id:S,className:s,maxFiles:$,maxFilesErrorMessage:t?.errorMessage,maxSizeInKb:z,onExit:()=>B(!1),outputType:g,show:U,multiple:b,capture:a,imageReviewModalStyles:E})})()]})},uB=D`
|
|
1014
|
+
`,nB=r=>{const{accepts:i,activeFileIndex:a,capture:o,id:u="image-thumbnails",images:c,maxFiles:l,onClickThumbnail:d,onSelectFile:f,multiple:p}=r,h=s(null),m=async e=>{const t=Array.from(e.target.files||[]);t.length&&setTimeout((()=>{f(t)}),100)},g=()=>h?.current?.click();return t(YU,{id:zE.generateId(u),children:[c.map(((n,r)=>n.status===gF.NONE?e(XU,{children:[...Array(4)].map(((t,n)=>e(JU,{},`dot-${n}`)))},r):n.status>gF.NONE||n.status===gF.ERROR_CUSTOM_MUTED?e(WU,{id:zE.generateId(u,`item-${r+1}`),"data-testid":zE.generateId(u,`item-${r+1}`),src:n.thumbnailDataURL||n.dataURL||"https://assets.life.gov.sg/web-frontend-engine/img/icons/photo-placeholder-add.svg",type:"button","aria-label":`thumbnail of ${n.name}`,onClick:()=>d(r),children:e(QU,{isSelected:a===r})},r):"reviewModal"===n.addedFrom||n.status<gF.NONE?t(WU,{id:zE.generateId(u,`item-${r+1}`),"data-testid":zE.generateId(u,`item-${r+1}`),type:"button","aria-label":`error with ${n.name}`,onClick:()=>d(r),error:!0,children:[e(QU,{isSelected:a===r}),e(qU,{})]},r):void 0)),(c.filter((({status:e,addedFrom:t})=>e>=gF.NONE||e===gF.ERROR_CUSTOM_MUTED||"reviewModal"===t)).length<l||!l)&&t(n,{children:[e(eB,{id:zE.generateId(u,"file-input"),"data-testid":zE.generateId(u,"file-input"),type:"file","aria-hidden":"true",tabIndex:-1,capture:o,ref:h,accept:i.map((e=>`.${e}`)).join(", "),onChange:m,multiple:p,value:""}),e(tB,{type:"button",id:zE.generateId(u,"add-image-button"),"data-testid":zE.generateId(u,"add-image-button"),"aria-label":"add image",styleType:"secondary",onClick:g,children:e(ce,{})})]})]})},rB=_((()=>import("./index.bba30c64.js"))),iB=[{color:"#282828",label:"black"},{color:"#FFF",colorScheme:"light",label:"white"},{color:"#017cd3",label:"blue"},{color:"#fb0101",label:"red"},{color:"#22910c",label:"green"},{color:"#f8e821",label:"yellow"}],aB=r=>{const{accepts:i,capture:a,className:c,compress:l,dimensions:p,id:h="image-review",maxFiles:m,maxSizeInKb:g,onExit:y,outputType:_,show:b,multiple:E,maxFilesErrorMessage:A,imageReviewModalStyles:S}=r,{images:w,setImages:x}=d(fF),{dispatchFieldEvent:T,addFieldEventListener:M,removeFieldEventListener:O}=BI(),N=o$(b),[C,D]=o(w.length-1),[L,I]=o(!1),[k,R]=o(),z=!!w?.find((({status:e})=>e===gF.NONE)),[P,F]=o(iB[0].color),[Z,U]=o(!1),B=s(null),j=!!w?.find((({addedFrom:e,status:t})=>"reviewModal"===e&&t<=gF.NONE))||!w.length,V=f((e=>{e.detail.removePendingImages&&x((e=>e.filter((({status:e})=>e===gF.UPLOADED||e===gF.ERROR_CUSTOM_MUTED)))),y()}),[y,x]),G=e=>{!m||e.length+w.filter((({status:e,addedFrom:t})=>e>=gF.NONE||"reviewModal"===t)).length<=m?e.forEach((e=>{x((t=>{const n=hF.findAvailableSlot(t);return[...t,{id:Lm(),file:e,name:e.name,dimensions:p,status:gF.NONE,uploadProgress:0,addedFrom:"reviewModal",slot:n}]}))})):x((t=>{const n=hF.findAvailableSlot(t);return[...t,{id:Lm(),file:e[0],name:e[0].name,dimensions:p,status:gF.ERROR_EXCEED,uploadProgress:0,addedFrom:"reviewModal",slot:n}]}))},H=e=>{e&&(x((e=>e.map(((e,t)=>({...e,...t===C?{status:gF.TO_DELETE}:{}}))))),D(Math.max(0,C-1))),R(null)},Y=f((()=>{x((e=>e.filter((({status:e})=>e>=gF.NONE||e===gF.ERROR_CUSTOM_MUTED)).map((e=>{const t={...e};return e.drawingDataURL&&(t.dataURL=e.drawingDataURL),e.status<gF.UPLOAD_READY&&e.status>gF.NONE&&(t.status=gF.UPLOAD_READY),t.drawingDataURL=void 0,t.drawing=void 0,t}))))}),[x]),W=()=>{!T("save-review-images",h,{images:w,retry:W})||(Y(),y())},q=()=>{I(!0),F(iB[0].color)},K=async()=>{const{dataURL:e,drawing:t}=B.current?.export()||{},n=await yE.dataUrlToImage(e),r=await yE.resampleImage(n,{scale:96/n.width,type:Om.fileExtensionToMimeType(_)}),i=await Om.fileToDataUrl(r);x((n=>{const r=[...n];return r[C]={...r[C],thumbnailDataURL:i,drawingDataURL:e,drawing:t,status:l?gF.TO_RECOMPRESS:gF.EDITED},r})),I(!1),X()},J=()=>{X(),U(!0)},X=()=>{F(""),U(!1)};u((()=>{const e={"trigger-save-review-images":Y,"dismiss-review-modal":V};return Object.entries(e).forEach((([e,t])=>{M(e,h,t)})),()=>{Object.entries(e).forEach((([e,t])=>{O(e,h,t)}))}}),[M,V,Y,h,O]),u((()=>{D(w.length-1)}),[w.length]),u((()=>{b?T("show-review-modal",h):N&&T("hide-review-modal",h)}),[b]);return e($,{id:zE.generateId(h,void 0,b?"show":"hide"),className:c?`${c}-review`:void 0,show:b,children:e(TU,{className:c?`${c}-review-modal-box`:void 0,imageReviewModalStyles:S,showCloseButton:!1,children:b?t(n,{children:[e(MU,{className:c?`${c}-header`:void 0,$drawActive:L,children:t(n,L?{children:[e(DU,{id:zE.generateId(h,"clear-drawing-button"),"data-testid":zE.generateId(h,"clear-drawing-button"),onClick:()=>R("clear-drawing"),children:"Clear"}),e(DU,{id:zE.generateId(h,"save-drawing"),"data-testid":zE.generateId(h,"save-drawing"),onClick:K,children:"Save"})]}:{children:[e(OU,{id:zE.generateId(h,"close-button"),"data-testid":zE.generateId(h,"close-button"),"aria-label":"exit review modal",onClick:()=>R("exit"),children:e(re,{type:"cross"})}),e(NU,{weight:"semibold",children:"Review photos"})]})}),t(LU,{children:[w.length>0&&e(FU,{className:c?`${c}-editor`:void 0,children:e(v,{fallback:null,children:e(rB,{baseImageDataURL:w[C]?.dataURL,drawing:w[C]?.drawing,color:L?P:void 0,erase:!!L&&Z,ref:B,maxSizeInKb:g})})}),w.length>0&&e(IU,{children:"Loading Preview..."}),!L&&w[C]?.status>=gF.NONE&&t(kU,{children:[t($U,{id:zE.generateId(h,"draw-button"),"data-testid":zE.generateId(h,"draw-button"),onClick:q,disabled:z,children:[e(zU,{$disabled:z}),e(RU,{weight:"semibold",$disabled:z,children:"Draw"})]}),t($U,{id:zE.generateId(h,"delete-button"),"data-testid":zE.generateId(h,"delete-button"),onClick:()=>R("delete"),disabled:z,children:[e(PU,{$disabled:z}),e(RU,{weight:"semibold",$disabled:z,children:"Delete"})]})]}),w[C]?.status<gF.NONE&&e(wU,{id:`${h}-photo-error`,image:w[C],accepts:i,maxSizeInKb:g,onClickOk:()=>H(!0),maxFilesErrorMessage:A,maxFiles:m})]}),e(ZU,{className:c?`${c}-footer`:void 0,children:t(n,L?{children:[e(BU,{id:zE.generateId(h,"eraser-button"),"data-testid":zE.generateId(h,"eraser-button"),"aria-label":"eraser",onClick:J,children:e(jU,{$eraseMode:Z})}),e(GU,{children:iB.map((({color:t,colorScheme:n,label:r},i)=>e(HU,{id:zE.generateId(h,`palette-color-${i}`),"aria-label":`${r} brush`,$color:t,$colorScheme:n,onClick:()=>(e=>{X(),F(e)})(t),children:P===t&&e(VU,{$colorScheme:n})},t)))})]}:{children:[e(nB,{id:`${h}-image-thumbnails`,activeFileIndex:C,accepts:i,capture:a,maxFiles:m,images:w,onClickThumbnail:D,onSelectFile:G,multiple:E}),e(UU,{id:zE.generateId(h,"save-button"),"data-testid":zE.generateId(h,"save-button"),onClick:W,disabled:j,children:"Save"})]})}),e(xU,{images:w,show:k,onDecideClearDrawing:e=>{e&&B.current.clearDrawing(),R(null)},onDecideDelete:H,onDecideExit:e=>{e&&(x(w.filter((({addedFrom:e,status:t})=>t>=gF.UPLOADED||t<gF.NONE&&"dragInput"===e)).map((e=>({...e,drawingDataURL:void 0,drawing:void 0})))),y()),R(null)}})]}):e(n,{})})})},oB=_((()=>import("./index.d31714ac.js"))),sB=r=>{const{schema:{buttonLabel:i,capture:a,className:s,compress:c,crop:l,description:f,dimensions:p={width:1e3,height:1e3},editImage:h,label:m,outputType:g="jpg",uploadOnAddingFile:y,validation:_,multiple:b,imageReviewModalStyles:E,tooltip:A},id:S,isDirty:w,isTouched:x,value:T,warning:M,...O}=r,{images:N,setImages:C,currentFileIds:D}=d(fF),L=o$(N),[I,k]=o([...mF]),[$,R]=o(0),[z,P]=o(0),[F,Z]=o(!1),[U,B]=o(!1),{setFieldValidationConfig:j}=n$(),{dispatchFieldEvent:V}=BI(),G=u$();u((()=>{V("mount",S)}),[V,S]),u((()=>{if(!w&&!x){const e=Array.isArray(T)?T:[];if(!(aF(e.map((({fileId:e})=>e)),D).length>0))return;const t=[];e.forEach((({fileId:e,fileName:n,dataURL:r,uploadResponse:i},a)=>{const o={id:e||Lm(),file:{},name:n,dimensions:{width:10,height:10},dataURL:r,status:gF.INJECTED,addedFrom:"schema",uploadProgress:100,slot:a,uploadResponse:i};t.push(o)})),C(t)}}),[w,x,D,C,T]),u((()=>{const e=_?.find((e=>"required"in e)),t=_?.find((e=>"fileType"in e)),n=_?.find((e=>"maxSizeInKb"in e));t?.fileType&&t?.fileType!==I&&k(t?.fileType),n?.maxSizeInKb&&n?.maxSizeInKb!==z&&P(n?.maxSizeInKb);const r=_?.find((e=>"length"in e)),i=_?.find((e=>"max"in e));let a;r?a={maxFiles:r.length,errorMessage:r.errorMessage}:i&&(a={maxFiles:i.max,errorMessage:i.errorMessage}),a?.maxFiles&&$!==a.maxFiles&&R(a.maxFiles),j(S,xT().of(ST().shape({fileName:ux(),dataURL:ux()})).test("is-empty-array",e?.errorMessage||Nm.UPLOAD("photo").REQUIRED,(t=>!t||!e?.required||t.length>0)).test("max-size-in-kb",n?.errorMessage||Nm.UPLOAD("photo").MAX_FILE_SIZE(n?.maxSizeInKb),(e=>!(e&&Array.isArray(e)&&n?.maxSizeInKb)||e.every((e=>Om.getFilesizeFromBase64(e.dataURL)<=1024*n?.maxSizeInKb)))),_)}),[_]),u((()=>{N.some((e=>e.status===gF.NONE))||(N.some(((e,t)=>{const n=L?.[t];if(e.status!==n?.status||e.dataURL!==n.dataURL)switch(e.status){case gF.COMPRESSED:case gF.CONVERTED:if(h&&!U)return G()?B(!0):Z(!0),!0}})),0===N.length&&B(!1))}),[N.map((e=>e.status)).join(","),N.map((e=>e.dataURL)).join(",")]);const H=(e=!1)=>{e?h&&(document.body.classList.remove("lifesg-ds-overlay-open"),B(!0)):C((e=>e.map((e=>e.status<gF.UPLOAD_READY&&e.status>gF.NONE?{...e,status:gF.UPLOAD_READY}:e)))),Z(!1)};return t(n,{children:[e(v,{fallback:null,children:e(oB,{accepts:I,compress:!!c,crop:!!l,dimensions:p,editImage:h,id:S,maxSizeInKb:z,outputType:g,upload:y,filenameMatches:_?.find((e=>"matches"in e))?.matches,filenameMatchesErrorMessage:_?.find((e=>"matches"in e))?.errorMessage,value:T})}),e(gU,{id:S,capture:a,className:s,label:m,description:f,buttonLabel:i,accepts:I,maxFiles:$,maxSizeInKb:z,dimensions:p,errorMessage:O.error?.message,validation:_,multiple:b,warning:M,tooltip:A}),e(BT,{id:`${S}-review-prompt`,title:"Review photos?",size:"large",show:F,description:"This lets you check if you've selected the correct photos, and draw on them to highlight the issue.",buttons:[{id:"ok",title:"Ok",onClick:()=>H(!0)},{id:"skip",title:"Skip",buttonStyle:"secondary",onClick:()=>H()}]}),(()=>{const t=_?.find((e=>"max"in e));return e(aB,{accepts:I,dimensions:p,id:S,className:s,maxFiles:$,maxFilesErrorMessage:t?.errorMessage,maxSizeInKb:z,onExit:()=>B(!1),outputType:g,show:U,multiple:b,capture:a,imageReviewModalStyles:E})})()]})},uB=D`
|
|
1015
1015
|
border: ${A["width-010"]} ${A.solid} ${E["border-focus"]};
|
|
1016
1016
|
box-shadow: none;
|
|
1017
1017
|
`,cB=D`
|
|
@@ -1090,7 +1090,7 @@ object-assign
|
|
|
1090
1090
|
${e=>D`
|
|
1091
1091
|
margin-left: ${e.$readOnly?S["spacing-4"]:S["spacing-12"]};
|
|
1092
1092
|
`}
|
|
1093
|
-
`,hB=n=>{const{id:r,"data-testid":i,className:a,disabled:o,readOnly:s,onFocus:u,value:c,placeholder:l,error:d}=n;return t(dB,{id:r,"data-testid":i,type:"button",className:a,disabled:o,$readOnly:s,$error:d,onFocus:u,onClick:e=>{o||e.currentTarget.focus()},tabIndex:o?-1:0,"aria-disabled":o||void 0,"aria-haspopup":"dialog","aria-readonly":s,children:[e(fB,l&&!c?{$placeholder:!0,$disabled:o,children:l}:{$disabled:o,children:c}),e(pB,{$disabled:o,$readOnly:s,"aria-hidden":"true",children:e(de,{})})]})},mB=t=>{const{id:n,label:r,className:i,locationInputPlaceholder:a="",onFocus:o,value:s,errorMessage:u,disabled:c,readOnly:l}=t;return e(Q.CustomField,{id:zE.generateId(n,"location-input"),"data-testid":zE.generateId(n,"location-input"),label:r,errorMessage:u,children:e(hB,{id:zE.generateId(n,"location-input-base"),"data-testid":zE.generateId(n,"location-input-base"),disabled:c,readOnly:l,placeholder:a,onFocus:o,value:s,error:!!u,className:i})})},gB=_((()=>import("./location-modal.
|
|
1093
|
+
`,hB=n=>{const{id:r,"data-testid":i,className:a,disabled:o,readOnly:s,onFocus:u,value:c,placeholder:l,error:d}=n;return t(dB,{id:r,"data-testid":i,type:"button",className:a,disabled:o,$readOnly:s,$error:d,onFocus:u,onClick:e=>{o||e.currentTarget.focus()},tabIndex:o?-1:0,"aria-disabled":o||void 0,"aria-haspopup":"dialog","aria-readonly":s,children:[e(fB,l&&!c?{$placeholder:!0,$disabled:o,children:l}:{$disabled:o,children:c}),e(pB,{$disabled:o,$readOnly:s,"aria-hidden":"true",children:e(de,{})})]})},mB=t=>{const{id:n,label:r,className:i,locationInputPlaceholder:a="",onFocus:o,value:s,errorMessage:u,disabled:c,readOnly:l}=t;return e(Q.CustomField,{id:zE.generateId(n,"location-input"),"data-testid":zE.generateId(n,"location-input"),label:r,errorMessage:u,children:e(hB,{id:zE.generateId(n,"location-input-base"),"data-testid":zE.generateId(n,"location-input-base"),disabled:c,readOnly:l,placeholder:a,onFocus:o,value:s,error:!!u,className:i})})},gB=_((()=>import("./location-modal.60f7c5c4.js")));class yB extends Error{code;message;constructor(e){super(),Object.assign(this,e)}}var _B;!function(e){e.IS_EMAIL_VALID="is-email-valid",e.IS_PHONE_NUMBER_VALID="is-phone-number-valid",e.SEND_OTP_FAILED="send-otp-failed",e.OTP_VERIFICATION_FAILED="otp-verification-failed",e.IS_OTP_VERIFIED="is-otp-verified",e.API_ERROR="api"}(_B||(_B={}));const vB=C(N.BodyMD)`
|
|
1094
1094
|
cursor: ${e=>e.disabled?"not-allowed":"pointer"};
|
|
1095
1095
|
`,bB=C(pe)`
|
|
1096
1096
|
margin-right: ${S["spacing-4"]};
|
|
@@ -1126,7 +1126,7 @@ object-assign
|
|
|
1126
1126
|
gap: ${S["spacing-16"]};
|
|
1127
1127
|
`,MB=C.div`
|
|
1128
1128
|
${({$color:e})=>e&&`color: ${e};`}
|
|
1129
|
-
`;var OB;!function(e){e.BUTTON="ButtonField",e.CHECKBOX="CheckboxGroup",e.CHIPS="Chips",e["CONTACT-FIELD"]="ContactField",e["DATE-FIELD"]="DateField",e["DATE-RANGE-FIELD"]="DateRangeField",e["EMAIL-FIELD"]="TextField",e["E-SIGNATURE-FIELD"]="ESignatureField",e["ERROR-FIELD"]="ErrorField",e["FILE-UPLOAD"]="FileUpload",e["HIDDEN-FIELD"]="HiddenField",e["HISTOGRAM-SLIDER"]="HistogramSlider",e["IMAGE-UPLOAD"]="ImageUpload",e["LOCATION-FIELD"]="LocationField",e["MASKED-FIELD"]="MaskedField",e["MULTI-SELECT"]="MultiSelect",e["NESTED-MULTI-SELECT"]="NestedMultiSelect",e["RANGE-SELECT"]="RangeSelect",e["NUMERIC-FIELD"]="TextField",e["OTP-VERIFICATION-FIELD"]="OtpVerificationField",e.RADIO="RadioButtonGroup",e.RESET="ResetButton",e.SELECT="Select",e["SELECT-HISTOGRAM"]="SelectHistogram",e.SLIDER="Slider",e.SUBMIT="SubmitButton",e.SWITCH="Switch",e.TEXTAREA="Textarea",e["TEXT-FIELD"]="TextField",e["TIME-FIELD"]="TimeField",e["UNIT-NUMBER-FIELD"]="UnitNumberField"}(OB||(OB={}));var NB=Object.freeze({__proto__:null,ButtonField:n=>{const{schema:{label:r,uiType:i,startIcon:a,endIcon:o,href:s,target:u,...c},id:l,...d}=n,{dispatchFieldEvent:f}=BI(),p=t=>{if(!t)return null;const n=G[t];return e(n,{})};return t(U$,{type:"button",...c,...d,onClick:e=>{f("click",l,e),s&&(e=>{try{return!!new URL(e)}catch{return!1}})(s)&&(u?window.open(s,u,"noopener noreferrer"):window.location.href=s)},children:[p(a),r,p(o)]})},CheckboxGroup:r=>{const{formattedLabel:i,error:a,id:s,onChange:c,schema:{className:l,customOptions:d,disabled:f,label:p,options:h,validation:m,...g},value:y,warning:_}=r,{setValue:v}=Ye(),[b,E]=o(y||[]),{setFieldValidationConfig:A}=n$();u((()=>{const e=m?.find((e=>"required"in e));A(s,xT().of(ux()).test("is-empty-array",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!t||!e?.required||t.length>0)),m)}),[m]),Zs((()=>{const e=y?.filter((e=>h.find((t=>t.value===e))));v(s,e)}),[h]),u((()=>{E(y||[])}),[y]);const S=(e,t)=>{const n=h.find((e=>!0===e.none));let r=[...b];t?r=r.includes(e)?[]:[e]:r.includes(e)?r=sR(r,e,n?.value):(r.push(e),r=sR(r,n?.value)),c({target:{value:r}})},w=e=>b.includes(e),x=()=>{const e=Lm();return`${s}-${e}`},T=t=>"string"==typeof t?e(oI,{inline:!0,children:t}):e(kB,{children:t});return t(n,{children:[e(Q.CustomField,{id:s,label:i,errorMessage:a?.message,children:"toggle"===d?.styleType?h.length>0&&"toggle"===d.styleType&&e(dR,{$layoutType:d?.layoutType??"horizontal",className:l?`${l}-checkbox-container`:void 0,children:h.map(((t,n)=>{const r=x();return e(fR,{type:"checkbox","data-testid":zE.generateId(s,"toggle"),id:r,className:l,disabled:f??t.disabled,name:r,indicator:d?.indicator,styleType:!1===d?.border?"no-border":"default",checked:w(t.value),onChange:()=>S(t.value,t.none),error:!!a?.message,compositeSection:t.children?{children:e(kB,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&T(t.subLabel),children:T(t.label)},n)}))}):h.length>0&&h.map(((n,r)=>{const i=x();return t(lR,{className:l?`${l}-checkbox-container`:void 0,children:[e(cR,{...g,"data-testid":zE.generateId(s,"checkbox"),id:i,className:l,disabled:f??n.disabled,name:i,value:n.value,checked:w(n.value),onChange:()=>S(n.value)}),e(uR,{forwardedAs:"label",htmlFor:i,disabled:f??n.disabled,children:T(n.label)})]},r)}))}),e(_I,{id:s,message:_})]})},Chips:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{disabled:l,label:d,options:f,textarea:p,validation:m,...g},value:y,warning:_,...v}=r,[b,E]=o(y||[]),[A,S]=o(!1),[w,x]=o(!0),{setValue:T,unregister:M}=Ye(),{setFieldValidationConfig:O,removeFieldValidationConfig:N}=n$();u((()=>{A||M(D())}),[]),u((()=>{const e=m?.find((e=>"required"in e)),t=m?.find((e=>"max"in e)),n=m?.find((e=>"length"in e));O(s,xT().of(ux()).test("is-empty-array",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!t||!e?.required||t.length>0)),m),1!==t?.max&&1!==n?.length||x(!1)}),[m]),Zs((()=>{const e=[...f.map((e=>e.value)),p?.label],t=y?.filter((t=>e.includes(t)));T(s,t)}),[f]),u((()=>{y?.includes(L())?I(!0):I(),E(y||[])}),[y]);const C=e=>b.includes(e),D=()=>`${s}-textarea`,L=()=>"string"==typeof p?.label?p?.label:p?.label?.mainLabel,I=(e=!1)=>{S(e),e||N(D())},k=e=>{let t=[...b];if(t.includes(e))return t=t.filter((t=>t!==e)),void c({target:{value:t}});w?t.push(e):t=[e],c({target:{value:t}})};return t(n,{children:[t(Q.CustomField,{label:a,errorMessage:i?.message,...v,children:[t(bR,{"data-testid":zE.generateId(s,"chips"),$showTextarea:A,children:[f.map(((e,t)=>h(LT,{...g,key:t,onClick:()=>k(e.value),isActive:C(e.value),disabled:l??e.disabled},e.label))),(()=>{if(!p?.label)return;const t=L();return e(LT,{...g,onClick:()=>{k(t)},isActive:C(t),children:t})})()]}),(()=>{if(!p?.label)return e(n,{});const t=D(),r={uiType:"textarea",className:g.className?`${g.className}-textarea`:void 0,...p};return A?e(pR,{id:t,schema:r,Field:vR}):e(n,{})})()]}),e(_I,{id:s,message:_})]})},ContactField:r=>{const{isDirty:i,formattedLabel:a,error:s,id:c,name:l,onChange:d,schema:{defaultCountry:f,disabled:p,enableSearch:h,label:m,placeholder:g,validation:y,..._},value:v,warning:b,...E}=r,{resetField:A}=Ye(),[S,w]=o(v||""),x=o$(f),[T,M]=o(f),[O]=o((()=>{const e=new Map;return ER.forEach((t=>{const[n,...r]=t,i=r.find((e=>/^\d+$/.test(e)));e.set(n,i)})),e})()),[N,C]=o(),[D,L]=o(),[I,k]=o(void 0),{setFieldValidationConfig:$}=n$();u((()=>{const e=y?.find((e=>"contactNumber"in e)),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber,r=e?.errorMessage;O.has(n)?(M(n),k(!0)):["default","house","mobile"].includes(t)?(M("Singapore"),k(!0)):k(!1),L(t),$(c,ux().test("singaporeNumber",r||Nm.CONTACT.INVALID_SINGAPORE_NUMBER,(e=>!e||!t||TP.isSingaporeNumber(e,t))).test("internationalNumber",r||Nm.CONTACT.INVALID_INTERNATIONAL_NUMBER,(e=>!(e&&!t&&n)||TP.isInternationalNumber(N?.name,e))),y)}),[y,N]),u((()=>{const e=T||"Singapore";C({name:e,prefix:O.get(e)})}),[T,O]),u((()=>{const e=y?.find((e=>"contactNumber"in e)),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber;!f||x===f||O.has(n)||["default","house","mobile"].includes(t)||M(f)}),[y,f]),u((()=>{if(void 0!==I&&!i){const{prefix:e,number:t}=TP.getParsedPhoneNumber(v||""),n=e.replace(/\+/g,""),r=(e=>{for(const[t,,,n]of ER)if(t===e)return n})(T||"Singapore");if(!I||I&&n===r){const n=R({countryCode:e||r,number:t});A(c,{defaultValue:n,keepDirty:!0})}else{const e=R({countryCode:"",number:""});A(c,{defaultValue:e,keepDirty:!0})}}}),[v,i,I,T]);const R=e=>{const{countryCode:t,number:n}=e,r=t.replace(/\+/g,"");if(!1===I&&r!==N?.prefix){const e=((e,t)=>{for(const[n,r]of t.entries())if(r===e)return n})(r,O);e&&C({name:e,prefix:t})}return w(n),TP.formatPhoneNumber(e.countryCode,e.number)||""};return t(n,{children:[e(Q.PhoneNumberInput,{..._,...E,"data-testid":zE.generateId(c,"contact"),disabled:p,enableSearch:h,errorMessage:s?.message,fixedCountry:I,id:c,label:a,name:l,placeholder:(()=>{if(g)return g;if(D){return`Enter ${"mobile"===D?"mobile":"home"} number`}return"Enter contact number"})(),value:(()=>{if(!N)return;const{prefix:e}=N;return{number:S,countryCode:e}})(),onChange:e=>{const t=R(e);d({target:{value:t}})}}),e(_I,{id:c,message:b})]})},DateField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onChange:l,schema:{label:d,useCurrentDate:f,dateFormat:p=MP,validation:h,...m},value:g,warning:y,..._}=r,{setValue:v}=Ye(),[b,E]=o(g||""),[A,S]=o(),{setFieldValidationConfig:w}=n$();u((()=>{const e=h?.find((e=>"dateFormat"in e&&e.dateFormat)),t=h?.find((e=>"future"in e)),n=h?.find((e=>"past"in e)),r=h?.find((e=>"notFuture"in e)),i=h?.find((e=>"notPast"in e)),a=h?.find((e=>"minDate"in e)),o=h?.find((e=>"maxDate"in e)),u=h?.find((e=>"excludedDates"in e)),c=h?.find((e=>"withinDays"in e)),l=h?.find((e=>"beyondDays"in e)),d=Cm.toLocalDateOrTime(a?.minDate,p,"date"),f=Cm.toLocalDateOrTime(o?.maxDate,p,"date");w(s,ux().test("is-date",e?.errorMessage||Nm.DATE.INVALID,(e=>!e||""===e||!!M(e)&&!!Cm.toLocalDateOrTime(e,p,"date"))).test("future",t?.errorMessage||Nm.DATE.MUST_BE_FUTURE,(e=>{if(!M(e)||!t?.future)return!0;const n=Cm.toLocalDateOrTime(e,p,"date");return!!n?.isAfter(Bf.now())})).test("past",n?.errorMessage||Nm.DATE.MUST_BE_PAST,(e=>{if(!M(e)||!n?.past)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!!t?.isBefore(Bf.now())})).test("not-future",r?.errorMessage||Nm.DATE.CANNOT_BE_FUTURE,(e=>{if(!M(e)||!r?.notFuture)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isAfter(Bf.now())})).test("not-past",i?.errorMessage||Nm.DATE.CANNOT_BE_PAST,(e=>{if(!M(e)||!i?.notPast)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isBefore(Bf.now())})).test("min-date",a?.errorMessage||Nm.DATE.MIN_DATE(Cm.formatDateTime(a?.minDate,"dd/MM/uuuu","date")),(e=>{if(!M(e)||!d)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isBefore(d)})).test("max-date",o?.errorMessage||Nm.DATE.MAX_DATE(Cm.formatDateTime(o?.maxDate,"dd/MM/uuuu","date")),(e=>{if(!M(e)||!f)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isAfter(f)})).test("excluded-dates",u?.errorMessage||Nm.DATE.DISABLED_DATES,(e=>!M(e)||!u||!u.excludedDates.includes(e))).test("within-days",c?.errorMessage||c?.withinDays&&Nm.DATE.WITHIN_DAYS(c?.withinDays),(e=>!M(e)||!c||Cm.checkWithinDays(e,{...c.withinDays,dateFormat:p}))).test("beyond-days",l?.errorMessage||l?.beyondDays&&Nm.DATE.BEYOND_DAYS(l?.beyondDays),(e=>!M(e)||!l||Cm.checkBeyondDays(e,{...l.beyondDays,dateFormat:p}))),h);const m=c?.withinDays&&Cm.calculateDisabledWithinDaysRange({...c.withinDays,dateFormat:p}),g=l?.beyondDays&&Cm.calculateDisabledBeyondDaysRange({...l.beyondDays,dateFormat:p}),y=T([d,t?.future&&Bf.now().plusDays(1),i?.notPast&&Bf.now(),m?.startDate,g?.startDate]),_=x([f,n?.past&&Bf.now().minusDays(1),r?.notFuture&&Bf.now(),m?.endDate,g?.endDate]),v=[...u?.excludedDates||[]];(y||_||v)&&S((e=>({...e,minDate:y?.format(OP),maxDate:_?.format(OP),disabledDates:v})))}),[h]),u((()=>{if(p)if(g)if(M(g)){const e=Cm.toLocalDateOrTime(g,p,"date");E(Cm.formatDateTime(e?.toString(),MP,"date",Nm.DATE.INVALID))}else E(Nm.DATE.INVALID);else if(!c)if(f){const e=Cm.formatDateTime(Bf.now().toString(),p,"date");v(s,e);const t=Cm.formatDateTime(Bf.now().toString(),MP,"date");E(t)}else E(void 0)}),[f,g,p,c]);const x=e=>e.filter((e=>e)).sort(((e,t)=>e.isAfter(t)?1:-1))?.[0],T=e=>e.filter((e=>e)).sort(((e,t)=>e.isBefore(t)?1:-1))?.[0],M=e=>e&&e!==Nm.DATE.INVALID;return t(n,{children:[e(Q.DateInput,{...m,..._,...A,id:s,"data-testid":zE.generateId(s,"date"),label:a,errorMessage:i?.message,onChange:e=>{l({target:{value:Cm.formatDateTime(e,p,"date",Nm.DATE.INVALID)}})},value:b}),e(_I,{id:s,message:y})]})},DateRangeField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onChange:l,schema:{dateFormat:d=CP,label:f,validation:p,variant:h,...m},value:g={from:void 0,to:void 0},warning:y,..._}=r,[v,b]=o(g.from||""),[E,A]=o(g.to||""),[S,w]=o(),{setFieldValidationConfig:x}=n$(),[T,M]=o([]);Zs((()=>{x(s,ST().shape({from:ux(),to:ux()}).test({name:"is-empty-string",test(e,t){M(t.schema.describe().meta?.rules??[]);const n=L(t.schema.describe().meta?.rules,"required");if(!e||!n)return!0;return!!(e.from?.length>0&&e.to?.length>0)||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.REQUIRED})}}).test({name:"is-date",test(e,t){const n=p?.find((e=>!!e&&"dateFormat"in e&&e.dateFormat));if(sI.exports.isEmpty(e?.from)||sI.exports.isEmpty(e?.to))return!0;return!(!C(e.from)||!C(e.to)||!Cm.toLocalDateOrTime(e.from,d,"date")||!Cm.toLocalDateOrTime(e.to,d,"date"))||t.createError({message:n?.errorMessage||Nm.DATE_RANGE.INVALID})}}).test({name:"number-of-days",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"numberOfDays"),r=n?.numberOfDays;if(!C(e.from)||!C(e.to)||!r)return!0;const i=Cm.toLocalDateOrTime(e.from,d,"date");return!!Cm.toLocalDateOrTime(e.to,d,"date").equals(i.plusDays(r-1))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MUST_HAVE_NUMBER_OF_DAYS(r)})}}).test({name:"future",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"future");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(!r?.isAfter(Bf.now())||!i?.isAfter(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MUST_BE_FUTURE})}}).test({name:"past",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"past");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(!r?.isBefore(Bf.now())||!i?.isBefore(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MUST_BE_PAST})}}).test({name:"not-future",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"notFuture");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(r?.isAfter(Bf.now())||i?.isAfter(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.CANNOT_BE_FUTURE})}}).test({name:"not-past",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"notPast");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(r?.isBefore(Bf.now())||i?.isBefore(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.CANNOT_BE_PAST})}}).test({name:"min-date",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"minDate"),r=n?.minDate,i=r?Cm.toLocalDateOrTime(r,d,"date"):void 0;if(!C(e.from)||!C(e.to)||!i)return!0;const a=Cm.toLocalDateOrTime(e.from,d,"date"),o=Cm.toLocalDateOrTime(e.to,d,"date");return!(a?.isBefore(i)||o?.isBefore(i))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MIN_DATE(Cm.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"max-date",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"maxDate"),r=n?.maxDate,i=r?Cm.toLocalDateOrTime(r,d,"date"):void 0;if(!C(e.from)||!C(e.to)||!i)return!0;const a=Cm.toLocalDateOrTime(e.from,d,"date"),o=Cm.toLocalDateOrTime(e.to,d,"date");return!(a?.isAfter(i)||o?.isAfter(i))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MAX_DATE(Cm.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"excluded-dates",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"excludedDates"),r=n?.excludedDates;if(!C(e.from)||!C(e.to)||!r)return!0;const i=Cm.toLocalDateOrTime(e.from,d,"date"),a=Cm.toLocalDateOrTime(e.to,d,"date");try{const e=r.map((e=>Cm.toLocalDateOrTime(e,d,"date")));for(const r of e)if(i.isEqual(r)||a.isEqual(r))return t.createError({message:n?.errorMessage??Nm.DATE_RANGE.DISABLED_DATES});return!0}catch{return!1}}}),p);const e=L(T,"future"),t=L(T,"past"),n=L(T,"notFuture"),r=L(T,"notPast"),i=L(T,"minDate"),a=L(T,"maxDate"),o=L(T,"excludedDates"),u=L(T,"numberOfDays"),c=Cm.toLocalDateOrTime(i?.minDate,d,"date"),l=Cm.toLocalDateOrTime(a?.maxDate,d,"date"),f=N([c,e?.future&&Bf.now().plusDays(1),r?.notPast&&Bf.now()]),m=O([l,t?.past&&Bf.now().minusDays(1),n?.notFuture&&Bf.now()]),g=o?.excludedDates,y=u?.numberOfDays;w((e=>({...e,minDate:f?.format(DP),maxDate:m?.format(DP),disabledDates:g,numberOfDays:y})))}),[p,T]),u((()=>{D(NP.START)}),[g.from,d,c]),u((()=>{D(NP.END)}),[g.to,d,c]);const O=e=>e.filter((e=>e)).sort(((e,t)=>e.isAfter(t)?1:-1))?.[0],N=e=>e.filter((e=>e)).sort(((e,t)=>e.isBefore(t)?1:-1))?.[0],C=e=>e&&e!==Nm.DATE_RANGE.INVALID,D=e=>{const t=e===NP.START?g.from:g.to,n=e===NP.START?b:A;if(d)if(t)if(C(t)){const e=Cm.toLocalDateOrTime(t,d,"date");n(Cm.formatDateTime(e?.toString(),CP,"date",Nm.DATE_RANGE.INVALID))}else n(Nm.DATE_RANGE.INVALID);else c||n(void 0)},L=(e,t)=>{const n=e?.find((e=>t in e)),r=p?.find((e=>!!e&&t in e));return sI.exports.isEmpty(n)?sI.exports.isEmpty(r)?void 0:r:n};return t(n,{children:[e(Q.DateRangeInput,{...m,..._,...S,id:s,"data-testid":zE.generateId(s,"date"),label:a,errorMessage:i?.message,onChange:(e,t)=>{l({target:{value:{from:Cm.formatDateTime(e,d,"date",Nm.DATE_RANGE.INVALID),to:Cm.formatDateTime(t,d,"date",Nm.DATE_RANGE.INVALID)}}})},value:v,valueEnd:E,variant:h}),e(_I,{id:s,message:y})]})},get TDateRangeInputType(){return NP},ESignatureField:n=>{const{error:r,formattedLabel:i,id:a,onChange:c,schema:{label:l,uiType:d,upload:f,validation:p,...h},value:m,warning:g}=n,[y,_]=o(null),[v,b]=o(0),[E,A]=o(0),[S,w]=o(null),{setFieldValidationConfig:x}=n$(),T=s(null),{clearErrors:M}=Ye();u((()=>{const e=p?.find((e=>"upload"in e&&e.upload));T.current=e,x(a,ST().shape({fileId:ux().required(),dataURL:ux(),fileUrl:ux(),uploadResponse:Qw().nullable()}).default(void 0),p)}),[p]),u((()=>{if(A(0),N(m)){if(m.dataURL)_(m.dataURL);else if(m.fileUrl){const e=D(m.fileId,m.fileUrl);return()=>e.abort()}}else _(null)}),[m]);const O=async e=>{if(!e)return _(null),A(0),b(0),w(null),void c({target:{value:null}});const t=Lm();if(_(e),A(0),$E(f))c({target:{value:{fileId:t,dataURL:e}}});else try{const n=await C(t,e);c({target:{value:{fileId:t,..."base64"===f.type&&{dataURL:e},fileUrl:n?.data?.fileUrl,uploadResponse:n}}}),M(a),b(0)}catch(e){b((e=>e+1)),w(null)}},N=e=>!!e,C=async(e,t)=>{w(0);const n=new FormData;if(n.append("fileId",e),f.sessionId&&n.append("sessionId",f.sessionId),"base64"===f.type)n.append("dataURL",t);else if("multipart"===f.type){const r=await Om.dataUrlToBlob(t),i=Om.blobToFile(r,{name:e,lastModified:Date.now()});n.append("file",i,e)}const r=await new kl("",void 0,void 0,!0).post(f.url,n,{headers:{"Content-Type":"base64"===f.type?"application/json":"multipart/form-data",...f.headers},onUploadProgress:e=>{const{loaded:t,total:n}=e;w(t/n)}});return w(null),r},D=(e,t)=>{const n=new AbortController;return(async()=>{try{const r=await new kl("",void 0,void 0,!1,{responseType:"blob"}).get(t,{signal:n.signal}),i=await Om.getType(new File([r],e)),a=new File([r],e,{type:i.mime}),o=await Om.fileToDataUrl(a);_(o),A(0)}catch(e){if(e instanceof _l)return;A((e=>e+1))}})(),n};return t(LP,{children:[e(Q.ESignature,{...h,id:a,label:i,onChange:O,value:y,...null!==S&&{loadingProgress:S}}),(r?.message||v||E)&&null===S?v>0?t(IP,{children:[T.current?.errorMessage||Nm.ESIGNATURE.UPLOAD,e(kP,{type:"button",onClick:()=>O(y),children:"Please try again."}),v>=3&&e($P,{type:"warning","data-testid":"upload-refresh-alert",children:"Refresh this page if you cannot upload your signature."})]}):E>0&&N(m)?t(IP,{children:["Failed to load.",e(kP,{type:"button",onClick:()=>D(m.fileId,m.fileUrl),children:"Please try again."}),E>=3&&e($P,{type:"warning","data-testid":"load-refresh-alert",children:"Refresh this page if your signature failed to load."})]}):e(IP,{children:r?.message}):null,e(_I,{id:a,message:g})]})},ErrorField:t=>{const{id:n,schema:{children:r}}=t,{setFieldValidationConfig:i}=n$();return u((()=>{i(n,Qw().test((()=>!1)),[])}),[]),r?e(kB,{children:r}):null},FileUploadInner:dF,FileUpload:t=>e(sF,{children:e(dF,{...t})}),get EFileStatus(){return cF},HiddenField:t=>{const{id:n,name:r,onBlur:i,onChange:a,schema:{showIf:o,uiType:s,validation:c,valueType:l,value:d,...f},value:p}=t,{setFieldValidationConfig:h}=n$(),{setValue:m}=Ye();return u((()=>{let e;switch(l){case"null":e=Qw();break;case"number":e=lx();break;case"boolean":e=tx();break;default:e=ux()}h(n,e,c)}),[c,l]),u((()=>{"null"===l&&null!==p?m(n,null):PE(d)||p===d||m(n,d)}),[m,n,l,d,p]),e("input",{onBlur:i,onChange:a,...f,type:"hidden",id:n,"data-testid":n,name:r,value:d??p??""})},HistogramSlider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,bins:d,interval:f,validation:p,disabled:h,readOnly:m,className:g,ariaLabels:y,customOptions:_},value:v,warning:b}=r,{resetField:E}=Ye(),[A,S]=o(void 0),{setFieldValidationConfig:w}=n$();u((()=>{if(v)S([v.from,v.to]);else{const e=Math.min(...d.map((e=>e.minValue))),t=Math.max(...d.map((e=>e.minValue)))+f;E(s,{defaultValue:{from:e,to:t},keepDirty:!0}),S([e,t])}}),[v]),u((()=>{const e=p?.find((e=>"required"in e)),t=p?.find((e=>"bin"in e&&e.bin)),n=p?.find((e=>"incremental"in e&&e.incremental)),r=p?.find((e=>"withinRange"in e&&e.withinRange));w(s,ST({from:lx(),to:lx()}).test("is-required",e?.errorMessage||Nm.COMMON.REQUIRED_OPTIONS,(t=>!t||!e||!PE(t.from)&&!PE(t.to))).test("is-bin",t?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...d.map((e=>e.minValue)));return Number.isInteger((t-r)/f)&&Number.isInteger((n-r)/f)})).test("is-incremental",n?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to)).test("is-within-range",r?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...d.map((e=>e.minValue))),i=Math.max(...d.map((e=>e.minValue)))+f;return!(t<r||n>i)})),p)}),[p,d,f]);return t(n,{children:[e(Q.HistogramSlider,{..._,id:s,"data-testid":zE.generateId(s,"histogram-slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{const[t,n]=e;c({target:{value:{from:t,to:n}}})},value:A,bins:d,interval:f,disabled:h,readOnly:m,className:g,ariaLabels:y}),e(_I,{id:s,message:b})]})},ImageUploadInner:sB,ImageUpload:t=>e(pF,{children:e(sB,{...t})}),ACCEPTED_FILE_TYPES:mF,get EImageStatus(){return gF},LocationField:n=>{const{error:r,formattedLabel:i,id:a,schema:{className:s="location",mapApi:c,disabled:l,gettingCurrentLocationFetchMessage:d,interactiveMapPinIconUrl:f,label:p,locationInputPlaceholder:h,locationListTitle:m,locationModalStyles:g,mapBannerText:y,mapPanZoom:_,mustHavePostalCode:b,readOnly:E,staticMapPinColor:A,validation:S,hasExplicitEdit:w,locationSelectionMode:x="default",disableSearch:T,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:N,pinsOnlyIndicateCurrentLocation:C,legendItems:D},value:L,warning:I}=n,[$,R]=o(!1),{setValue:z}=Ye(),{setFieldValidationConfig:P}=n$(),{dispatchFieldEvent:F,addFieldEventListener:Z,removeFieldEventListener:U}=BI();u((()=>(Z("show-location-modal",a,V),F("show-location-modal-ready",a),()=>{U("show-location-modal",a,V)})),[]),u((()=>{const e=S?.find((e=>"required"in e)),t=S?.find((e=>"postalCode"in e));P(a,ST({address:ux(),blockNo:ux(),building:ux(),lat:lx(),lng:lx(),postalCode:ux(),roadName:ux(),x:lx(),y:lx()}).test("is-required",e?.errorMessage||Nm.COMMON.FIELD_REQUIRED,(t=>!e?.required||!!t&&!!t.lat&&!!t.lng)).test("must-have-postal-code",t?.errorMessage||Nm.LOCATION.MUST_HAVE_POSTAL_CODE,(t=>!e||!b||fI.hasGotAddressValue(t.postalCode))),S)}),[S]);const B=(e,t=!0)=>{z(a,e,{shouldDirty:t})},j=()=>{E||l||(R(!0),F("show-location-modal",a))},V=()=>{R(!0)};return t("div",{id:a,"data-testid":zE.generateId(a),className:s,children:[e(mB,{id:a,label:i,className:s,locationInputPlaceholder:h,onChange:e=>e.currentTarget.blur(),onFocus:j,value:L?.address||"",errorMessage:r?.message,disabled:"explicit"===w&&!!L?.address||l,readOnly:E}),w&&L?.address&&e(k.Default,{id:zE.generateId(a,"edit-button"),"data-testid":zE.generateId(a,"edit-button"),styleType:"secondary",onClick:()=>{!F("click-edit-button",a)||R(!0)},type:"button",children:"Edit"}),!!L?.lat&&!!L?.lng&&e(yI,{id:a,className:`${s}-static-map`,lat:L.lat,lng:L.lng,staticMapPinColor:A,onClick:j,disabled:l}),e(v,{fallback:null,children:gB&&e(gB,{id:a,className:s,showLocationModal:$,onClose:()=>{R(!1),F("hide-location-modal",a)},formValues:L,onConfirm:B,updateFormValues:B,mapPanZoom:_,mapApi:c,interactiveMapPinIconUrl:f,gettingCurrentLocationFetchMessage:d,mustHavePostalCode:b,locationModalStyles:g,locationListTitle:m,mapBannerText:y,locationSelectionMode:x,disableSearch:T,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:N,pinsOnlyIndicateCurrentLocation:C,legendItems:D})}),e(_I,{id:a,message:I})]})},GeolocationPositionErrorWrapper:yB,MaskedField:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,value:l,schema:{label:d,uiType:f,validation:p,maskRegex:h,iconMask:m,iconUnmask:g,...y},warning:_,...v}=r,[b,E]=o(l||""),[A,S]=o({}),{setFieldValidationConfig:w}=n$();u((()=>{w(s,ux(),p);const e=p?.find((e=>"max"in e)),t=p?.find((e=>"length"in e)),n={...A};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),S(n)}),[p]),u((()=>{l!==b&&E(l||"")}),[l]);const x=t=>{if(!t)return;const n=G[t];return e(n,{"data-testid":t})};return t(n,{children:[e(Q.MaskedInput,{...y,...v,...A,id:s,"data-testid":zE.generateId(s,f),label:a,onChange:e=>{c(e)},value:b,errorMessage:i?.message,maskRegex:(()=>{if(h)try{const e=h.match(/\/(.*)\/([a-z]+)?/);return new RegExp(e[1],e[2])}catch(e){console.warn(`invalid regex pattern: ${h}`)}})(),iconMask:x(m),iconUnmask:x(g)}),e(_I,{id:s,message:_})]})},MultiSelect:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,options:d=[],validation:f,...p},value:h,warning:m,...g}=r,{setValue:y}=Ye(),[_,v]=o(h||[]),{setFieldValidationConfig:b}=n$();u((()=>{const e=f?.find((e=>"required"in e));b(s,xT().of(ux()).test("is-empty-array",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!t||!e?.required||t.length>0)),f)}),[f]),Us((()=>{const e=h?.filter((e=>d.find((t=>t.value===e))));y(s,e)}),[d]),u((()=>{v(h||[])}),[h]);return t(n,{children:[e(Q.MultiSelect,{...p,...g,id:s,"data-testid":zE.generateId(s),label:a,options:d,onSelectOptions:e=>{const t=e.map((e=>e.value));c({target:{value:t}})},selectedOptions:d.filter((e=>_.includes(e.value))),valueExtractor:e=>e.value,listExtractor:e=>e.label,errorMessage:i?.message}),e(_I,{id:s,message:m})]})},OtpVerificationField:r=>{const{error:i,id:a,value:c,formattedLabel:l,onChange:d,warning:f,schema:{validation:p,request:h,verification:m,withPrefix:g,verifyOtpCountdownTimer:y,prefixSeparator:_,type:v,...b}}=r,[E,A]=o(c?.otpCode||""),[S,w]=o(c?.otpPrefix),x=s(c?.transactionId),T=s(-1),M=s(-1),O=c?.state||"default",N=c?.contact||"",C={number:"phone-number"===v?N:"",countryCode:"+65"},D=p?.find((e=>"otp-type"in e)),L=p?.find((e=>"required"in e)),{setFieldValidationConfig:I}=n$(),{formState:k,setError:$,clearErrors:R}=Ye(),{submitCount:z}=k;u((()=>{I(a,ST().test(_B.IS_OTP_VERIFIED,L?.errorMessage||F(),(e=>!L?.required||"verified"===e?.state)),p)}),[p,O]);const P=async()=>{const e=D?.["otp-type"]??void 0;if("email"===e&&(t=N,!ux().required().email().isValidSync(t)))throw $(a,{type:_B.IS_EMAIL_VALID,message:D?.errorMessage||Nm.OTP_VERIFICATION.INVALID_EMAIL}),new Error;var t;const n=`${C.countryCode}${C.number}`;if("phone-number"===e&&!(e=>TP.isSingaporeNumber(e))(n))throw $(a,{type:_B.IS_PHONE_NUMBER_VALID,message:D?.errorMessage||Nm.OTP_VERIFICATION.INVALID_PHONE}),new Error;const r={type:v,..."email"===v?{email:N}:{phoneNo:n},...void 0!==g&&{withPrefix:g}},i=await new kl("",void 0,void 0,!0).post(h.endpoint.url,r).catch((e=>{const t=e?.message||Nm.OTP_VERIFICATION.SEND_OTP_FAILED;throw $(a,{type:_B.SEND_OTP_FAILED,message:t}),new Error(t)})),o=i?.transactionId??i?.data?.transactionId,s=i?.prefix??i?.data?.prefix;x.current=o,s&&w(s),R(a),T.current=z,d({target:{value:{contact:"email"===e?N:C.number,otpPrefix:s??S,type:v,state:"sent"}}})},F=()=>"default"===O?"email"===v?Nm.OTP_VERIFICATION.EMAIL_VERIFICATION_REQUIRED:Nm.OTP_VERIFICATION.PHONE_VERIFICATION_REQUIRED:"sent"===O?Nm.OTP_VERIFICATION.OTP_REQUIRED:void 0,Z={...b,id:a,"data-testid":zE.generateId(a,"otp-verification-field"),label:l,otpState:O,onOtpStateChange:e=>{"default"===e&&(A(""),w(void 0),x.current=void 0,d({target:{value:{...c,state:void 0,additionalData:void 0,otpPrefix:void 0}}}))},onSendOtp:P,onResendOtp:P,onVerifyOtp:async e=>{const t="email"===v?N:C.number,n=await new kl("",void 0,void 0,!0).post(m.endpoint.url,{transactionId:x.current,otp:e,otpPrefix:S}).catch((e=>{const t=e?.message||Nm.OTP_VERIFICATION.OTP_VERIFICATION_FAILED;throw $(a,{type:_B.OTP_VERIFICATION_FAILED,message:t}),new Error(t)}));d({target:{value:{contact:t,otpPrefix:S,type:v,state:"verified",additionalData:n?.additionalData??n?.data?.additionalData}}})},sendOtpError:(()=>{if("sent"===O)return;if(i?.type===_B.IS_EMAIL_VALID||i?.type===_B.IS_PHONE_NUMBER_VALID||i?.type===_B.SEND_OTP_FAILED)return i?.message;return k.isSubmitted&&z>M.current&&i?.type===_B.IS_OTP_VERIFIED?i?.message:void 0})(),verifyOtpError:(()=>{if("sent"!==O)return;return i?.type===_B.IS_OTP_VERIFIED&&z>T.current||i?.type===_B.OTP_VERIFICATION_FAILED||i?.type===_B.API_ERROR?i?.message:void 0})(),otpValue:{value:E,...S&&{prefix:S},..._&&{prefixSeparator:_}},onOtpChange:e=>{R(a),A(e)},...void 0!==h.placeholder&&{sendOtpPlaceholder:h.placeholder},...void 0!==y&&{verifyOtpCountdownTimer:y},...void 0!==m.showThumbnail&&{showVerifyOtpThumbnail:m.showThumbnail},...void 0!==m.title&&{verifyOtpTitle:m.title},...void 0!==m.message&&{verifyOtpMessage:m.message}};return t(n,{children:[e(Q.OtpVerification,"email"===v?{...Z,type:"email",emailValue:N,onEmailChange:e=>{M.current=z,R(a),d({target:{value:{...c,contact:e}}})}}:{...Z,type:"phone-number",phoneNumberValue:C,onPhoneNumberChange:e=>{M.current=z,R(a);let t=e.number;e.number||(t=""),d({target:{value:{...c,contact:t}}})},fixedCountry:!0}),e(_I,{id:a,message:f})]})},get EOtpVerificationErrorType(){return _B},NestedMultiSelect:r=>{const{schema:{label:i,validation:a,options:s=[],...c},id:l,value:d,formattedLabel:p,onChange:h,onBlur:m,error:g,warning:y,..._}=r,{setValue:v}=Ye(),{setFieldValidationConfig:b}=n$(),[E,A]=o(d),[S,w]=o([]),x=f((e=>{const t=[],n=(e,r)=>{for(const i in e){const a=[...r,i],o=e[i];"string"==typeof o?t.push(a):n(o,a)}};return n(e,[]),t}),[]);u((()=>{const e=a?.find((e=>"required"in e));b(l,ST().test("is-required",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!e?.required||!!t&&!!Object.keys(t).length)),a)}),[a]),Us((()=>{const e=(t,n)=>{const r={};for(const i of t){const{key:t,subItems:a}=i,o=n[t];if(o){const n="string"==typeof o?o:e(a||[],o);Object.keys(n).length?r[t]=n:delete r[t]}}return r},t=d?e(s,d):d;v(l,t)}),[s]),u((()=>{A(d);const e=x(d);w(e)}),[x,E,d]);return t(n,{children:[e(Q.NestedMultiSelect,{...c,..._,id:l,"data-testid":zE.generateId(l),label:p,options:s,onSelectOptions:(e,t)=>{const n=((e,t)=>{const n={};return e.forEach(((e,r)=>{e.reduce(((n,i,a)=>(a===e.length-1?n[i]=t[r]:n[i]||(n[i]={}),n[i])),n)})),n})(e,t);h({target:{value:n}})},onBlur:m,selectedKeyPaths:S,errorMessage:g?.message}),e(_I,{id:l,message:y})]})},RadioButtonGroup:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{className:l,customOptions:d,disabled:f,label:p,options:m,validation:g,...y},value:_,warning:v}=r,{setValue:b}=Ye(),[E,A]=o(_||""),{setFieldValidationConfig:S}=n$();u((()=>{S(s,ux(),g)}),[g]),Zs((()=>{m.find((e=>e.value===_))||b(s,"")}),[m]),u((()=>{A(_||"")}),[_]);const w=e=>{c({target:{value:e}})},x=e=>E===e,T=()=>{const e=Lm();return`${s}-${e}`},M=t=>"string"==typeof t?e(oI,{inline:!0,children:t}):e(kB,{children:t});return t(n,{children:[e(Q.CustomField,{id:s,label:a,errorMessage:i?.message,children:(()=>{switch(d?.styleType){case"toggle":return m.length>0&&"toggle"===d.styleType&&e(wB,{className:l?`${l} ${l}-radio-container`:void 0,$layoutType:d?.layoutType??"horizontal",children:m.map(((t,n)=>{const r=T();return h(xB,{...y,key:n,type:"radio",id:r,className:l?`${l}-radio`:void 0,"data-testid":zE.generateId(s,"radio"),disabled:f??t.disabled,name:r,indicator:d?.indicator,styleType:!1===d?.border?"no-border":"default",checked:x(t.value),onChange:()=>w(t.value),error:!!i?.message,compositeSection:t.children?{children:e(kB,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&M(t.subLabel)},M(t.label))}))});case"image-button":return m.length>0&&e(SB,{className:l?`${l} ${l}-radio-container`:void 0,children:m.map(((e,t)=>{const n=T();return h(EB,{...y,type:"button",key:t,id:n,className:l?`${l}-radio`:void 0,"data-testid":zE.generateId(s,"radio"),disabled:f??e.disabled,name:n,selected:x(e.value),onClick:()=>w(e.value),imgSrc:e.imgSrc,error:!!i?.message},e.label)}))});default:return m.length>0&&m.map(((n,r)=>{const i=T();return t(AB,{className:l?`${l}-radio-container`:void 0,children:[e(bB,{...y,className:l,id:i,"data-testid":zE.generateId(s,"radio"),disabled:f??n.disabled,name:i,value:n.value,checked:x(n.value),onChange:()=>w(n.value)}),e(vB,{forwardedAs:"label",htmlFor:i,disabled:f??n.disabled,children:M(n.label)})]},r)}))}})()}),e(_I,{id:s,message:v})]})},RangeSelect:r=>{const{error:i,formattedLabel:a,id:c,onChange:l,schema:{label:d,options:f,validation:p,...h},value:m={from:void 0,to:void 0},warning:g,...y}=r,{setValue:_}=Ye(),[v,b]=o(m.from||""),[E,A]=o(m.to||""),{setFieldValidationConfig:S}=n$(),w=s(!1);u((()=>{const e=p?.find((e=>"required"in e));S(c,ST().shape({from:ux(),to:ux()}).test("is-empty-string",e?.errorMessage||Nm.COMMON.REQUIRED_OPTIONS,(t=>!t||!e?.required||t.from?.length>0&&t.to?.length>0)),p)}),[p]),Zs((()=>{const e={};f.from.find((e=>e.value===m.from))||(e.from=""),f.to.find((e=>e.value===m.to))||(e.to=""),_(c,{...m,...e})}),[f]),u((()=>{A(m.from),b(m.to)}),[m]);return t(n,{children:[e(Q.RangeSelect,{...h,...y,id:c,onHideOptions:()=>{w.current?w.current=!1:m.from&&m.to||l({target:{value:{from:void 0,to:void 0}}})},"data-testid":zE.generateId(c),label:a,options:f,onSelectOption:e=>{void 0===e.from&&void 0===e.to&&l({target:{value:{from:void 0,to:void 0}}}),e.from&&l({target:{value:{from:e.from.value,to:void 0}}}),e.to&&(w.current=!0,l({target:{value:{to:e.to.value,from:E}}}))},selectedOptions:{from:f.from.find((({value:e})=>e===E)),to:f.to.find((({value:e})=>e===v))},valueToStringFunction:e=>`${e.from} - ${e.to}`,valueExtractor:e=>({from:e.value,to:e.value}),displayValueExtractor:e=>e.label,listExtractor:e=>e.label,errorMessage:i?.message}),e(_I,{id:c,message:g})]})},ResetButton:t=>{const{id:n,schema:{disabled:r,ignoreDefaultValues:i,label:a,...o},...s}=t,{reset:u,getValues:c}=Ye(),{resetFields:l}=t$(),{formSchema:{defaultValues:d}}=e$();return e(k.Default,{...o,...s,disabled:r,"data-testid":n,id:n,type:"reset",onClick:()=>{if(i){const e=c();Object.entries(e).forEach((([t,n])=>{hi(n)?e[t]=[]:L$(n)||NI(n)?e[t]="":ai(n)&&(e[t]={})})),u(e),l(e)}else u(),l(d)},children:a})},Select:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,options:d,validation:f,...p},value:h,warning:m,...g}=r,{setValue:y}=Ye(),[_,v]=o(h||""),{setFieldValidationConfig:b}=n$();u((()=>{b(s,ux(),f)}),[f]),Zs((()=>{d.find((e=>e.value===h))||y(s,"")}),[d]),u((()=>{v(h||"")}),[h]);return t(n,{children:[e(Q.Select,{...p,...g,id:s,"data-testid":zE.generateId(s,"select"),label:a,errorMessage:i?.message,options:d,onSelectOption:(e,t)=>{c({target:{value:t}})},selectedOption:d.find((({value:e})=>e===_)),displayValueExtractor:e=>e.label,valueExtractor:e=>e.value,listExtractor:e=>e.label}),e(_I,{id:s,message:m})]})},SelectHistogram:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,validation:d,disabled:f,readOnly:p,className:h,histogramSlider:m,customOptions:g},value:y,warning:_,...v}=r,{bins:b,interval:E,...A}=m,{resetField:S}=Ye(),[w,x]=o([0,0]),{setFieldValidationConfig:T}=n$();u((()=>{if(y)x([y.from,y.to]);else{const e=Math.min(...b.map((e=>e.minValue))),t=Math.max(...b.map((e=>e.minValue)))+E;S(s,{defaultValue:{from:e,to:t},keepDirty:!0}),x([e,t])}}),[y]),u((()=>{const e=d?.find((e=>"required"in e)),t=d?.find((e=>"bin"in e&&e.bin)),n=d?.find((e=>"incremental"in e&&e.incremental)),r=d?.find((e=>"withinRange"in e&&e.withinRange));T(s,ST({from:lx(),to:lx()}).test("is-required",e?.errorMessage||Nm.COMMON.REQUIRED_OPTIONS,(t=>!t||!e||!PE(t.from)&&!PE(t.to))).test("is-bin",t?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...b.map((e=>e.minValue)));return Number.isInteger((t-r)/E)&&Number.isInteger((n-r)/E)})).test("is-incremental",n?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to)).test("is-within-range",r?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...b.map((e=>e.minValue))),i=Math.max(...b.map((e=>e.minValue)))+E;return!(t<r||n>i)})),d)}),[d,b,E]);return t(n,{children:[e(Q.SelectHistogram,{...v,id:s,"data-testid":zE.generateId(s,"select-histogram"),label:a,errorMessage:i?.message,onChangeEnd:e=>{const[t,n]=e;c({target:{value:{from:t,to:n}}})},disabled:f,readOnly:p,className:h,rangeLabelPrefix:g?.rangeLabelPrefix,rangeLabelSuffix:g?.rangeLabelSuffix,value:w,histogramSlider:{bins:b,interval:E,...A}}),e(_I,{id:s,message:_})]})},Slider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,customOptions:d,validation:f,disabled:p,readOnly:h,className:m,ariaLabel:g},value:y,warning:_}=r,[v,b]=o(),{setFieldValidationConfig:E}=n$();u((()=>{const e=f?.find((e=>"min"in e)),t=f?.find((e=>"max"in e)),n=f?.find((e=>"increment"in e));E(s,lx().test("is-incremental",n?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(t=>{if("number"!=typeof t||!n)return!0;const r=n.increment,i=(e?.min??0)-t;return Number.isInteger(i/r)})),f),(e||t||n)&&b({min:e?.min,max:t?.max,step:n?.increment})}),[f]);return t(n,{children:[e(Q.Slider,{...d,...v,id:s,"data-testid":zE.generateId(s,"slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{c({target:{value:e}})},value:y,disabled:p,readOnly:h,className:m,ariaLabel:g}),e(_I,{id:s,message:_})]})},SubmitButton:t=>{const{id:n,schema:{disabled:r,label:i,...a},...s}=t,{submitHandler:c,wrapInForm:l}=i$(),{setFieldValidationConfig:d}=n$(),{hardValidationSchema:f}=s$(),p=it({disabled:"invalid-form"!==r}),[h,m]=o(!0===r);u((()=>{d(n,Qw())}),[]),u((()=>{"invalid-form"!==r&&m(!!r)}),[r]),Zs((()=>{(async()=>{if("invalid-form"===r)try{await f.validate(p),m(!1)}catch(e){m(!0)}})()}),[p,f]);return e(k.Default,{...a,...s,disabled:h,"data-testid":n,id:n,onClick:e=>{l||(e.preventDefault(),c?.())},type:"submit",children:i})},Switch:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{className:l,customOptions:d,disabled:f,label:p,validation:h,...m},value:g,warning:y}=r,[_,v]=o(g||void 0),{setFieldValidationConfig:b}=n$();u((()=>{b(s,tx().strict(),h)}),[h]),u((()=>{v(g)}),[g]);const E=e=>{c({target:{value:e}})},A=e=>_===e,S=e=>`${s}-${e}`;return t(n,{children:[e(Q.CustomField,{id:s,label:a,errorMessage:i?.message,children:t(TB,{className:l,role:"radiogroup","aria-label":"string"==typeof p?p:aI(p.mainLabel,{allowedTags:[]}),children:[e(te,{...m,type:"yes",id:S("yes"),"data-testid":zE.generateId(s,"switch-yes"),disabled:f,styleType:!1===d?.border?"no-border":"default",checked:A(!0),onChange:()=>E(!0),indicator:!0,name:s,error:!!i?.message,children:"Yes"}),e(te,{...m,type:"no",id:S("no"),"data-testid":zE.generateId(s,"switch-no"),disabled:f,styleType:!1===d?.border?"no-border":"default",checked:A(!1),onChange:()=>E(!1),indicator:!0,name:s,error:!!i?.message,children:"No"})]})}),e(_I,{id:s,message:y})]})},TextField:r=>{const{error:i,formattedLabel:a,id:c,onChange:l,value:d,schema:f,warning:p,...h}=r,{customOptions:m,inputMode:g,label:y,uiType:_,validation:v,...b}=f,[E,A]=o(d||""),[S,w]=o({}),{setFieldValidationConfig:x}=n$(),T=s(null),M=s(0);u((()=>{switch(_){case"numeric-field":{x(c,lx(),v);const e=v?.find((e=>"min"in e)),t=v?.find((e=>"max"in e)),n={...S};e?.min>0&&(n.min=e.min),t?.max>0&&(n.max=t.max),w(n);break}case"email-field":{const e=v?.find((e=>e.email));x(c,ux().email(e?.errorMessage||Nm.EMAIL.INVALID),v);const t=v?.find((e=>"max"in e)),n=v?.find((e=>"length"in e)),r={...S};t?.max>0?r.maxLength=t.max:n?.length>0&&(r.maxLength=n.length),w(r);break}case"text-field":{x(c,ux(),v);const e=v?.find((e=>"max"in e)),t=v?.find((e=>"length"in e)),n={...S};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),w(n);break}}}),[v]),u((()=>{d!==E&&A(d||"")}),[d]),u((()=>{"text-field"===_&&document?.activeElement===T.current&&T.current.selectionEnd!==M.current&&T.current.setSelectionRange(M.current,M.current)}),[E]),u((()=>{"text-field"===f.uiType&&"uppercase"===f.customOptions?.textTransform&&E&&A((e=>e?.toString().toUpperCase()))}),["text-field"===f.uiType&&f.customOptions?.textTransform]);const O=()=>!!m?.addOn,N=O()?Q.InputGroup:Q.Input;return t(n,{children:[e(N,{...b,...h,...S,id:c,"data-testid":zE.generateId(c,_),ref:T,type:(()=>{switch(_){case"numeric-field":return"number";case"email-field":return"email";default:return"text"}})(),label:a,onPaste:e=>{const t=e.clipboardData.getData("text");(m?.preventCopyAndPaste||"numeric-field"===_&&/e/i.test(t))&&e.preventDefault()},onDrop:e=>m?.preventDragAndDrop?e.preventDefault():null,inputMode:(()=>{if(g)return g;switch(_){case"numeric-field":return"numeric";case"email-field":return"email";case"text-field":return"text";default:return"none"}})(),onChange:e=>{if("numeric-field"===_){const t=!isNaN(parseFloat(e.target.value))?+e.target.value:void 0;return l({target:{value:t}}),void A(t)}"text-field"===f.uiType?(M.current=e.target.selectionEnd,"uppercase"===f.customOptions?.textTransform&&(e.target.value=e.target.value.toUpperCase()),l(e)):l(e),A(e.target.value)},onKeyDown:e=>{"numeric-field"===_&&"e"===e.key.toLowerCase()&&e.preventDefault()},value:E,errorMessage:i?.message,addon:(()=>{if(O()){if("label"===m.addOn.type)return{type:"label",position:m.addOn.position,attributes:{value:m.addOn.value}};if("icon"===m.addOn.type){const{icon:t,position:n,color:r}=m.addOn,i=G[t];return{type:"custom",position:n,attributes:{children:e(MB,{as:i,$color:r})}}}}})()}),e(_I,{id:c,message:p})]})},Textarea:vR,TimeField:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{is24HourFormat:l,label:d,placeholder:f,useCurrentTime:p,validation:h,...m},value:g,warning:y,..._}=r,[v,b]=o(g||""),{setFieldValidationConfig:E}=n$();u((()=>{E(s,ux(),h)}),[h]),u((()=>{if(p&&!g){const e=l?"H:mm":"h:mma";setTimeout((()=>A(e)))}else b(g)}),[g,p,l]);const A=e=>{const t=Cm.formatDateTime(Gf.now().toString().toUpperCase(),e,"time");b(t),c({target:{value:t}})};return t(n,{children:[e(Q.Timepicker,{...m,..._,id:s,"data-testid":zE.generateId(s,"time"),label:a,errorMessage:i?.message,value:v,placeholder:f,format:l?"24hr":"12hr",onChange:e=>{c({target:{value:e}})}}),e(_I,{id:s,message:y})]})},get EFieldType(){return OB},UnitNumberField:r=>{const{formattedLabel:i,error:a,id:s,onChange:c,schema:{label:l,validation:d,...f},value:p,warning:h,...m}=r,[g,y]=o(p||""),{setFieldValidationConfig:_}=n$();u((()=>{const e=d?.find((e=>"unitNumberFormat"in e));_(s,ux().matches(/^([a-zA-Z0-9]{1,3}-[a-zA-Z0-9]{1,5})$/,{excludeEmptyString:!0,message:e?.errorMessage||Nm.UNIT_NUMBER.INVALID}),d)}),[d]),u((()=>{y(p||"")}),[p]);return t(n,{children:[e(Q.UnitNumberInput,{...f,...m,id:s,"data-testid":zE.generateId(s,"unit-number"),label:i,value:g,onChange:e=>{c({target:{value:e}})},errorMessage:a?.message}),e(_I,{id:s,message:h})]})}});const CB=({id:t,children:r,childSchema:i})=>{if("columns"in i){if((a=i.columns)&&("xxs"in a||"xs"in a||"sm"in a||"md"in a||"lg"in a||"xl"in a||"xxl"in a)){const{xxs:n,xs:a,sm:o,md:s,lg:u,xl:c,xxl:l,...d}=i.columns||{};return e(F.ColDiv,{"data-testid":zE.generateId(t,"grid_item"),xlCols:c,lgCols:u,mdCols:s,smCols:o,xsCols:a,xxlCols:l,xxsCols:n,...d,children:r})}const{desktop:n,tablet:o,mobile:s,...u}=i.columns||{};return e(he.ColDiv,{"data-testid":zE.generateId(t,"grid_item"),desktopCols:n??12,tabletCols:o,mobileCols:s,...u,children:r})}var a;return e(n,{children:r})},DB=({id:t,renderRules:r,children:i,schema:a})=>{const{formValidationConfig:s,removeFieldValidationConfig:u}=n$(),[c,l]=o(void 0),{formValues:d}=t$(),{unregister:f}=Ye();Us((()=>{if($E(r))return;const e=p();if(e!==c){if(!e){[t,...h(a)].forEach((e=>{u(e),f(e)}))}l(e)}}),[s,d,r]);const p=()=>{if($E(r))return!0;let e=!1;return r.forEach((t=>{if(!e){const n={};Object.entries(t).forEach((([e,t])=>{if(t.find((e=>e.shown))&&!s?.[e])return void(n[e]={schema:Qw().test("shown",(()=>!1)),validationRules:[]});const r=s?.[e]?.schema.type;if(r){let i=EI.mapSchemaType(r);"number"===r&&(i=i.nullable().transform(((e,t)=>!isNaN(parseFloat(t?.toString()))?+t:void 0))),n[e]={schema:i,validationRules:t}}}));const r=EI.buildSchema(n);try{r.validateSync(d),e=!0}catch(e){}}})),e},h=e=>{const n=e.children,r=[];switch(e.uiType){case"chips":r.push(t+"-textarea");break;case"checkbox":case"radio":e.options.forEach((e=>{const t=e.children;!$E(t)&&Dn(t)&&Object.entries(t).forEach((([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))}))}))}return $E(n)||!Dn(n)||Object.entries(n).forEach((([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))})),r};return $E(r)||c?e(n,{children:i}):null},LB=Object.keys(OB),IB=Object.keys(v$),kB=t=>{const{id:r,schema:i,children:a}=t,{showIf:s,uiType:u,children:c,...l}=i||{},{warnings:d}=s$(),[f,p]=o(null),{control:h}=Ye(),{getCustomComponent:m}=ZI(),{formSchema:{overrides:g},overrideSchema:_}=e$();UI((()=>{const t=_(c||a,g);if("object"==typeof t){const n=[];Object.keys(t).forEach((r=>{const i=t[r];if($E(i)||"object"!=typeof i)return;let a=e(y,{children:Nm.GENERIC.UNSUPPORTED},r);if("referenceKey"in i){const t=i.referenceKey.toUpperCase();a=m(i.referenceKey)||Z$[F$[t]]?v(r,i)(b):Z$[P$[t]]?v(r,i)(E):e(y,{},r)}else"uiType"in i&&(LB.includes(i.uiType.toUpperCase())?a=v(r,i)(b):IB.includes(i.uiType.toUpperCase())&&(a=v(r,i)(E)));n.push(a)})),p(n)}else p("string"==typeof t?t:Nm.GENERIC.UNSUPPORTED)}),[c||a,g,h,d,m]);const v=(t,n)=>r=>e(DB,{id:t,...n&&"showIf"in n&&{renderRules:n.showIf},schema:n,children:r(t,n)},t),b=(t,n)=>{let r;return"uiType"in n?r=NB[OB[n.uiType?.toUpperCase()]]:"referenceKey"in n&&(r=Z$[F$[n.referenceKey?.toUpperCase()]]||m(n.referenceKey)),r?e(CB,{id:t,childSchema:n,children:e(pR,{id:t,schema:n,Field:r,warning:d?.[t]})}):null},E=(t,n)=>{let r;return"uiType"in n?r=b$[v$[n.uiType?.toUpperCase()]]||kB:"referenceKey"in n&&(r=Z$[P$[n.referenceKey?.toUpperCase()]]),e(CB,{id:t,childSchema:n,children:e(r,{schema:n,id:t})})};return u?e(u,{...l,id:r,"data-testid":zE.generateId(r,u),children:f}):e(n,{children:f})},$B=C(F.Container)`
|
|
1129
|
+
`;var OB;!function(e){e.BUTTON="ButtonField",e.CHECKBOX="CheckboxGroup",e.CHIPS="Chips",e["CONTACT-FIELD"]="ContactField",e["DATE-FIELD"]="DateField",e["DATE-RANGE-FIELD"]="DateRangeField",e["EMAIL-FIELD"]="TextField",e["E-SIGNATURE-FIELD"]="ESignatureField",e["ERROR-FIELD"]="ErrorField",e["FILE-UPLOAD"]="FileUpload",e["HIDDEN-FIELD"]="HiddenField",e["HISTOGRAM-SLIDER"]="HistogramSlider",e["IMAGE-UPLOAD"]="ImageUpload",e["LOCATION-FIELD"]="LocationField",e["MASKED-FIELD"]="MaskedField",e["MULTI-SELECT"]="MultiSelect",e["NESTED-MULTI-SELECT"]="NestedMultiSelect",e["RANGE-SELECT"]="RangeSelect",e["NUMERIC-FIELD"]="TextField",e["OTP-VERIFICATION-FIELD"]="OtpVerificationField",e.RADIO="RadioButtonGroup",e.RESET="ResetButton",e.SELECT="Select",e["SELECT-HISTOGRAM"]="SelectHistogram",e.SLIDER="Slider",e.SUBMIT="SubmitButton",e.SWITCH="Switch",e.TEXTAREA="Textarea",e["TEXT-FIELD"]="TextField",e["TIME-FIELD"]="TimeField",e["UNIT-NUMBER-FIELD"]="UnitNumberField"}(OB||(OB={}));var NB=Object.freeze({__proto__:null,ButtonField:n=>{const{schema:{label:r,uiType:i,startIcon:a,endIcon:o,href:s,target:u,...c},id:l,...d}=n,{dispatchFieldEvent:f}=BI(),p=t=>{if(!t)return null;const n=G[t];return e(n,{})};return t(U$,{type:"button",...c,...d,onClick:e=>{f("click",l,e),s&&(e=>{try{return!!new URL(e)}catch{return!1}})(s)&&(u?window.open(s,u,"noopener noreferrer"):window.location.href=s)},children:[p(a),r,p(o)]})},CheckboxGroup:r=>{const{formattedLabel:i,error:a,id:s,onChange:c,schema:{className:l,customOptions:d,disabled:f,label:p,options:h,validation:m,...g},value:y,warning:_}=r,{setValue:v}=Ye(),[b,E]=o(y||[]),{setFieldValidationConfig:A}=n$();u((()=>{const e=m?.find((e=>"required"in e));A(s,xT().of(ux()).test("is-empty-array",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!t||!e?.required||t.length>0)),m)}),[m]),Zs((()=>{const e=y?.filter((e=>h.find((t=>t.value===e))));v(s,e)}),[h]),u((()=>{E(y||[])}),[y]);const S=(e,t)=>{const n=h.find((e=>!0===e.none));let r=[...b];t?r=r.includes(e)?[]:[e]:r.includes(e)?r=sR(r,e,n?.value):(r.push(e),r=sR(r,n?.value)),c({target:{value:r}})},w=e=>b.includes(e),x=()=>{const e=Lm();return`${s}-${e}`},T=t=>"string"==typeof t?e(oI,{inline:!0,children:t}):e(kB,{children:t});return t(n,{children:[e(Q.CustomField,{id:s,label:i,errorMessage:a?.message,children:e("div",{role:"group",children:"toggle"===d?.styleType?h.length>0&&"toggle"===d.styleType&&e(dR,{$layoutType:d?.layoutType??"horizontal",className:l?`${l}-checkbox-container`:void 0,children:h.map(((t,n)=>{const r=x();return e(fR,{type:"checkbox","data-testid":zE.generateId(s,"toggle"),id:r,className:l,disabled:f??t.disabled,focusableWhenDisabled:f,name:r,indicator:d?.indicator,styleType:!1===d?.border?"no-border":"default",checked:w(t.value),onChange:()=>S(t.value,t.none),error:!!a?.message,compositeSection:t.children?{children:e(kB,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&T(t.subLabel),children:T(t.label)},n)}))}):h.length>0&&h.map(((n,r)=>{const i=x();return t(lR,{className:l?`${l}-checkbox-container`:void 0,children:[e(cR,{...g,"data-testid":zE.generateId(s,"checkbox"),id:i,className:l,disabled:f??n.disabled,name:i,value:n.value,focusableWhenDisabled:f,checked:w(n.value),onChange:()=>S(n.value)}),e(uR,{forwardedAs:"label",htmlFor:i,disabled:f??n.disabled,children:T(n.label)})]},r)}))})}),e(_I,{id:s,message:_})]})},Chips:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{disabled:l,label:d,options:f,textarea:p,validation:m,...g},value:y,warning:_,...v}=r,[b,E]=o(y||[]),[A,S]=o(!1),[w,x]=o(!0),{setValue:T,unregister:M}=Ye(),{setFieldValidationConfig:O,removeFieldValidationConfig:N}=n$();u((()=>{A||M(D())}),[]),u((()=>{const e=m?.find((e=>"required"in e)),t=m?.find((e=>"max"in e)),n=m?.find((e=>"length"in e));O(s,xT().of(ux()).test("is-empty-array",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!t||!e?.required||t.length>0)),m),1!==t?.max&&1!==n?.length||x(!1)}),[m]),Zs((()=>{const e=[...f.map((e=>e.value)),p?.label],t=y?.filter((t=>e.includes(t)));T(s,t)}),[f]),u((()=>{y?.includes(L())?I(!0):I(),E(y||[])}),[y]);const C=e=>b.includes(e),D=()=>`${s}-textarea`,L=()=>"string"==typeof p?.label?p?.label:p?.label?.mainLabel,I=(e=!1)=>{S(e),e||N(D())},k=e=>{let t=[...b];if(t.includes(e))return t=t.filter((t=>t!==e)),void c({target:{value:t}});w?t.push(e):t=[e],c({target:{value:t}})};return t(n,{children:[t(Q.CustomField,{label:a,errorMessage:i?.message,...v,children:[t(bR,{"data-testid":zE.generateId(s,"chips"),$showTextarea:A,children:[f.map(((e,t)=>h(LT,{...g,key:t,onClick:()=>k(e.value),isActive:C(e.value),disabled:l??e.disabled},e.label))),(()=>{if(!p?.label)return;const t=L();return e(LT,{...g,onClick:()=>{k(t)},isActive:C(t),children:t})})()]}),(()=>{if(!p?.label)return e(n,{});const t=D(),r={uiType:"textarea",className:g.className?`${g.className}-textarea`:void 0,...p};return A?e(pR,{id:t,schema:r,Field:vR}):e(n,{})})()]}),e(_I,{id:s,message:_})]})},ContactField:r=>{const{isDirty:i,formattedLabel:a,error:s,id:c,name:l,onChange:d,schema:{defaultCountry:f,disabled:p,enableSearch:h,label:m,placeholder:g,validation:y,..._},value:v,warning:b,...E}=r,{resetField:A}=Ye(),[S,w]=o(v||""),x=o$(f),[T,M]=o(f),[O]=o((()=>{const e=new Map;return ER.forEach((t=>{const[n,...r]=t,i=r.find((e=>/^\d+$/.test(e)));e.set(n,i)})),e})()),[N,C]=o(),[D,L]=o(),[I,k]=o(void 0),{setFieldValidationConfig:$}=n$();u((()=>{const e=y?.find((e=>"contactNumber"in e)),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber,r=e?.errorMessage;O.has(n)?(M(n),k(!0)):["default","house","mobile"].includes(t)?(M("Singapore"),k(!0)):k(!1),L(t),$(c,ux().test("singaporeNumber",r||Nm.CONTACT.INVALID_SINGAPORE_NUMBER,(e=>!e||!t||TP.isSingaporeNumber(e,t))).test("internationalNumber",r||Nm.CONTACT.INVALID_INTERNATIONAL_NUMBER,(e=>!(e&&!t&&n)||TP.isInternationalNumber(N?.name,e))),y)}),[y,N]),u((()=>{const e=T||"Singapore";C({name:e,prefix:O.get(e)})}),[T,O]),u((()=>{const e=y?.find((e=>"contactNumber"in e)),t=e?.contactNumber?.singaporeNumber,n=e?.contactNumber?.internationalNumber;!f||x===f||O.has(n)||["default","house","mobile"].includes(t)||M(f)}),[y,f]),u((()=>{if(void 0!==I&&!i){const{prefix:e,number:t}=TP.getParsedPhoneNumber(v||""),n=e.replace(/\+/g,""),r=(e=>{for(const[t,,,n]of ER)if(t===e)return n})(T||"Singapore");if(!I||I&&n===r){const n=R({countryCode:e||r,number:t});A(c,{defaultValue:n,keepDirty:!0})}else{const e=R({countryCode:"",number:""});A(c,{defaultValue:e,keepDirty:!0})}}}),[v,i,I,T]);const R=e=>{const{countryCode:t,number:n}=e,r=t.replace(/\+/g,"");if(!1===I&&r!==N?.prefix){const e=((e,t)=>{for(const[n,r]of t.entries())if(r===e)return n})(r,O);e&&C({name:e,prefix:t})}return w(n),TP.formatPhoneNumber(e.countryCode,e.number)||""};return t(n,{children:[e(Q.PhoneNumberInput,{..._,...E,"data-testid":zE.generateId(c,"contact"),disabled:p,enableSearch:h,errorMessage:s?.message,fixedCountry:I,id:c,label:a,name:l,placeholder:(()=>{if(g)return g;if(D){return`Enter ${"mobile"===D?"mobile":"home"} number`}return"Enter contact number"})(),value:(()=>{if(!N)return;const{prefix:e}=N;return{number:S,countryCode:e}})(),onChange:e=>{const t=R(e);d({target:{value:t}})}}),e(_I,{id:c,message:b})]})},DateField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onChange:l,schema:{label:d,useCurrentDate:f,dateFormat:p=MP,validation:h,...m},value:g,warning:y,..._}=r,{setValue:v}=Ye(),[b,E]=o(g||""),[A,S]=o(),{setFieldValidationConfig:w}=n$();u((()=>{const e=h?.find((e=>"dateFormat"in e&&e.dateFormat)),t=h?.find((e=>"future"in e)),n=h?.find((e=>"past"in e)),r=h?.find((e=>"notFuture"in e)),i=h?.find((e=>"notPast"in e)),a=h?.find((e=>"minDate"in e)),o=h?.find((e=>"maxDate"in e)),u=h?.find((e=>"excludedDates"in e)),c=h?.find((e=>"withinDays"in e)),l=h?.find((e=>"beyondDays"in e)),d=Cm.toLocalDateOrTime(a?.minDate,p,"date"),f=Cm.toLocalDateOrTime(o?.maxDate,p,"date");w(s,ux().test("is-date",e?.errorMessage||Nm.DATE.INVALID,(e=>!e||""===e||!!M(e)&&!!Cm.toLocalDateOrTime(e,p,"date"))).test("future",t?.errorMessage||Nm.DATE.MUST_BE_FUTURE,(e=>{if(!M(e)||!t?.future)return!0;const n=Cm.toLocalDateOrTime(e,p,"date");return!!n?.isAfter(Bf.now())})).test("past",n?.errorMessage||Nm.DATE.MUST_BE_PAST,(e=>{if(!M(e)||!n?.past)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!!t?.isBefore(Bf.now())})).test("not-future",r?.errorMessage||Nm.DATE.CANNOT_BE_FUTURE,(e=>{if(!M(e)||!r?.notFuture)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isAfter(Bf.now())})).test("not-past",i?.errorMessage||Nm.DATE.CANNOT_BE_PAST,(e=>{if(!M(e)||!i?.notPast)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isBefore(Bf.now())})).test("min-date",a?.errorMessage||Nm.DATE.MIN_DATE(Cm.formatDateTime(a?.minDate,"dd/MM/uuuu","date")),(e=>{if(!M(e)||!d)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isBefore(d)})).test("max-date",o?.errorMessage||Nm.DATE.MAX_DATE(Cm.formatDateTime(o?.maxDate,"dd/MM/uuuu","date")),(e=>{if(!M(e)||!f)return!0;const t=Cm.toLocalDateOrTime(e,p,"date");return!t?.isAfter(f)})).test("excluded-dates",u?.errorMessage||Nm.DATE.DISABLED_DATES,(e=>!M(e)||!u||!u.excludedDates.includes(e))).test("within-days",c?.errorMessage||c?.withinDays&&Nm.DATE.WITHIN_DAYS(c?.withinDays),(e=>!M(e)||!c||Cm.checkWithinDays(e,{...c.withinDays,dateFormat:p}))).test("beyond-days",l?.errorMessage||l?.beyondDays&&Nm.DATE.BEYOND_DAYS(l?.beyondDays),(e=>!M(e)||!l||Cm.checkBeyondDays(e,{...l.beyondDays,dateFormat:p}))),h);const m=c?.withinDays&&Cm.calculateDisabledWithinDaysRange({...c.withinDays,dateFormat:p}),g=l?.beyondDays&&Cm.calculateDisabledBeyondDaysRange({...l.beyondDays,dateFormat:p}),y=T([d,t?.future&&Bf.now().plusDays(1),i?.notPast&&Bf.now(),m?.startDate,g?.startDate]),_=x([f,n?.past&&Bf.now().minusDays(1),r?.notFuture&&Bf.now(),m?.endDate,g?.endDate]),v=[...u?.excludedDates||[]];(y||_||v)&&S((e=>({...e,minDate:y?.format(OP),maxDate:_?.format(OP),disabledDates:v})))}),[h]),u((()=>{if(p)if(g)if(M(g)){const e=Cm.toLocalDateOrTime(g,p,"date");E(Cm.formatDateTime(e?.toString(),MP,"date",Nm.DATE.INVALID))}else E(Nm.DATE.INVALID);else if(!c)if(f){const e=Cm.formatDateTime(Bf.now().toString(),p,"date");v(s,e);const t=Cm.formatDateTime(Bf.now().toString(),MP,"date");E(t)}else E(void 0)}),[f,g,p,c]);const x=e=>e.filter((e=>e)).sort(((e,t)=>e.isAfter(t)?1:-1))?.[0],T=e=>e.filter((e=>e)).sort(((e,t)=>e.isBefore(t)?1:-1))?.[0],M=e=>e&&e!==Nm.DATE.INVALID;return t(n,{children:[e(Q.DateInput,{...m,..._,...A,id:s,"data-testid":zE.generateId(s,"date"),label:a,errorMessage:i?.message,onChange:e=>{l({target:{value:Cm.formatDateTime(e,p,"date",Nm.DATE.INVALID)}})},value:b}),e(_I,{id:s,message:y})]})},DateRangeField:r=>{const{error:i,formattedLabel:a,id:s,isDirty:c,onChange:l,schema:{dateFormat:d=CP,label:f,validation:p,variant:h,...m},value:g={from:void 0,to:void 0},warning:y,..._}=r,[v,b]=o(g.from||""),[E,A]=o(g.to||""),[S,w]=o(),{setFieldValidationConfig:x}=n$(),[T,M]=o([]);Zs((()=>{x(s,ST().shape({from:ux(),to:ux()}).test({name:"is-empty-string",test(e,t){M(t.schema.describe().meta?.rules??[]);const n=L(t.schema.describe().meta?.rules,"required");if(!e||!n)return!0;return!!(e.from?.length>0&&e.to?.length>0)||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.REQUIRED})}}).test({name:"is-date",test(e,t){const n=p?.find((e=>!!e&&"dateFormat"in e&&e.dateFormat));if(sI.exports.isEmpty(e?.from)||sI.exports.isEmpty(e?.to))return!0;return!(!C(e.from)||!C(e.to)||!Cm.toLocalDateOrTime(e.from,d,"date")||!Cm.toLocalDateOrTime(e.to,d,"date"))||t.createError({message:n?.errorMessage||Nm.DATE_RANGE.INVALID})}}).test({name:"number-of-days",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"numberOfDays"),r=n?.numberOfDays;if(!C(e.from)||!C(e.to)||!r)return!0;const i=Cm.toLocalDateOrTime(e.from,d,"date");return!!Cm.toLocalDateOrTime(e.to,d,"date").equals(i.plusDays(r-1))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MUST_HAVE_NUMBER_OF_DAYS(r)})}}).test({name:"future",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"future");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(!r?.isAfter(Bf.now())||!i?.isAfter(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MUST_BE_FUTURE})}}).test({name:"past",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"past");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(!r?.isBefore(Bf.now())||!i?.isBefore(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MUST_BE_PAST})}}).test({name:"not-future",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"notFuture");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(r?.isAfter(Bf.now())||i?.isAfter(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.CANNOT_BE_FUTURE})}}).test({name:"not-past",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"notPast");if(!C(e.from)||!C(e.to)||!n)return!0;const r=Cm.toLocalDateOrTime(e.from,d,"date"),i=Cm.toLocalDateOrTime(e.to,d,"date");return!(r?.isBefore(Bf.now())||i?.isBefore(Bf.now()))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.CANNOT_BE_PAST})}}).test({name:"min-date",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"minDate"),r=n?.minDate,i=r?Cm.toLocalDateOrTime(r,d,"date"):void 0;if(!C(e.from)||!C(e.to)||!i)return!0;const a=Cm.toLocalDateOrTime(e.from,d,"date"),o=Cm.toLocalDateOrTime(e.to,d,"date");return!(a?.isBefore(i)||o?.isBefore(i))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MIN_DATE(Cm.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"max-date",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"maxDate"),r=n?.maxDate,i=r?Cm.toLocalDateOrTime(r,d,"date"):void 0;if(!C(e.from)||!C(e.to)||!i)return!0;const a=Cm.toLocalDateOrTime(e.from,d,"date"),o=Cm.toLocalDateOrTime(e.to,d,"date");return!(a?.isAfter(i)||o?.isAfter(i))||t.createError({message:n?.errorMessage??Nm.DATE_RANGE.MAX_DATE(Cm.formatDateTime(r,"dd/MM/uuuu","date"))})}}).test({name:"excluded-dates",test(e,t){if("week"===h)return!0;const n=L(t.schema.describe().meta?.rules,"excludedDates"),r=n?.excludedDates;if(!C(e.from)||!C(e.to)||!r)return!0;const i=Cm.toLocalDateOrTime(e.from,d,"date"),a=Cm.toLocalDateOrTime(e.to,d,"date");try{const e=r.map((e=>Cm.toLocalDateOrTime(e,d,"date")));for(const r of e)if(i.isEqual(r)||a.isEqual(r))return t.createError({message:n?.errorMessage??Nm.DATE_RANGE.DISABLED_DATES});return!0}catch{return!1}}}),p);const e=L(T,"future"),t=L(T,"past"),n=L(T,"notFuture"),r=L(T,"notPast"),i=L(T,"minDate"),a=L(T,"maxDate"),o=L(T,"excludedDates"),u=L(T,"numberOfDays"),c=Cm.toLocalDateOrTime(i?.minDate,d,"date"),l=Cm.toLocalDateOrTime(a?.maxDate,d,"date"),f=N([c,e?.future&&Bf.now().plusDays(1),r?.notPast&&Bf.now()]),m=O([l,t?.past&&Bf.now().minusDays(1),n?.notFuture&&Bf.now()]),g=o?.excludedDates,y=u?.numberOfDays;w((e=>({...e,minDate:f?.format(DP),maxDate:m?.format(DP),disabledDates:g,numberOfDays:y})))}),[p,T]),u((()=>{D(NP.START)}),[g.from,d,c]),u((()=>{D(NP.END)}),[g.to,d,c]);const O=e=>e.filter((e=>e)).sort(((e,t)=>e.isAfter(t)?1:-1))?.[0],N=e=>e.filter((e=>e)).sort(((e,t)=>e.isBefore(t)?1:-1))?.[0],C=e=>e&&e!==Nm.DATE_RANGE.INVALID,D=e=>{const t=e===NP.START?g.from:g.to,n=e===NP.START?b:A;if(d)if(t)if(C(t)){const e=Cm.toLocalDateOrTime(t,d,"date");n(Cm.formatDateTime(e?.toString(),CP,"date",Nm.DATE_RANGE.INVALID))}else n(Nm.DATE_RANGE.INVALID);else c||n(void 0)},L=(e,t)=>{const n=e?.find((e=>t in e)),r=p?.find((e=>!!e&&t in e));return sI.exports.isEmpty(n)?sI.exports.isEmpty(r)?void 0:r:n};return t(n,{children:[e(Q.DateRangeInput,{...m,..._,...S,id:s,"data-testid":zE.generateId(s,"date"),label:a,errorMessage:i?.message,onChange:(e,t)=>{l({target:{value:{from:Cm.formatDateTime(e,d,"date",Nm.DATE_RANGE.INVALID),to:Cm.formatDateTime(t,d,"date",Nm.DATE_RANGE.INVALID)}}})},value:v,valueEnd:E,variant:h}),e(_I,{id:s,message:y})]})},get TDateRangeInputType(){return NP},ESignatureField:n=>{const{error:r,formattedLabel:i,id:a,onChange:c,schema:{label:l,uiType:d,upload:f,validation:p,...h},value:m,warning:g}=n,[y,_]=o(null),[v,b]=o(0),[E,A]=o(0),[S,w]=o(null),{setFieldValidationConfig:x}=n$(),T=s(null),{clearErrors:M}=Ye();u((()=>{const e=p?.find((e=>"upload"in e&&e.upload));T.current=e,x(a,ST().shape({fileId:ux().required(),dataURL:ux(),fileUrl:ux(),uploadResponse:Qw().nullable()}).default(void 0),p)}),[p]),u((()=>{if(A(0),N(m)){if(m.dataURL)_(m.dataURL);else if(m.fileUrl){const e=D(m.fileId,m.fileUrl);return()=>e.abort()}}else _(null)}),[m]);const O=async e=>{if(!e)return _(null),A(0),b(0),w(null),void c({target:{value:null}});const t=Lm();if(_(e),A(0),$E(f))c({target:{value:{fileId:t,dataURL:e}}});else try{const n=await C(t,e);c({target:{value:{fileId:t,..."base64"===f.type&&{dataURL:e},fileUrl:n?.data?.fileUrl,uploadResponse:n}}}),M(a),b(0)}catch(e){b((e=>e+1)),w(null)}},N=e=>!!e,C=async(e,t)=>{w(0);const n=new FormData;if(n.append("fileId",e),f.sessionId&&n.append("sessionId",f.sessionId),"base64"===f.type)n.append("dataURL",t);else if("multipart"===f.type){const r=await Om.dataUrlToBlob(t),i=Om.blobToFile(r,{name:e,lastModified:Date.now()});n.append("file",i,e)}const r=await new kl("",void 0,void 0,!0).post(f.url,n,{headers:{"Content-Type":"base64"===f.type?"application/json":"multipart/form-data",...f.headers},onUploadProgress:e=>{const{loaded:t,total:n}=e;w(t/n)}});return w(null),r},D=(e,t)=>{const n=new AbortController;return(async()=>{try{const r=await new kl("",void 0,void 0,!1,{responseType:"blob"}).get(t,{signal:n.signal}),i=await Om.getType(new File([r],e)),a=new File([r],e,{type:i.mime}),o=await Om.fileToDataUrl(a);_(o),A(0)}catch(e){if(e instanceof _l)return;A((e=>e+1))}})(),n};return t(LP,{children:[e(Q.ESignature,{...h,id:a,label:i,onChange:O,value:y,...null!==S&&{loadingProgress:S}}),(r?.message||v||E)&&null===S?v>0?t(IP,{children:[T.current?.errorMessage||Nm.ESIGNATURE.UPLOAD,e(kP,{type:"button",onClick:()=>O(y),children:"Please try again."}),v>=3&&e($P,{type:"warning","data-testid":"upload-refresh-alert",children:"Refresh this page if you cannot upload your signature."})]}):E>0&&N(m)?t(IP,{children:["Failed to load.",e(kP,{type:"button",onClick:()=>D(m.fileId,m.fileUrl),children:"Please try again."}),E>=3&&e($P,{type:"warning","data-testid":"load-refresh-alert",children:"Refresh this page if your signature failed to load."})]}):e(IP,{children:r?.message}):null,e(_I,{id:a,message:g})]})},ErrorField:t=>{const{id:n,schema:{children:r}}=t,{setFieldValidationConfig:i}=n$();return u((()=>{i(n,Qw().test((()=>!1)),[])}),[]),r?e(kB,{children:r}):null},FileUploadInner:dF,FileUpload:t=>e(sF,{children:e(dF,{...t})}),get EFileStatus(){return cF},HiddenField:t=>{const{id:n,name:r,onBlur:i,onChange:a,schema:{showIf:o,uiType:s,validation:c,valueType:l,value:d,...f},value:p}=t,{setFieldValidationConfig:h}=n$(),{setValue:m}=Ye();return u((()=>{let e;switch(l){case"null":e=Qw();break;case"number":e=lx();break;case"boolean":e=tx();break;default:e=ux()}h(n,e,c)}),[c,l]),u((()=>{"null"===l&&null!==p?m(n,null):PE(d)||p===d||m(n,d)}),[m,n,l,d,p]),e("input",{onBlur:i,onChange:a,...f,type:"hidden",id:n,"data-testid":n,name:r,value:d??p??""})},HistogramSlider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,bins:d,interval:f,validation:p,disabled:h,readOnly:m,className:g,ariaLabels:y,customOptions:_},value:v,warning:b}=r,{resetField:E}=Ye(),[A,S]=o(void 0),{setFieldValidationConfig:w}=n$();u((()=>{if(v)S([v.from,v.to]);else{const e=Math.min(...d.map((e=>e.minValue))),t=Math.max(...d.map((e=>e.minValue)))+f;E(s,{defaultValue:{from:e,to:t},keepDirty:!0}),S([e,t])}}),[v]),u((()=>{const e=p?.find((e=>"required"in e)),t=p?.find((e=>"bin"in e&&e.bin)),n=p?.find((e=>"incremental"in e&&e.incremental)),r=p?.find((e=>"withinRange"in e&&e.withinRange));w(s,ST({from:lx(),to:lx()}).test("is-required",e?.errorMessage||Nm.COMMON.REQUIRED_OPTIONS,(t=>!t||!e||!PE(t.from)&&!PE(t.to))).test("is-bin",t?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...d.map((e=>e.minValue)));return Number.isInteger((t-r)/f)&&Number.isInteger((n-r)/f)})).test("is-incremental",n?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to)).test("is-within-range",r?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...d.map((e=>e.minValue))),i=Math.max(...d.map((e=>e.minValue)))+f;return!(t<r||n>i)})),p)}),[p,d,f]);return t(n,{children:[e(Q.HistogramSlider,{..._,id:s,"data-testid":zE.generateId(s,"histogram-slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{const[t,n]=e;c({target:{value:{from:t,to:n}}})},value:A,bins:d,interval:f,disabled:h,readOnly:m,className:g,ariaLabels:y}),e(_I,{id:s,message:b})]})},ImageUploadInner:sB,ImageUpload:t=>e(pF,{children:e(sB,{...t})}),ACCEPTED_FILE_TYPES:mF,get EImageStatus(){return gF},LocationField:n=>{const{error:r,formattedLabel:i,id:a,schema:{className:s="location",mapApi:c,disabled:l,gettingCurrentLocationFetchMessage:d,interactiveMapPinIconUrl:f,label:p,locationInputPlaceholder:h,locationListTitle:m,locationModalStyles:g,mapBannerText:y,mapPanZoom:_,mustHavePostalCode:b,readOnly:E,staticMapPinColor:A,validation:S,hasExplicitEdit:w,locationSelectionMode:x="default",disableSearch:T,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:N,pinsOnlyIndicateCurrentLocation:C,legendItems:D},value:L,warning:I}=n,[$,R]=o(!1),{setValue:z}=Ye(),{setFieldValidationConfig:P}=n$(),{dispatchFieldEvent:F,addFieldEventListener:Z,removeFieldEventListener:U}=BI();u((()=>(Z("show-location-modal",a,V),F("show-location-modal-ready",a),()=>{U("show-location-modal",a,V)})),[]),u((()=>{const e=S?.find((e=>"required"in e)),t=S?.find((e=>"postalCode"in e));P(a,ST({address:ux(),blockNo:ux(),building:ux(),lat:lx(),lng:lx(),postalCode:ux(),roadName:ux(),x:lx(),y:lx()}).test("is-required",e?.errorMessage||Nm.COMMON.FIELD_REQUIRED,(t=>!e?.required||!!t&&!!t.lat&&!!t.lng)).test("must-have-postal-code",t?.errorMessage||Nm.LOCATION.MUST_HAVE_POSTAL_CODE,(t=>!e||!b||fI.hasGotAddressValue(t.postalCode))),S)}),[S]);const B=(e,t=!0)=>{z(a,e,{shouldDirty:t})},j=()=>{E||l||(R(!0),F("show-location-modal",a))},V=()=>{R(!0)};return t("div",{id:a,"data-testid":zE.generateId(a),className:s,children:[e(mB,{id:a,label:i,className:s,locationInputPlaceholder:h,onChange:e=>e.currentTarget.blur(),onFocus:j,value:L?.address||"",errorMessage:r?.message,disabled:"explicit"===w&&!!L?.address||l,readOnly:E}),w&&L?.address&&e(k.Default,{id:zE.generateId(a,"edit-button"),"data-testid":zE.generateId(a,"edit-button"),styleType:"secondary",onClick:()=>{!F("click-edit-button",a)||R(!0)},type:"button",children:"Edit"}),!!L?.lat&&!!L?.lng&&e(yI,{id:a,className:`${s}-static-map`,lat:L.lat,lng:L.lng,staticMapPinColor:A,onClick:j,disabled:l}),e(v,{fallback:null,children:gB&&e(gB,{id:a,className:s,showLocationModal:$,onClose:()=>{R(!1),F("hide-location-modal",a)},formValues:L,onConfirm:B,updateFormValues:B,mapPanZoom:_,mapApi:c,interactiveMapPinIconUrl:f,gettingCurrentLocationFetchMessage:d,mustHavePostalCode:b,locationModalStyles:g,locationListTitle:m,mapBannerText:y,locationSelectionMode:x,disableSearch:T,addressFieldPlaceholder:M,searchBarIcon:O,bufferRadius:N,pinsOnlyIndicateCurrentLocation:C,legendItems:D})}),e(_I,{id:a,message:I})]})},GeolocationPositionErrorWrapper:yB,MaskedField:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,value:l,schema:{label:d,uiType:f,validation:p,maskRegex:h,iconMask:m,iconUnmask:g,...y},warning:_,...v}=r,[b,E]=o(l||""),[A,S]=o({}),{setFieldValidationConfig:w}=n$();u((()=>{w(s,ux(),p);const e=p?.find((e=>"max"in e)),t=p?.find((e=>"length"in e)),n={...A};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),S(n)}),[p]),u((()=>{l!==b&&E(l||"")}),[l]);const x=t=>{if(!t)return;const n=G[t];return e(n,{"data-testid":t})};return t(n,{children:[e(Q.MaskedInput,{...y,...v,...A,id:s,"data-testid":zE.generateId(s,f),label:a,onChange:e=>{c(e)},value:b,errorMessage:i?.message,maskRegex:(()=>{if(h)try{const e=h.match(/\/(.*)\/([a-z]+)?/);return new RegExp(e[1],e[2])}catch(e){console.warn(`invalid regex pattern: ${h}`)}})(),iconMask:x(m),iconUnmask:x(g)}),e(_I,{id:s,message:_})]})},MultiSelect:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,options:d=[],validation:f,...p},value:h,warning:m,...g}=r,{setValue:y}=Ye(),[_,v]=o(h||[]),{setFieldValidationConfig:b}=n$();u((()=>{const e=f?.find((e=>"required"in e));b(s,xT().of(ux()).test("is-empty-array",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!t||!e?.required||t.length>0)),f)}),[f]),Us((()=>{const e=h?.filter((e=>d.find((t=>t.value===e))));y(s,e)}),[d]),u((()=>{v(h||[])}),[h]);return t(n,{children:[e(Q.MultiSelect,{...p,...g,id:s,"data-testid":zE.generateId(s),label:a,options:d,onSelectOptions:e=>{const t=e.map((e=>e.value));c({target:{value:t}})},selectedOptions:d.filter((e=>_.includes(e.value))),valueExtractor:e=>e.value,listExtractor:e=>e.label,errorMessage:i?.message}),e(_I,{id:s,message:m})]})},OtpVerificationField:r=>{const{error:i,id:a,value:c,formattedLabel:l,onChange:d,warning:f,schema:{validation:p,request:h,verification:m,withPrefix:g,verifyOtpCountdownTimer:y,prefixSeparator:_,type:v,...b}}=r,[E,A]=o(c?.otpCode||""),[S,w]=o(c?.otpPrefix),x=s(c?.transactionId),T=s(-1),M=s(-1),O=c?.state||"default",N=c?.contact||"",C={number:"phone-number"===v?N:"",countryCode:"+65"},D=p?.find((e=>"otp-type"in e)),L=p?.find((e=>"required"in e)),{setFieldValidationConfig:I}=n$(),{formState:k,setError:$,clearErrors:R}=Ye(),{submitCount:z}=k;u((()=>{I(a,ST().test(_B.IS_OTP_VERIFIED,L?.errorMessage||F(),(e=>!L?.required||"verified"===e?.state)),p)}),[p,O]);const P=async()=>{const e=D?.["otp-type"]??void 0;if("email"===e&&(t=N,!ux().required().email().isValidSync(t)))throw $(a,{type:_B.IS_EMAIL_VALID,message:D?.errorMessage||Nm.OTP_VERIFICATION.INVALID_EMAIL}),new Error;var t;const n=`${C.countryCode}${C.number}`;if("phone-number"===e&&!(e=>TP.isSingaporeNumber(e))(n))throw $(a,{type:_B.IS_PHONE_NUMBER_VALID,message:D?.errorMessage||Nm.OTP_VERIFICATION.INVALID_PHONE}),new Error;const r={type:v,..."email"===v?{email:N}:{phoneNo:n},...void 0!==g&&{withPrefix:g}},i=await new kl("",void 0,void 0,!0).post(h.endpoint.url,r).catch((e=>{const t=e?.message||Nm.OTP_VERIFICATION.SEND_OTP_FAILED;throw $(a,{type:_B.SEND_OTP_FAILED,message:t}),new Error(t)})),o=i?.transactionId??i?.data?.transactionId,s=i?.prefix??i?.data?.prefix;x.current=o,s&&w(s),R(a),T.current=z,d({target:{value:{contact:"email"===e?N:C.number,otpPrefix:s??S,type:v,state:"sent"}}})},F=()=>"default"===O?"email"===v?Nm.OTP_VERIFICATION.EMAIL_VERIFICATION_REQUIRED:Nm.OTP_VERIFICATION.PHONE_VERIFICATION_REQUIRED:"sent"===O?Nm.OTP_VERIFICATION.OTP_REQUIRED:void 0,Z={...b,id:a,"data-testid":zE.generateId(a,"otp-verification-field"),label:l,otpState:O,onOtpStateChange:e=>{"default"===e&&(A(""),w(void 0),x.current=void 0,d({target:{value:{...c,state:void 0,additionalData:void 0,otpPrefix:void 0}}}))},onSendOtp:P,onResendOtp:P,onVerifyOtp:async e=>{const t="email"===v?N:C.number,n=await new kl("",void 0,void 0,!0).post(m.endpoint.url,{transactionId:x.current,otp:e,otpPrefix:S}).catch((e=>{const t=e?.message||Nm.OTP_VERIFICATION.OTP_VERIFICATION_FAILED;throw $(a,{type:_B.OTP_VERIFICATION_FAILED,message:t}),new Error(t)}));d({target:{value:{contact:t,otpPrefix:S,type:v,state:"verified",additionalData:n?.additionalData??n?.data?.additionalData}}})},sendOtpError:(()=>{if("sent"===O)return;if(i?.type===_B.IS_EMAIL_VALID||i?.type===_B.IS_PHONE_NUMBER_VALID||i?.type===_B.SEND_OTP_FAILED)return i?.message;return k.isSubmitted&&z>M.current&&i?.type===_B.IS_OTP_VERIFIED?i?.message:void 0})(),verifyOtpError:(()=>{if("sent"!==O)return;return i?.type===_B.IS_OTP_VERIFIED&&z>T.current||i?.type===_B.OTP_VERIFICATION_FAILED||i?.type===_B.API_ERROR?i?.message:void 0})(),otpValue:{value:E,...S&&{prefix:S},..._&&{prefixSeparator:_}},onOtpChange:e=>{R(a),A(e)},...void 0!==h.placeholder&&{sendOtpPlaceholder:h.placeholder},...void 0!==y&&{verifyOtpCountdownTimer:y},...void 0!==m.showThumbnail&&{showVerifyOtpThumbnail:m.showThumbnail},...void 0!==m.title&&{verifyOtpTitle:m.title},...void 0!==m.message&&{verifyOtpMessage:m.message}};return t(n,{children:[e(Q.OtpVerification,"email"===v?{...Z,type:"email",emailValue:N,onEmailChange:e=>{M.current=z,R(a),d({target:{value:{...c,contact:e}}})}}:{...Z,type:"phone-number",phoneNumberValue:C,onPhoneNumberChange:e=>{M.current=z,R(a);let t=e.number;e.number||(t=""),d({target:{value:{...c,contact:t}}})},fixedCountry:!0}),e(_I,{id:a,message:f})]})},get EOtpVerificationErrorType(){return _B},NestedMultiSelect:r=>{const{schema:{label:i,validation:a,options:s=[],...c},id:l,value:d,formattedLabel:p,onChange:h,onBlur:m,error:g,warning:y,..._}=r,{setValue:v}=Ye(),{setFieldValidationConfig:b}=n$(),[E,A]=o(d),[S,w]=o([]),x=f((e=>{const t=[],n=(e,r)=>{for(const i in e){const a=[...r,i],o=e[i];"string"==typeof o?t.push(a):n(o,a)}};return n(e,[]),t}),[]);u((()=>{const e=a?.find((e=>"required"in e));b(l,ST().test("is-required",e?.errorMessage||Nm.COMMON.REQUIRED_OPTION,(t=>!e?.required||!!t&&!!Object.keys(t).length)),a)}),[a]),Us((()=>{const e=(t,n)=>{const r={};for(const i of t){const{key:t,subItems:a}=i,o=n[t];if(o){const n="string"==typeof o?o:e(a||[],o);Object.keys(n).length?r[t]=n:delete r[t]}}return r},t=d?e(s,d):d;v(l,t)}),[s]),u((()=>{A(d);const e=x(d);w(e)}),[x,E,d]);return t(n,{children:[e(Q.NestedMultiSelect,{...c,..._,id:l,"data-testid":zE.generateId(l),label:p,options:s,onSelectOptions:(e,t)=>{const n=((e,t)=>{const n={};return e.forEach(((e,r)=>{e.reduce(((n,i,a)=>(a===e.length-1?n[i]=t[r]:n[i]||(n[i]={}),n[i])),n)})),n})(e,t);h({target:{value:n}})},onBlur:m,selectedKeyPaths:S,errorMessage:g?.message}),e(_I,{id:l,message:y})]})},RadioButtonGroup:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{className:l,customOptions:d,disabled:f,label:p,options:m,validation:g,...y},value:_,warning:v}=r,{setValue:b}=Ye(),[E,A]=o(_||""),{setFieldValidationConfig:S}=n$();u((()=>{S(s,ux(),g)}),[g]),Zs((()=>{m.find((e=>e.value===_))||b(s,"")}),[m]),u((()=>{A(_||"")}),[_]);const w=e=>{c({target:{value:e}})},x=e=>E===e,T=()=>{const e=Lm();return`${s}-${e}`},M=t=>"string"==typeof t?e(oI,{inline:!0,children:t}):e(kB,{children:t});return t(n,{children:[e(Q.CustomField,{id:s,label:a,errorMessage:i?.message,children:e("div",{role:"radiogroup",tabIndex:0,children:(()=>{switch(d?.styleType){case"toggle":return m.length>0&&"toggle"===d.styleType&&e(wB,{className:l?`${l} ${l}-radio-container`:void 0,$layoutType:d?.layoutType??"horizontal",children:m.map(((t,n)=>{const r=T();return h(xB,{...y,key:n,type:"radio",id:r,className:l?`${l}-radio`:void 0,"data-testid":zE.generateId(s,"radio"),disabled:f??t.disabled,focusableWhenDisabled:f,name:r,indicator:d?.indicator,styleType:!1===d?.border?"no-border":"default",checked:x(t.value),onChange:()=>w(t.value),error:!!i?.message,compositeSection:t.children?{children:e(kB,{children:t.children}),collapsible:!1}:null,subLabel:!!t.subLabel&&M(t.subLabel)},M(t.label))}))});case"image-button":return m.length>0&&e(SB,{className:l?`${l} ${l}-radio-container`:void 0,children:m.map(((e,t)=>{const n=T();return h(EB,{...y,type:"button",key:t,id:n,className:l?`${l}-radio`:void 0,"data-testid":zE.generateId(s,"radio"),disabled:f??e.disabled,focusableWhenDisabled:f,name:n,selected:x(e.value),onClick:()=>w(e.value),imgSrc:e.imgSrc,error:!!i?.message},e.label)}))});default:return m.length>0&&m.map(((n,r)=>{const i=T();return t(AB,{className:l?`${l}-radio-container`:void 0,children:[e(bB,{...y,className:l,id:i,"data-testid":zE.generateId(s,"radio"),disabled:f??n.disabled,focusableWhenDisabled:f,name:i,value:n.value,checked:x(n.value),onChange:()=>w(n.value)}),e(vB,{forwardedAs:"label",htmlFor:i,disabled:f??n.disabled,children:M(n.label)})]},r)}))}})()})}),e(_I,{id:s,message:v})]})},RangeSelect:r=>{const{error:i,formattedLabel:a,id:c,onChange:l,schema:{label:d,options:f,validation:p,...h},value:m={from:void 0,to:void 0},warning:g,...y}=r,{setValue:_}=Ye(),[v,b]=o(m.from||""),[E,A]=o(m.to||""),{setFieldValidationConfig:S}=n$(),w=s(!1);u((()=>{const e=p?.find((e=>"required"in e));S(c,ST().shape({from:ux(),to:ux()}).test("is-empty-string",e?.errorMessage||Nm.COMMON.REQUIRED_OPTIONS,(t=>!t||!e?.required||t.from?.length>0&&t.to?.length>0)),p)}),[p]),Zs((()=>{const e={};f.from.find((e=>e.value===m.from))||(e.from=""),f.to.find((e=>e.value===m.to))||(e.to=""),_(c,{...m,...e})}),[f]),u((()=>{A(m.from),b(m.to)}),[m]);return t(n,{children:[e(Q.RangeSelect,{...h,...y,id:c,onHideOptions:()=>{w.current?w.current=!1:m.from&&m.to||l({target:{value:{from:void 0,to:void 0}}})},"data-testid":zE.generateId(c),label:a,options:f,onSelectOption:e=>{void 0===e.from&&void 0===e.to&&l({target:{value:{from:void 0,to:void 0}}}),e.from&&l({target:{value:{from:e.from.value,to:void 0}}}),e.to&&(w.current=!0,l({target:{value:{to:e.to.value,from:E}}}))},selectedOptions:{from:f.from.find((({value:e})=>e===E)),to:f.to.find((({value:e})=>e===v))},valueToStringFunction:e=>`${e.from} - ${e.to}`,valueExtractor:e=>({from:e.value,to:e.value}),displayValueExtractor:e=>e.label,listExtractor:e=>e.label,errorMessage:i?.message}),e(_I,{id:c,message:g})]})},ResetButton:t=>{const{id:n,schema:{disabled:r,ignoreDefaultValues:i,label:a,...o},...s}=t,{reset:u,getValues:c}=Ye(),{resetFields:l}=t$(),{formSchema:{defaultValues:d}}=e$();return e(k.Default,{...o,...s,disabled:r,"data-testid":n,id:n,type:"reset",onClick:()=>{if(i){const e=c();Object.entries(e).forEach((([t,n])=>{hi(n)?e[t]=[]:L$(n)||NI(n)?e[t]="":ai(n)&&(e[t]={})})),u(e),l(e)}else u(),l(d)},children:a})},Select:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,options:d,validation:f,...p},value:h,warning:m,...g}=r,{setValue:y}=Ye(),[_,v]=o(h||""),{setFieldValidationConfig:b}=n$();u((()=>{b(s,ux(),f)}),[f]),Zs((()=>{d.find((e=>e.value===h))||y(s,"")}),[d]),u((()=>{v(h||"")}),[h]);return t(n,{children:[e(Q.Select,{...p,...g,id:s,"data-testid":zE.generateId(s,"select"),label:a,errorMessage:i?.message,options:d,onSelectOption:(e,t)=>{c({target:{value:t}})},selectedOption:d.find((({value:e})=>e===_)),displayValueExtractor:e=>e.label,valueExtractor:e=>e.value,listExtractor:e=>e.label}),e(_I,{id:s,message:m})]})},SelectHistogram:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,validation:d,disabled:f,readOnly:p,className:h,histogramSlider:m,customOptions:g},value:y,warning:_,...v}=r,{bins:b,interval:E,...A}=m,{resetField:S}=Ye(),[w,x]=o([0,0]),{setFieldValidationConfig:T}=n$();u((()=>{if(y)x([y.from,y.to]);else{const e=Math.min(...b.map((e=>e.minValue))),t=Math.max(...b.map((e=>e.minValue)))+E;S(s,{defaultValue:{from:e,to:t},keepDirty:!0}),x([e,t])}}),[y]),u((()=>{const e=d?.find((e=>"required"in e)),t=d?.find((e=>"bin"in e&&e.bin)),n=d?.find((e=>"incremental"in e&&e.incremental)),r=d?.find((e=>"withinRange"in e&&e.withinRange));T(s,ST({from:lx(),to:lx()}).test("is-required",e?.errorMessage||Nm.COMMON.REQUIRED_OPTIONS,(t=>!t||!e||!PE(t.from)&&!PE(t.to))).test("is-bin",t?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...b.map((e=>e.minValue)));return Number.isInteger((t-r)/E)&&Number.isInteger((n-r)/E)})).test("is-incremental",n?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>!e||"number"!=typeof e.from||"number"!=typeof e.to||e.from<e.to)).test("is-within-range",r?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(e=>{if(!e||"number"!=typeof e.from||"number"!=typeof e.to)return!0;const{from:t,to:n}=e,r=Math.min(...b.map((e=>e.minValue))),i=Math.max(...b.map((e=>e.minValue)))+E;return!(t<r||n>i)})),d)}),[d,b,E]);return t(n,{children:[e(Q.SelectHistogram,{...v,id:s,"data-testid":zE.generateId(s,"select-histogram"),label:a,errorMessage:i?.message,onChangeEnd:e=>{const[t,n]=e;c({target:{value:{from:t,to:n}}})},disabled:f,readOnly:p,className:h,rangeLabelPrefix:g?.rangeLabelPrefix,rangeLabelSuffix:g?.rangeLabelSuffix,value:w,histogramSlider:{bins:b,interval:E,...A}}),e(_I,{id:s,message:_})]})},Slider:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{label:l,customOptions:d,validation:f,disabled:p,readOnly:h,className:m,ariaLabel:g},value:y,warning:_}=r,[v,b]=o(),{setFieldValidationConfig:E}=n$();u((()=>{const e=f?.find((e=>"min"in e)),t=f?.find((e=>"max"in e)),n=f?.find((e=>"increment"in e));E(s,lx().test("is-incremental",n?.errorMessage||Nm.SLIDER.MUST_BE_INCREMENTAL,(t=>{if("number"!=typeof t||!n)return!0;const r=n.increment,i=(e?.min??0)-t;return Number.isInteger(i/r)})),f),(e||t||n)&&b({min:e?.min,max:t?.max,step:n?.increment})}),[f]);return t(n,{children:[e(Q.Slider,{...d,...v,id:s,"data-testid":zE.generateId(s,"slider"),label:a,errorMessage:i?.message,onChangeEnd:e=>{c({target:{value:e}})},value:y,disabled:p,readOnly:h,className:m,ariaLabel:g}),e(_I,{id:s,message:_})]})},SubmitButton:t=>{const{id:n,schema:{disabled:r,label:i,...a},...s}=t,{submitHandler:c,wrapInForm:l}=i$(),{setFieldValidationConfig:d}=n$(),{hardValidationSchema:f}=s$(),p=it({disabled:"invalid-form"!==r}),[h,m]=o(!0===r);u((()=>{d(n,Qw())}),[]),u((()=>{"invalid-form"!==r&&m(!!r)}),[r]),Zs((()=>{(async()=>{if("invalid-form"===r)try{await f.validate(p),m(!1)}catch(e){m(!0)}})()}),[p,f]);return e(k.Default,{...a,...s,disabled:h,"data-testid":n,id:n,onClick:e=>{l||(e.preventDefault(),c?.())},type:"submit",children:i})},Switch:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{className:l,customOptions:d,disabled:f,label:p,validation:h,...m},value:g,warning:y}=r,[_,v]=o(g||void 0),{setFieldValidationConfig:b}=n$();u((()=>{b(s,tx().strict(),h)}),[h]),u((()=>{v(g)}),[g]);const E=e=>{c({target:{value:e}})},A=e=>_===e,S=e=>`${s}-${e}`;return t(n,{children:[e(Q.CustomField,{id:s,label:a,errorMessage:i?.message,children:t(TB,{className:l,role:"radiogroup","aria-label":"string"==typeof p?p:aI(p.mainLabel,{allowedTags:[]}),children:[e(te,{...m,type:"yes",id:S("yes"),"data-testid":zE.generateId(s,"switch-yes"),disabled:f,styleType:!1===d?.border?"no-border":"default",checked:A(!0),onChange:()=>E(!0),indicator:!0,name:s,error:!!i?.message,children:"Yes"}),e(te,{...m,type:"no",id:S("no"),"data-testid":zE.generateId(s,"switch-no"),disabled:f,styleType:!1===d?.border?"no-border":"default",checked:A(!1),onChange:()=>E(!1),indicator:!0,name:s,error:!!i?.message,children:"No"})]})}),e(_I,{id:s,message:y})]})},TextField:r=>{const{error:i,formattedLabel:a,id:c,onChange:l,value:d,schema:f,warning:p,...h}=r,{customOptions:m,inputMode:g,label:y,uiType:_,validation:v,...b}=f,[E,A]=o(d||""),[S,w]=o({}),{setFieldValidationConfig:x}=n$(),T=s(null),M=s(0);u((()=>{switch(_){case"numeric-field":{x(c,lx(),v);const e=v?.find((e=>"min"in e)),t=v?.find((e=>"max"in e)),n={...S};e?.min>0&&(n.min=e.min),t?.max>0&&(n.max=t.max),w(n);break}case"email-field":{const e=v?.find((e=>e.email));x(c,ux().email(e?.errorMessage||Nm.EMAIL.INVALID),v);const t=v?.find((e=>"max"in e)),n=v?.find((e=>"length"in e)),r={...S};t?.max>0?r.maxLength=t.max:n?.length>0&&(r.maxLength=n.length),w(r);break}case"text-field":{x(c,ux(),v);const e=v?.find((e=>"max"in e)),t=v?.find((e=>"length"in e)),n={...S};e?.max>0?n.maxLength=e.max:t?.length>0&&(n.maxLength=t.length),w(n);break}}}),[v]),u((()=>{d!==E&&A(d||"")}),[d]),u((()=>{"text-field"===_&&document?.activeElement===T.current&&T.current.selectionEnd!==M.current&&T.current.setSelectionRange(M.current,M.current)}),[E]),u((()=>{"text-field"===f.uiType&&"uppercase"===f.customOptions?.textTransform&&E&&A((e=>e?.toString().toUpperCase()))}),["text-field"===f.uiType&&f.customOptions?.textTransform]);const O=()=>!!m?.addOn,N=O()?Q.InputGroup:Q.Input;return t(n,{children:[e(N,{...b,...h,...S,id:c,"data-testid":zE.generateId(c,_),ref:T,type:(()=>{switch(_){case"numeric-field":return"number";case"email-field":return"email";default:return"text"}})(),label:a,onPaste:e=>{const t=e.clipboardData.getData("text");(m?.preventCopyAndPaste||"numeric-field"===_&&/e/i.test(t))&&e.preventDefault()},onDrop:e=>m?.preventDragAndDrop?e.preventDefault():null,inputMode:(()=>{if(g)return g;switch(_){case"numeric-field":return"numeric";case"email-field":return"email";case"text-field":return"text";default:return"none"}})(),onChange:e=>{if("numeric-field"===_){const t=!isNaN(parseFloat(e.target.value))?+e.target.value:void 0;return l({target:{value:t}}),void A(t)}"text-field"===f.uiType?(M.current=e.target.selectionEnd,"uppercase"===f.customOptions?.textTransform&&(e.target.value=e.target.value.toUpperCase()),l(e)):l(e),A(e.target.value)},onKeyDown:e=>{"numeric-field"===_&&"e"===e.key.toLowerCase()&&e.preventDefault()},value:E,errorMessage:i?.message,addon:(()=>{if(O()){if("label"===m.addOn.type)return{type:"label",position:m.addOn.position,attributes:{value:m.addOn.value}};if("icon"===m.addOn.type){const{icon:t,position:n,color:r}=m.addOn,i=G[t];return{type:"custom",position:n,attributes:{children:e(MB,{as:i,$color:r})}}}}})()}),e(_I,{id:c,message:p})]})},Textarea:vR,TimeField:r=>{const{error:i,formattedLabel:a,id:s,onChange:c,schema:{is24HourFormat:l,label:d,placeholder:f,useCurrentTime:p,validation:h,...m},value:g,warning:y,..._}=r,[v,b]=o(g||""),{setFieldValidationConfig:E}=n$();u((()=>{E(s,ux(),h)}),[h]),u((()=>{if(p&&!g){const e=l?"H:mm":"h:mma";setTimeout((()=>A(e)))}else b(g)}),[g,p,l]);const A=e=>{const t=Cm.formatDateTime(Gf.now().toString().toUpperCase(),e,"time");b(t),c({target:{value:t}})};return t(n,{children:[e(Q.Timepicker,{...m,..._,id:s,"data-testid":zE.generateId(s,"time"),label:a,errorMessage:i?.message,value:v,placeholder:f,format:l?"24hr":"12hr",onChange:e=>{c({target:{value:e}})}}),e(_I,{id:s,message:y})]})},get EFieldType(){return OB},UnitNumberField:r=>{const{formattedLabel:i,error:a,id:s,onChange:c,schema:{label:l,validation:d,...f},value:p,warning:h,...m}=r,[g,y]=o(p||""),{setFieldValidationConfig:_}=n$();u((()=>{const e=d?.find((e=>"unitNumberFormat"in e));_(s,ux().matches(/^([a-zA-Z0-9]{1,3}-[a-zA-Z0-9]{1,5})$/,{excludeEmptyString:!0,message:e?.errorMessage||Nm.UNIT_NUMBER.INVALID}),d)}),[d]),u((()=>{y(p||"")}),[p]);return t(n,{children:[e(Q.UnitNumberInput,{...f,...m,id:s,"data-testid":zE.generateId(s,"unit-number"),label:i,value:g,onChange:e=>{c({target:{value:e}})},errorMessage:a?.message}),e(_I,{id:s,message:h})]})}});const CB=({id:t,children:r,childSchema:i})=>{if("columns"in i){if((a=i.columns)&&("xxs"in a||"xs"in a||"sm"in a||"md"in a||"lg"in a||"xl"in a||"xxl"in a)){const{xxs:n,xs:a,sm:o,md:s,lg:u,xl:c,xxl:l,...d}=i.columns||{};return e(F.ColDiv,{"data-testid":zE.generateId(t,"grid_item"),xlCols:c,lgCols:u,mdCols:s,smCols:o,xsCols:a,xxlCols:l,xxsCols:n,...d,children:r})}const{desktop:n,tablet:o,mobile:s,...u}=i.columns||{};return e(he.ColDiv,{"data-testid":zE.generateId(t,"grid_item"),desktopCols:n??12,tabletCols:o,mobileCols:s,...u,children:r})}var a;return e(n,{children:r})},DB=({id:t,renderRules:r,children:i,schema:a})=>{const{formValidationConfig:s,removeFieldValidationConfig:u}=n$(),[c,l]=o(void 0),{formValues:d}=t$(),{unregister:f}=Ye();Us((()=>{if($E(r))return;const e=p();if(e!==c){if(!e){[t,...h(a)].forEach((e=>{u(e),f(e)}))}l(e)}}),[s,d,r]);const p=()=>{if($E(r))return!0;let e=!1;return r.forEach((t=>{if(!e){const n={};Object.entries(t).forEach((([e,t])=>{if(t.find((e=>e.shown))&&!s?.[e])return void(n[e]={schema:Qw().test("shown",(()=>!1)),validationRules:[]});const r=s?.[e]?.schema.type;if(r){let i=EI.mapSchemaType(r);"number"===r&&(i=i.nullable().transform(((e,t)=>!isNaN(parseFloat(t?.toString()))?+t:void 0))),n[e]={schema:i,validationRules:t}}}));const r=EI.buildSchema(n);try{r.validateSync(d),e=!0}catch(e){}}})),e},h=e=>{const n=e.children,r=[];switch(e.uiType){case"chips":r.push(t+"-textarea");break;case"checkbox":case"radio":e.options.forEach((e=>{const t=e.children;!$E(t)&&Dn(t)&&Object.entries(t).forEach((([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))}))}))}return $E(n)||!Dn(n)||Object.entries(n).forEach((([e,t])=>{r.push(e),t.children&&r.push(...h(t.children))})),r};return $E(r)||c?e(n,{children:i}):null},LB=Object.keys(OB),IB=Object.keys(v$),kB=t=>{const{id:r,schema:i,children:a}=t,{showIf:s,uiType:u,children:c,...l}=i||{},{warnings:d}=s$(),[f,p]=o(null),{control:h}=Ye(),{getCustomComponent:m}=ZI(),{formSchema:{overrides:g},overrideSchema:_}=e$();UI((()=>{const t=_(c||a,g);if("object"==typeof t){const n=[];Object.keys(t).forEach((r=>{const i=t[r];if($E(i)||"object"!=typeof i)return;let a=e(y,{children:Nm.GENERIC.UNSUPPORTED},r);if("referenceKey"in i){const t=i.referenceKey.toUpperCase();a=m(i.referenceKey)||Z$[F$[t]]?v(r,i)(b):Z$[P$[t]]?v(r,i)(E):e(y,{},r)}else"uiType"in i&&(LB.includes(i.uiType.toUpperCase())?a=v(r,i)(b):IB.includes(i.uiType.toUpperCase())&&(a=v(r,i)(E)));n.push(a)})),p(n)}else p("string"==typeof t?t:Nm.GENERIC.UNSUPPORTED)}),[c||a,g,h,d,m]);const v=(t,n)=>r=>e(DB,{id:t,...n&&"showIf"in n&&{renderRules:n.showIf},schema:n,children:r(t,n)},t),b=(t,n)=>{let r;return"uiType"in n?r=NB[OB[n.uiType?.toUpperCase()]]:"referenceKey"in n&&(r=Z$[F$[n.referenceKey?.toUpperCase()]]||m(n.referenceKey)),r?e(CB,{id:t,childSchema:n,children:e(pR,{id:t,schema:n,Field:r,warning:d?.[t]})}):null},E=(t,n)=>{let r;return"uiType"in n?r=b$[v$[n.uiType?.toUpperCase()]]||kB:"referenceKey"in n&&(r=Z$[P$[n.referenceKey?.toUpperCase()]]),e(CB,{id:t,childSchema:n,children:e(r,{schema:n,id:t})})};return u?e(u,{...l,id:r,"data-testid":zE.generateId(r,u),children:f}):e(n,{children:f})},$B=C(F.Container)`
|
|
1130
1130
|
gap: ${S["spacing-32"]};
|
|
1131
1131
|
`,RB=C(F.Container)`
|
|
1132
1132
|
gap: ${S["spacing-32"]};
|
|
@@ -1143,4 +1143,4 @@ object-assign
|
|
|
1143
1143
|
`,zB=C.div`
|
|
1144
1144
|
flex: 1;
|
|
1145
1145
|
`,PB=t=>{const{sectionSchema:{children:n,layoutType:r,customOptions:i={gridType:"v2"}},...a}=t;switch(r){case"grid":return(()=>{const t="v3"===i.gridType?$B:RB,r="v3"===i.gridType?"grid":"flex";return e(F.Section,{children:e(t,{type:r,children:e(kB,{...a,children:n})})})})();case"contain":return e(F.Content,{children:e(zB,{children:e(kB,{...a,children:n})})});default:return e(kB,{...a,children:n})}},FB=()=>{const{formSchema:{sections:r,overrides:i},overrideSchema:a}=e$();return e(n,{children:(()=>{const o=a(r,i);return o?Object.entries(o).map((([t,n],r)=>e(PB,{id:t,sectionSchema:n},`section-${r}`))):t(n,{children:["Unable to render Frontend Engine schema, make sure schema is declared within ",e("code",{children:"sections"}),"."]})})()})},ZB=m(((r,a)=>{const{data:c,className:l=null,components:d,onSubmit:p,onSubmitError:h,wrapInForm:m=!0}=r,{className:y=null,defaultValues:_,id:v,stripUnknown:b,revalidationMode:E="onChange",validationMode:A="onTouched"}=c||{},{addFieldEventListener:S,dispatchFieldEvent:w,removeFieldEventListener:x}=BI(),{setCustomComponents:T}=ZI(),{setSubmitHandler:M,setWrapInForm:O}=i$(),{addWarnings:N,performSoftValidation:C,softValidationSchema:D,hardValidationSchema:L,rebuildValidationSchema:I,yupId:k}=s$(),$=function(e={}){const t=i.useRef(void 0),n=i.useRef(void 0),[r,a]=i.useState({isDirty:!1,isValidating:!1,isLoading:ft(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ft(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Ut(e),formState:r});const o=t.current.control;return o._options=e,et({subject:o._subjects.state,next:e=>{Je(e,o._proxyFormState,o._updateFormState,!0)&&a({...o._formState})}}),i.useEffect((()=>o._disableForm(e.disabled)),[o,e.disabled]),i.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==r.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,r.isDirty]),i.useEffect((()=>{e.values&&!Ot(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,a((e=>({...e})))):o._resetDefaultValues()}),[e.values,o]),i.useEffect((()=>{e.errors&&o._setErrors(e.errors)}),[e.errors,o]),i.useEffect((()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),i.useEffect((()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})}),[e.shouldUnregister,o]),t.current.formState=qe(r,o),t.current}({mode:A,reValidateMode:E,defaultValues:_,resolver:async(e,t,n)=>(C(D,e),await function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,i,a){try{return Promise.resolve(function(o,s){try{var u=(t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:i}))).then((function(e){return a.shouldUseNativeValidation&&jt({},a),{values:n.rawValues?r:e,errors:{}}})))}catch(e){return s(e)}return u&&u.then?u.then(void 0,s):u}(0,(function(e){if(!e.inner)throw e;return{values:{},errors:Vt((t=e,n=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,(t.inner||[]).reduce((function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var r=e[t.path].types,i=r&&r[t.type];e[t.path]=ot(t.path,n,e,t.type,i?[].concat(i,t.message):t.message)}return e}),{})),a)};var t,n})))}catch(e){return Promise.reject(e)}}}(L)(e,t,n))}),{setFormSchema:R}=e$(),{reset:z,handleSubmit:P,getValues:F,setValue:Z,setError:U,trigger:B,formState:j,clearErrors:V}=$,{resetFields:G,setFields:H,getFormValues:Y,registeredFields:W}=t$($),q=s(W),{checkIsFormValid:K}=((e,t)=>{const{data:n,onChange:r,onValueChange:i}=e,{stripUnknown:a}=n||{},{hardValidationSchema:c}=s$(),{formValidationConfig:l}=n$(),{watch:d,getValues:p,formState:h,clearErrors:m}=t,{setFields:g,setField:y,getFormValues:_}=t$(t),[v,b]=o({}),[E,A]=o(!1),S=o$(l),w=o$(c),x=s(void 0),T=s(void 0),M=f(((e=!1)=>{if(!e)try{return c.validateSync(p()),!0}catch(e){return!1}return(async()=>{try{return await c.validate(p()),!0}catch(e){return!1}})()}),[p,c]),O=s((async()=>{}));return O.current=async()=>{const e=_(void 0,a),t=await M(!0);i&&Object.keys(l||{}).length&&(T.current===t&&TI(x.current,e)||i(e,t)),x.current=e,T.current=t},u((()=>{const e=d(((e,{name:t})=>{t?y(t,e[t]):g(e)}));return()=>e.unsubscribe()}),[]),u((()=>{if(r&&Object.keys(l||{}).length){const e=d((async()=>{const e=await M(!0);r(_(void 0,a),e)}));return M(!0).then((e=>r(_(void 0,a),e))),()=>e.unsubscribe()}}),[M,r,d,l]),u((()=>{const e=d((async()=>{await O.current()}));return()=>e.unsubscribe()}),[d]),u((()=>{if(S){const e=e=>Object.entries(e).map((([e,{validationRules:t}])=>[e,t])),t=e(S),n=e(l);TI(t,n)||A(!0)}}),[l]),u((()=>{E&&w!==c&&O.current().then((()=>A(!1)))}),[E,c]),u((()=>{const e=h.errors;if(e&&!$E(e)){const e=d((e=>{const t=Object.fromEntries(Object.entries(h.errors).filter((([e,t])=>"api"===t.type)));t&&!$E(t)&&Object.keys(t).forEach((t=>{v[t]!==e[t]&&m(t)})),b(e)}));return()=>e.unsubscribe()}}),[h,d]),{checkIsFormValid:M}})(r,$);g(a,(()=>({addFieldEventListener:S,addCustomValidation:J,dispatchFieldEvent:w,getValues:e=>Y(e,b),isDirty:j.isDirty,isValid:K,validate:B,removeFieldEventListener:x,reset:(e,t)=>{z(e,t),G("function"==typeof e?e($.getValues())??_:e??_)},setErrors:ee,clearErrors:V,setWarnings:te,setValue:Z,submit:P(X,Q)})));const J=(e,t,n,r=!1)=>{EI.addCondition(e,t,n,k,r),I()},X=f((()=>{p?.(Y(void 0,b))}),[Y,p,b]),Q=f((e=>{setTimeout((()=>h?.(e)))}),[h]),ee=e=>{Object.entries(e).forEach((([e,t])=>{q.current.includes(e)&&(Array.isArray(t)?U(e,{type:"api",message:t[0]}):U(e,"object"==typeof t?{type:"api",message:JSON.stringify(t)}:{type:"api",message:t}))}))},te=e=>{const t={};Object.entries(e).forEach((([e,n])=>{q.current.includes(e)&&(t[e]=n)})),N(t)};u((()=>{H(F())}),[]),Us((()=>{z(ks(_))}),[_]),Zs((()=>{R(c)}),[c||{}]),u((()=>{T(d)}),[d]),u((()=>{M((()=>P(X,Q)))}),[X,Q]),u((()=>{O(m)}),[m]),u((()=>{q.current=W}),[W]);const ne=v?`frontend-engine-${v}`:"frontend-engine",re=[l,y].join(" ").trim(),ie=m?"form":"div";return c?e(We,{...$,children:e(ie,{id:ne,"data-testid":v?zE.generateId(v,"frontend-engine"):ne,className:re,noValidate:!0,onSubmit:P(X,Q),ref:a,children:e(FB,{})})}):t(n,{children:["Missing ",e("code",{children:"data"})," prop, unable to render Frontend Engine."]})})),UB=m(((t,n)=>e(FI,{recaptchaSiteKey:t.recaptchaSiteKey,children:e(ZB,{...t,ref:n})})));export{kl as A,ZT as D,cF as E,oF as F,yB as G,yE as I,fI as L,pI as O,BT as P,Qs as R,oI as S,zE as T,Ye as a,BI as b,Nm as c,Om as d,fF as e,gF as f,Lm as g,Gt as h,lI as i,dI as j,Dm as k,sI as l,u$ as m,r$ as n,UB as o,v$ as p,OB as q,o$ as u};
|
|
1146
|
-
//# sourceMappingURL=index.
|
|
1146
|
+
//# sourceMappingURL=index.8cc1cf41.js.map
|