@deneb-ui/cli 2.0.70 → 2.0.71

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var gi=Object.create;var Be=Object.defineProperty;var hi=Object.getOwnPropertyDescriptor;var yi=Object.getOwnPropertyNames;var Ei=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty;var F=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Si=(e,t)=>{for(var n in t)Be(e,n,{get:t[n],enumerable:!0})},ln=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yi(t))!bi.call(e,i)&&i!==n&&Be(e,i,{get:()=>t[i],enumerable:!(r=hi(t,i))||r.enumerable});return e};var Et=(e,t,n)=>(n=e!=null?gi(Ei(e)):{},ln(t||!e||!e.__esModule?Be(n,"default",{value:e,enumerable:!0}):n,e)),Ti=e=>ln(Be({},"__esModule",{value:!0}),e);var bt=F((js,cn)=>{cn.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Ve=F(un=>{var dn={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function wi(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(n,r)=>t[r]||"")),new Error("ADM-ZIP: "+e)}}for(let e of Object.keys(dn))un[e]=wi(dn[e])});var hn=F((Hs,gn)=>{var Pi=require("fs"),V=require("path"),fn=bt(),Ii=Ve(),Ci=typeof process=="object"&&process.platform==="win32",pn=e=>typeof e=="object"&&e!==null,mn=new Uint32Array(256).map((e,t)=>{for(let n=0;n<8;n++)(t&1)!==0?t=3988292384^t>>>1:t>>>=1;return t>>>0});function M(e){this.sep=V.sep,this.fs=Pi,pn(e)&&pn(e.fs)&&typeof e.fs.statSync=="function"&&(this.fs=e.fs)}gn.exports=M;M.prototype.makeDir=function(e){let t=this;function n(r){let i=r.split(t.sep)[0];r.split(t.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=t.sep+s;var o;try{o=t.fs.statSync(i)}catch(a){if(a.message&&a.message.startsWith("ENOENT"))t.fs.mkdirSync(i);else throw a}if(o&&o.isFile())throw Ii.FILE_IN_THE_WAY(`"${i}"`)}})}n(e)};M.prototype.writeFileTo=function(e,t,n,r){let i=this;if(i.fs.existsSync(e)){if(!n)return!1;var s=i.fs.statSync(e);if(s.isDirectory())return!1}var o=V.dirname(e);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(e,"w",438)}catch{i.fs.chmodSync(e,438),a=i.fs.openSync(e,"w",438)}if(a)try{i.fs.writeSync(a,t,0,t.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(e,r||438),!0};M.prototype.writeFileToAsync=function(e,t,n,r,i){typeof r=="function"&&(i=r,r=void 0);let s=this;s.fs.exists(e,function(o){if(o&&!n)return i(!1);s.fs.stat(e,function(a,c){if(o&&c&&c.isDirectory())return i(!1);var d=V.dirname(e);s.fs.exists(d,function(u){if(!u)try{s.makeDir(d)}catch{return i(!1)}let g=function(E){s.fs.write(E,t,0,t.length,0,function(y){s.fs.close(E,function(){if(y)return i(!1);s.fs.chmod(e,r||438,function(){i(!0)})})})};s.fs.open(e,"w",438,function(E,y){E?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(f,m){if(f||!m)return i(!1);g(m)})}):y?g(y):i(!1)})})})})};M.prototype.findFiles=function(e){let t=this;function n(r,i,s,o){typeof i=="boolean"&&(s=i,i=void 0);let a=[];return t.fs.readdirSync(r).forEach(function(c){let d=V.join(r,c),u=t.fs.statSync(d);if((!i||i.test(d))&&a.push(V.normalize(d)+(u.isDirectory()?t.sep:"")),u.isDirectory()&&s){let g=t.fs.realpathSync(d);o.has(g)||(o.add(g),a=a.concat(n(d,i,s,o)))}}),a}return n(e,void 0,!0,new Set([t.fs.realpathSync(e)]))};M.prototype.findFilesAsync=function(e,t){let n=this,r=[],i=!1,s=function(a){i||(i=!0,t(a,a?void 0:r))},o=function(a,c,d){n.fs.readdir(a,function(u,g){if(u)return d(u);let E=g.length;if(!E)return d();g.forEach(function(y){let f=V.join(a,y);n.fs.stat(f,function(m,p){if(m)return d(m);if(!p){--E||d();return}if(r.push(V.normalize(f)+(p.isDirectory()?n.sep:"")),!p.isDirectory()){--E||d();return}n.fs.realpath(f,function(b,S){if(b)return d(b);if(c.has(S)){--E||d();return}c.add(S),o(f,c,function(l){if(l)return d(l);--E||d()})})})})})};n.fs.realpath(e,function(a,c){if(a)return s(a);o(e,new Set([c]),s)})};M.prototype.getAttributes=function(){};M.prototype.setAttributes=function(){};M.crc32update=function(e,t){return mn[(e^t)&255]^e>>>8};M.crc32=function(e){typeof e=="string"&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=M.crc32update(n,e[r++]);return~n>>>0};M.methodToString=function(e){switch(e){case fn.STORED:return"STORED ("+e+")";case fn.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}};M.canonical=function(e){if(!e)return"";let t=V.posix.normalize("/"+e.split("\\").join("/"));return V.join(".",t)};M.zipnamefix=function(e){if(!e)return"";let t=V.posix.normalize("/"+e.split("\\").join("/"));return V.posix.join(".",t)};M.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");let n=e.length>>>0;for(let r=n-1;r>=0;r--)if(t(e[r],r,e))return e[r]};M.sanitize=function(e,t){e=V.resolve(V.normalize(e));for(var n=t.split("/"),r=0,i=n.length;r<i;r++){var s=V.normalize(V.join(e,n.slice(r,i).join(V.sep)));if(s===e||s.startsWith(e+V.sep))return s}return V.normalize(V.join(e,V.basename(t)))};M.toBuffer=function(t,n){return Buffer.isBuffer(t)?t:t instanceof Uint8Array?Buffer.from(t):typeof t=="string"?n(t):Buffer.alloc(0)};M.readBigUInt64LE=function(e,t){let n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n};M.writeBigUInt64LE=function(e,t,n){let r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)};M.fromDOS2Date=function(e){return new Date((e>>25&127)+1980,Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(e&31)<<1)};M.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n};M.isWin=Ci;M.crcTable=mn});var En=F((Ws,yn)=>{var xi=require("path");yn.exports=function(e,{fs:t}){var n=e||"",r=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return n&&t.existsSync(n)?(i=t.statSync(n),r.directory=i.isDirectory(),r.mtime=i.mtime,r.atime=i.atime,r.executable=(73&i.mode)!==0,r.readonly=(128&i.mode)===0,r.hidden=xi.basename(n)[0]==="."):console.warn("Invalid path: "+n),{get directory(){return r.directory},get readOnly(){return r.readonly},get hidden(){return r.hidden},get mtime(){return r.mtime},get atime(){return r.atime},get executable(){return r.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:r.directory,isReadOnly:r.readonly,isHidden:r.hidden,isExecutable:r.executable,mTime:r.mtime,aTime:r.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Sn=F((qs,bn)=>{bn.exports={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")}});var we=F((Gs,Te)=>{Te.exports=hn();Te.exports.Constants=bt();Te.exports.Errors=Ve();Te.exports.FileAttr=En();Te.exports.decoder=Sn()});var wn=F((Ks,Tn)=>{var ce=we(),P=ce.Constants;Tn.exports=function(){var e=20,t=10,n=0,r=0,i=0,s=0,o=0,a=0,c=0,d=0,u=0,g=0,E=0,y=0,f=0;e|=ce.isWin?2560:768,n|=P.FLG_EFS;let m={extraLen:0},p=l=>Math.max(0,l)>>>0,b=l=>Math.max(0,l)&65535,S=l=>Math.max(0,l)&255;return i=ce.fromDate2DOS(new Date),{get made(){return e},set made(l){e=l},get version(){return t},set version(l){t=l},get flags(){return n},set flags(l){n=l},get flags_efs(){return(n&P.FLG_EFS)>0},set flags_efs(l){l?n|=P.FLG_EFS:n&=~P.FLG_EFS},get flags_desc(){return(n&P.FLG_DESC)>0},set flags_desc(l){l?n|=P.FLG_DESC:n&=~P.FLG_DESC},get method(){return r},set method(l){switch(l){case P.STORED:this.version=10;break;case P.DEFLATED:default:this.version=20}r=l},get time(){return ce.fromDOS2Date(this.timeval)},set time(l){l=new Date(l),this.timeval=ce.fromDate2DOS(l)},get timeval(){return i},set timeval(l){i=p(l)},get timeHighByte(){return S(i>>>8)},get crc(){return s},set crc(l){s=p(l)},get compressedSize(){return o},set compressedSize(l){o=p(l)},get size(){return a},set size(l){a=p(l)},get fileNameLength(){return c},set fileNameLength(l){c=l},get extraLength(){return d},set extraLength(l){d=l},get extraLocalLength(){return m.extraLen},set extraLocalLength(l){m.extraLen=l},get commentLength(){return u},set commentLength(l){u=l},get diskNumStart(){return g},set diskNumStart(l){g=p(l)},get inAttr(){return E},set inAttr(l){E=p(l)},get attr(){return y},set attr(l){y=p(l)},get fileAttr(){return(y||0)>>16&4095},get offset(){return f},set offset(l){f=p(l)},get encrypted(){return(n&P.FLG_ENC)===P.FLG_ENC},get centralHeaderSize(){return P.CENHDR+c+d+u},get realDataOffset(){return f+P.LOCHDR+m.fnameLen+m.extraLen},get localHeader(){return m},loadLocalHeaderFromBinary:function(l){var h=l.slice(f,f+P.LOCHDR);if(h.readUInt32LE(0)!==P.LOCSIG)throw ce.Errors.INVALID_LOC();m.version=h.readUInt16LE(P.LOCVER),m.flags=h.readUInt16LE(P.LOCFLG),m.flags_desc=(m.flags&P.FLG_DESC)>0,m.method=h.readUInt16LE(P.LOCHOW),m.time=h.readUInt32LE(P.LOCTIM),m.crc=h.readUInt32LE(P.LOCCRC),m.compressedSize=h.readUInt32LE(P.LOCSIZ),m.size=h.readUInt32LE(P.LOCLEN),m.fnameLen=h.readUInt16LE(P.LOCNAM),m.extraLen=h.readUInt16LE(P.LOCEXT);let w=f+P.LOCHDR+m.fnameLen,T=w+m.extraLen;return l.slice(w,T)},loadFromBinary:function(l){if(l.length!==P.CENHDR||l.readUInt32LE(0)!==P.CENSIG)throw ce.Errors.INVALID_CEN();e=l.readUInt16LE(P.CENVEM),t=l.readUInt16LE(P.CENVER),n=l.readUInt16LE(P.CENFLG),r=l.readUInt16LE(P.CENHOW),i=l.readUInt32LE(P.CENTIM),s=l.readUInt32LE(P.CENCRC),o=l.readUInt32LE(P.CENSIZ),a=l.readUInt32LE(P.CENLEN),c=l.readUInt16LE(P.CENNAM),d=l.readUInt16LE(P.CENEXT),u=l.readUInt16LE(P.CENCOM),g=l.readUInt16LE(P.CENDSK),E=l.readUInt16LE(P.CENATT),y=l.readUInt32LE(P.CENATX),f=l.readUInt32LE(P.CENOFF)},localHeaderToBinary:function(){var l=Buffer.alloc(P.LOCHDR);return l.writeUInt32LE(P.LOCSIG,0),l.writeUInt16LE(t,P.LOCVER),l.writeUInt16LE(n&~P.FLG_DESC,P.LOCFLG),l.writeUInt16LE(r,P.LOCHOW),l.writeUInt32LE(i,P.LOCTIM),l.writeUInt32LE(s,P.LOCCRC),l.writeUInt32LE(o,P.LOCSIZ),l.writeUInt32LE(a,P.LOCLEN),l.writeUInt16LE(c,P.LOCNAM),l.writeUInt16LE(m.extraLen,P.LOCEXT),l},centralHeaderToBinary:function(){var l=Buffer.alloc(P.CENHDR+c+d+u);return l.writeUInt32LE(P.CENSIG,0),l.writeUInt16LE(e,P.CENVEM),l.writeUInt16LE(t,P.CENVER),l.writeUInt16LE(n&~P.FLG_DESC,P.CENFLG),l.writeUInt16LE(r,P.CENHOW),l.writeUInt32LE(i,P.CENTIM),l.writeUInt32LE(s,P.CENCRC),l.writeUInt32LE(o,P.CENSIZ),l.writeUInt32LE(a,P.CENLEN),l.writeUInt16LE(c,P.CENNAM),l.writeUInt16LE(d,P.CENEXT),l.writeUInt16LE(u,P.CENCOM),l.writeUInt16LE(g,P.CENDSK),l.writeUInt16LE(E,P.CENATT),l.writeUInt32LE(y,P.CENATX),l.writeUInt32LE(f,P.CENOFF),l},toJSON:function(){let l=function(h){return h+" bytes"};return{made:e,version:t,flags:n,method:ce.methodToString(r),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:l(o),size:l(a),fileNameLength:l(c),extraLength:l(d),commentLength:l(u),diskNumStart:g,inAttr:E,attr:y,offset:f,centralHeaderSize:l(P.CENHDR+c+d+u)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var In=F((Zs,Pn)=>{var Y=we(),C=Y.Constants;Pn.exports=function(){var e=0,t=0,n=0,r=0,i=0;let s=()=>e>C.EF_ZIP64_OR_16||t>C.EF_ZIP64_OR_16||n>C.EF_ZIP64_OR_32||r>C.EF_ZIP64_OR_32;return{get diskEntries(){return e},set diskEntries(o){e=t=o},get totalEntries(){return t},set totalEntries(o){t=e=o},get size(){return n},set size(o){n=o},get offset(){return r},set offset(o){r=o},get commentLength(){return i},set commentLength(o){i=o},get mainHeaderSize(){return(s()?C.ZIP64HDR+C.END64HDR:0)+C.ENDHDR+i},loadFromBinary:function(o){if((o.length!==C.ENDHDR||o.readUInt32LE(0)!==C.ENDSIG)&&(o.length<C.ZIP64HDR||o.readUInt32LE(0)!==C.ZIP64SIG))throw Y.Errors.INVALID_END();o.readUInt32LE(0)===C.ENDSIG?(e=o.readUInt16LE(C.ENDSUB),t=o.readUInt16LE(C.ENDTOT),n=o.readUInt32LE(C.ENDSIZ),r=o.readUInt32LE(C.ENDOFF),i=o.readUInt16LE(C.ENDCOM)):(e=Y.readBigUInt64LE(o,C.ZIP64SUB),t=Y.readBigUInt64LE(o,C.ZIP64TOT),n=Y.readBigUInt64LE(o,C.ZIP64SIZB),r=Y.readBigUInt64LE(o,C.ZIP64OFF),i=0)},toBinary:function(){if(!s()){var o=Buffer.alloc(C.ENDHDR+i);return o.writeUInt32LE(C.ENDSIG,0),o.writeUInt32LE(0,4),o.writeUInt16LE(e,C.ENDSUB),o.writeUInt16LE(t,C.ENDTOT),o.writeUInt32LE(n,C.ENDSIZ),o.writeUInt32LE(r,C.ENDOFF),o.writeUInt16LE(i,C.ENDCOM),o.fill(" ",C.ENDHDR),o}var o=Buffer.alloc(this.mainHeaderSize);let a=0;o.writeUInt32LE(C.ZIP64SIG,a),Y.writeBigUInt64LE(o,C.ZIP64HDR-C.ZIP64LEAD,a+C.ZIP64SIZE),o.writeUInt16LE(45,a+C.ZIP64VEM),o.writeUInt16LE(45,a+C.ZIP64VER),o.writeUInt32LE(0,a+C.ZIP64DSK),o.writeUInt32LE(0,a+C.ZIP64DSKDIR),Y.writeBigUInt64LE(o,e,a+C.ZIP64SUB),Y.writeBigUInt64LE(o,t,a+C.ZIP64TOT),Y.writeBigUInt64LE(o,n,a+C.ZIP64SIZB),Y.writeBigUInt64LE(o,r,a+C.ZIP64OFF);let c=r+n;return a+=C.ZIP64HDR,o.writeUInt32LE(C.END64SIG,a),o.writeUInt32LE(0,a+C.END64START),Y.writeBigUInt64LE(o,c,a+C.END64OFF),o.writeUInt32LE(1,a+C.END64NUMDISKS),a+=C.END64HDR,o.writeUInt32LE(C.ENDSIG,a),o.writeUInt32LE(0,a+4),o.writeUInt16LE(Math.min(e,C.EF_ZIP64_OR_16),a+C.ENDSUB),o.writeUInt16LE(Math.min(t,C.EF_ZIP64_OR_16),a+C.ENDTOT),o.writeUInt32LE(Math.min(n,C.EF_ZIP64_OR_32),a+C.ENDSIZ),o.writeUInt32LE(Math.min(r,C.EF_ZIP64_OR_32),a+C.ENDOFF),o.writeUInt16LE(i,a+C.ENDCOM),o.fill(" ",a+C.ENDHDR),o},toJSON:function(){let o=function(a,c){let d=a.toString(16).toUpperCase();for(;d.length<c;)d="0"+d;return"0x"+d};return{diskEntries:e,totalEntries:t,size:n+" bytes",offset:o(r,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Tt=F(St=>{St.EntryHeader=wn();St.MainHeader=In()});var xn=F((Js,Cn)=>{Cn.exports=function(e){var t=require("zlib"),n={chunkSize:(parseInt(e.length/1024)+1)*1024};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(r){var i=t.createDeflateRaw(n),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),c=0;a.fill(0);for(var d=0;d<s.length;d++){var u=s[d];u.copy(a,c),c+=u.length}r&&r(a)}),i.end(e)}}}});var _n=F((Xs,An)=>{var Ai=+(process?.versions?.node??"").split(".")[0]||0;An.exports=function(e,t){var n=require("zlib");let r=Ai>=15&&t>0?{maxOutputLength:t}:{};return{inflate:function(){return n.inflateRawSync(e,r)},inflateAsync:function(i){var s=n.createInflateRaw(r),o=[],a=0;s.on("data",function(c){o.push(c),a+=c.length}),s.on("end",function(){var c=Buffer.alloc(a),d=0;c.fill(0);for(var u=0;u<o.length;u++){var g=o[u];g.copy(c,d),d+=g.length}i&&i(c)}),s.end(e)}}}});var Dn=F((Qs,Rn)=>{"use strict";var{randomFillSync:vn}=require("crypto"),_i=Ve(),vi=new Uint32Array(256).map((e,t)=>{for(let n=0;n<8;n++)(t&1)!==0?t=t>>>1^3988292384:t>>>=1;return t>>>0}),Fn=(e,t)=>Math.imul(e,t)>>>0,kn=(e,t)=>vi[(e^t)&255]^e>>>8,ke=()=>typeof vn=="function"?vn(Buffer.alloc(12)):ke.node();ke.node=()=>{let e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=Math.random()*256&255;return e};var Ue={genSalt:ke};function je(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let n=0;n<t.length;n++)this.updateKeys(t[n])}je.prototype.updateKeys=function(e){let t=this.keys;return t[0]=kn(t[0],e),t[1]+=t[0]&255,t[1]=Fn(t[1],134775813)+1,t[2]=kn(t[2],t[1]>>>24),e};je.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return Fn(e,e^1)>>8&255};function ki(e){let t=new je(e);return function(n){let r=Buffer.alloc(n.length),i=0;for(let s of n)r[i++]=t.updateKeys(s^t.next());return r}}function Fi(e){let t=new je(e);return function(n,r,i=0){r||(r=Buffer.alloc(n.length));for(let s of n){let o=t.next();r[i++]=s^o,t.updateKeys(s)}return r}}function Ri(e,t,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let r=ki(n),i=r(e.slice(0,12)),s=(t.flags&8)===8?t.timeHighByte:t.crc>>>24;if(i[11]!==s)throw _i.WRONG_PASSWORD();return r(e.slice(12))}function Di(e){Buffer.isBuffer(e)&&e.length>=12?Ue.genSalt=function(){return e.slice(0,12)}:e==="node"?Ue.genSalt=ke.node:Ue.genSalt=ke}function Li(e,t,n,r=!1){e==null&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));let i=Fi(n),s=Ue.genSalt();s[11]=t.crc>>>24&255,r&&(s[10]=t.crc>>>16&255);let o=Buffer.alloc(e.length+12);return i(s,o),i(e,o,12)}Rn.exports={decrypt:Ri,encrypt:Li,_salter:Di}});var Ln=F(ze=>{ze.Deflater=xn();ze.Inflater=_n();ze.ZipCrypto=Dn()});var Pt=F((ta,Nn)=>{var L=we(),Ni=Tt(),Z=L.Constants,wt=Ln();Nn.exports=function(e,t){var n=new Ni.EntryHeader,r=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),c=Buffer.alloc(0),d=!0;let u=e,g=typeof u.decoder=="object"?u.decoder:L.decoder;d=g.hasOwnProperty("efs")?g.efs:!1;function E(){return!t||!(t instanceof Uint8Array)?Buffer.alloc(0):(c=n.loadLocalHeaderFromBinary(t),t.slice(n.realDataOffset,n.realDataOffset+n.compressedSize))}function y(l){let h=n.flags_desc||n.localHeader.flags_desc?n.crc:n.localHeader.crc;return L.crc32(l)===h}function f(l,h,w){if(typeof h>"u"&&typeof l=="string"&&(w=l,l=void 0),s)return l&&h&&h(Buffer.alloc(0),L.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var T=E();if(T.length===0)return l&&h&&h(T),T;if(n.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw L.Errors.INVALID_PASS_PARAM();T=wt.ZipCrypto.decrypt(T,n,w)}var I;switch(n.method){case L.Constants.STORED:if(I=Buffer.alloc(T.length),T.copy(I),y(I))return l&&h&&h(I),I;throw l&&h&&h(I,L.Errors.BAD_CRC()),L.Errors.BAD_CRC();case L.Constants.DEFLATED:var x=new wt.Inflater(T,n.size);if(l)x.inflateAsync(function(k){h&&(y(k)?h(k):h(k,L.Errors.BAD_CRC()))});else{if(I=x.inflate(),!y(I))throw L.Errors.BAD_CRC(`"${g.decode(r)}"`);return I}break;default:throw l&&h&&h(Buffer.alloc(0),L.Errors.UNKNOWN_METHOD()),L.Errors.UNKNOWN_METHOD()}}function m(l,h){if((!o||!o.length)&&Buffer.isBuffer(t))return l&&h&&h(E()),E();if(o.length&&!s){var w;switch(n.method){case L.Constants.STORED:return n.compressedSize=n.size,w=Buffer.alloc(o.length),o.copy(w),l&&h&&h(w),w;default:case L.Constants.DEFLATED:var T=new wt.Deflater(o);if(l)T.deflateAsync(function(x){w=Buffer.alloc(x.length),n.compressedSize=x.length,x.copy(w),h&&h(w)});else{var I=T.deflate();return n.compressedSize=I.length,I}T=null;break}}else if(l&&h)h(Buffer.alloc(0));else return Buffer.alloc(0)}function p(l,h){return L.readBigUInt64LE(l,h)}function b(l){try{for(var h=0,w,T,I;h+4<l.length;)w=l.readUInt16LE(h),h+=2,T=l.readUInt16LE(h),h+=2,I=l.slice(h,h+T),h+=T,Z.ID_ZIP64===w&&S(I)}catch{throw L.Errors.EXTRA_FIELD_PARSE_ERROR()}}function S(l){var h,w,T,I;l.length>=Z.EF_ZIP64_SCOMP&&(h=p(l,Z.EF_ZIP64_SUNCOMP),n.size===Z.EF_ZIP64_OR_32&&(n.size=h)),l.length>=Z.EF_ZIP64_RHO&&(w=p(l,Z.EF_ZIP64_SCOMP),n.compressedSize===Z.EF_ZIP64_OR_32&&(n.compressedSize=w)),l.length>=Z.EF_ZIP64_DSN&&(T=p(l,Z.EF_ZIP64_RHO),n.offset===Z.EF_ZIP64_OR_32&&(n.offset=T)),l.length>=Z.EF_ZIP64_DSN+4&&(I=l.readUInt32LE(Z.EF_ZIP64_DSN),n.diskNumStart===Z.EF_ZIP64_OR_16&&(n.diskNumStart=I))}return{get entryName(){return g.decode(r)},get rawEntryName(){return r},set entryName(l){r=L.toBuffer(l,g.encode);var h=r[r.length-1];s=h===47||h===92,n.fileNameLength=r.length},get efs(){return typeof d=="function"?d(this.entryName):d},get extra(){return a},set extra(l){a=l,n.extraLength=l.length,b(l)},get comment(){return g.decode(i)},set comment(l){if(i=L.toBuffer(l,g.encode),n.commentLength=i.length,i.length>65535)throw L.Errors.COMMENT_TOO_LONG()},get name(){let l=g.decode(r);return s?l.replace(/[/\\]$/,"").split("/").pop():l.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return m(!1,null)},getCompressedDataAsync:function(l){m(!0,l)},setData:function(l){o=L.toBuffer(l,L.decoder.encode),!s&&o.length?(n.size=o.length,n.method=L.Constants.DEFLATED,n.crc=L.crc32(l),n.changed=!0):n.method=L.Constants.STORED},getData:function(l){return n.changed?o:f(!1,null,l)},getDataAsync:function(l,h){n.changed?l(o):f(!0,l,h)},set attr(l){n.attr=l},get attr(){return n.attr},set header(l){n.loadFromBinary(l)},get header(){return n},packCentralHeader:function(){n.flags_efs=this.efs,n.extraLength=a.length;var l=n.centralHeaderToBinary(),h=L.Constants.CENHDR;return r.copy(l,h),h+=r.length,a.copy(l,h),h+=n.extraLength,i.copy(l,h),l},packLocalHeader:function(){let l=0;n.flags_efs=this.efs,n.extraLocalLength=c.length;let h=n.localHeaderToBinary(),w=Buffer.alloc(h.length+r.length+n.extraLocalLength);return h.copy(w,l),l+=h.length,r.copy(w,l),l+=r.length,c.copy(w,l),l+=c.length,w},toJSON:function(){let l=function(h){return"<"+(h&&h.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:n.toJSON(),compressedData:l(t),data:l(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var $n=F((na,Mn)=>{var On=Pt(),Oi=Tt(),W=we();Mn.exports=function(e,t){var n=[],r=Object.create(null),i=Buffer.alloc(0),s=new Oi.MainHeader,o=!1,a=null;let c=new Set,d=t,{noSort:u,decoder:g}=d;e?f(d.readEntries):o=!0;function E(){let p=new Set;for(let b of Object.keys(r)){let S=b.split("/");if(S.pop(),!!S.length)for(let l=0;l<S.length;l++){let h=S.slice(0,l+1).join("/")+"/";p.add(h)}}for(let b of p)if(!(b in r)){let S=new On(d);S.entryName=b,S.attr=16,S.temporary=!0,n.push(S),r[S.entryName]=S,c.add(S)}}function y(){if(o=!0,r=Object.create(null),s.diskEntries>(e.length-s.offset)/W.Constants.CENHDR)throw W.Errors.DISK_ENTRY_TOO_LARGE();n=new Array(s.diskEntries);for(var p=s.offset,b=0;b<n.length;b++){var S=p,l=new On(d,e);l.header=e.slice(S,S+=W.Constants.CENHDR),l.entryName=e.slice(S,S+=l.header.fileNameLength),l.header.extraLength&&(l.extra=e.slice(S,S+=l.header.extraLength)),l.header.commentLength&&(l.comment=e.slice(S,S+l.header.commentLength)),p+=l.header.centralHeaderSize,n[b]=l,r[l.entryName]=l}c.clear(),E()}function f(p){var b=e.length-W.Constants.ENDHDR,S=Math.max(0,b-65535),l=S,h=e.length,w=-1,T=0;for(typeof d.trailingSpace=="boolean"&&d.trailingSpace&&(S=0),b;b>=l;b--)if(e[b]===80){if(e.readUInt32LE(b)===W.Constants.ENDSIG){w=b,T=b,h=b+W.Constants.ENDHDR,l=b-W.Constants.END64HDR;continue}if(e.readUInt32LE(b)===W.Constants.END64SIG){l=S;continue}if(e.readUInt32LE(b)===W.Constants.ZIP64SIG){w=b,h=b+W.readBigUInt64LE(e,b+W.Constants.ZIP64SIZE)+W.Constants.ZIP64LEAD;break}}if(w==-1)throw W.Errors.INVALID_FORMAT();s.loadFromBinary(e.slice(w,h)),s.commentLength&&(i=e.slice(T+W.Constants.ENDHDR)),p&&y()}function m(){n.length>1&&!u&&(n=n.map(p=>({entry:p,key:p.entryName.toLowerCase()})).sort((p,b)=>p.key.localeCompare(b.key)).map(p=>p.entry))}return{get entries(){return o||y(),n.filter(p=>!c.has(p))},get comment(){return g.decode(i)},set comment(p){i=W.toBuffer(p,g.encode),s.commentLength=i.length},getEntryCount:function(){return o?n.length:s.diskEntries},forEach:function(p){this.entries.forEach(p)},getEntry:function(p){return o||y(),r[p]||null},setEntry:function(p){o||y(),n.push(p),r[p.entryName]=p,s.totalEntries=n.length},deleteFile:function(p,b=!0){o||y();let S=r[p];this.getEntryChildren(S,b).map(h=>h.entryName).forEach(this.deleteEntry)},deleteEntry:function(p){o||y();let b=r[p],S=n.indexOf(b);S>=0&&(n.splice(S,1),delete r[p],s.totalEntries=n.length)},getEntryChildren:function(p,b=!0){if(o||y(),typeof p=="object")if(p.isDirectory&&b){let S=[],l=p.entryName;for(let h of n)h.entryName.startsWith(l)&&S.push(h);return S}else return[p];return[]},getChildCount:function(p){if(p&&p.isDirectory){let b=this.getEntryChildren(p);return b.includes(p)?b.length-1:b.length}return 0},compressToBuffer:function(){o||y(),m();let p=[],b=[],S=0,l=0;s.size=0,s.offset=0;let h=0;for(let I of this.entries){let x=I.getCompressedData();I.header.offset=l;let k=I.packLocalHeader(),R=k.length+x.length;l+=R,p.push(k),p.push(x);let D=I.packCentralHeader();b.push(D),s.size+=D.length,S+=R+D.length,h++}S+=s.mainHeaderSize,s.offset=l,s.totalEntries=h,l=0;let w=Buffer.alloc(S);for(let I of p)I.copy(w,l),l+=I.length;for(let I of b)I.copy(w,l),l+=I.length;let T=s.toBinary();return i&&i.copy(T,T.length-i.length),T.copy(w,l),e=w,o=!1,w},toAsyncBuffer:function(p,b,S,l){try{o||y(),m();let h=[],w=[],T=0,I=0,x=0;s.size=0,s.offset=0;let k=function(R){if(R.length>0){let D=R.shift(),U=D.entryName+D.extra.toString();S&&S(U),D.getCompressedDataAsync(function(H){l&&l(U),D.header.offset=I;let fe=D.packLocalHeader(),$e=fe.length+H.length;I+=$e,h.push(fe),h.push(H);let ve=D.packCentralHeader();w.push(ve),s.size+=ve.length,T+=$e+ve.length,x++,k(R)})}else{T+=s.mainHeaderSize,s.offset=I,s.totalEntries=x,I=0;let D=Buffer.alloc(T);h.forEach(function(H){H.copy(D,I),I+=H.length}),w.forEach(function(H){H.copy(D,I),I+=H.length});let U=s.toBinary();i&&i.copy(U,U.length-i.length),U.copy(D,I),e=D,o=!1,p(D)}};k(Array.from(this.entries))}catch(h){b(h)}}}}});var It=F((ra,Vn)=>{var B=we(),$=require("path"),Mi=Pt(),$i=$n(),pe=(...e)=>B.findLast(e,t=>typeof t=="boolean"),Bn=(...e)=>B.findLast(e,t=>typeof t=="string"),Bi=(...e)=>B.findLast(e,t=>typeof t=="function"),Vi={noSort:!1,readEntries:!1,method:B.Constants.NONE,fs:null};Vn.exports=function(e,t){let n=null,r=Object.assign(Object.create(null),Vi);e&&typeof e=="object"&&(e instanceof Uint8Array||(Object.assign(r,e),e=r.input?r.input:void 0,r.input&&delete r.input),Buffer.isBuffer(e)&&(n=e,r.method=B.Constants.BUFFER,e=void 0)),Object.assign(r,t);let i=new B(r),s=f=>{f.filter(m=>m.attr).sort((m,p)=>p.path.length-m.path.length).forEach(m=>i.fs.chmodSync(m.path,m.attr))};if((typeof r.decoder!="object"||typeof r.decoder.encode!="function"||typeof r.decoder.decode!="function")&&(r.decoder=B.decoder),e&&typeof e=="string")if(i.fs.existsSync(e))r.method=B.Constants.FILE,r.filename=e,n=i.fs.readFileSync(e);else throw B.Errors.INVALID_FILENAME();let o=new $i(n,r),{canonical:a,sanitize:c,zipnamefix:d}=B;function u(f){if(f&&o){var m;if(typeof f=="string"&&(m=o.getEntry($.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=o.getEntry(f.entryName)),m)return m}return null}function g(f){let{join:m,normalize:p,sep:b}=$.posix;return m($.isAbsolute(f)?"/":".",p(b+f.split("\\").join(b)+b))}function E(f){return f instanceof RegExp?(function(m){return function(p){return m.test(p)}})(f):typeof f!="function"?()=>!0:f}let y=(f,m)=>{let p=m.slice(-1);return p=p===i.sep?i.sep:"",$.relative(f,m)+p};return{readFile:function(f,m){var p=u(f);return p&&p.getData(m)||null},childCount:function(f){let m=u(f);if(m)return o.getChildCount(m)},readFileAsync:function(f,m){var p=u(f);p?p.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var p=u(f);if(p){var b=p.getData();if(b&&b.length)return b.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,p){var b=u(f);b?b.getDataAsync(function(S,l){if(l){m(S,l);return}S&&S.length?m(S.toString(p||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var p=u(f);p&&o.deleteFile(p.entryName,m)},deleteEntry:function(f){var m=u(f);m&&o.deleteEntry(m.entryName)},addZipComment:function(f){o.comment=f},getZipComment:function(){return o.comment||""},addZipEntryComment:function(f,m){var p=u(f);p&&(p.comment=m)},getZipEntryComment:function(f){var m=u(f);return m&&m.comment||""},updateFile:function(f,m){var p=u(f);p&&p.setData(m)},addLocalFile:function(f,m,p,b){if(i.fs.existsSync(f)){m=m?g(m):"";let S=$.win32.basename($.win32.normalize(f));m+=p||S;let l=i.fs.statSync(f),h=l.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);l.isDirectory()&&(m+=i.sep),this.addFile(m,h,b,l)}else throw B.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let p=$.resolve(f.localPath),{comment:b}=f,{zipPath:S,zipName:l}=f,h=this;i.fs.stat(p,function(w,T){if(w)return m(w,!1);S=S?g(S):"";let I=$.win32.basename($.win32.normalize(p));if(S+=l||I,T.isFile())i.fs.readFile(p,function(x,k){return x?m(x,!1):(h.addFile(S,k,b,T),setImmediate(m,void 0,!0))});else if(T.isDirectory())return S+=i.sep,h.addFile(S,Buffer.alloc(0),b,T),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,p){if(p=E(p),m=m?g(m):"",f=$.normalize(f),i.fs.existsSync(f)){let b=i.findFiles(f),S=this;if(b.length)for(let l of b){let h=$.join(m,y(f,l));p(h)&&S.addLocalFile(l,$.dirname(h))}}else throw B.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,p,b){b=E(b),p=p?g(p):"",f=$.normalize(f);var S=this;i.fs.open(f,"r",function(l){if(l&&l.code==="ENOENT")m(void 0,B.Errors.FILE_NOT_FOUND(f));else if(l)m(void 0,l);else{var h=i.findFiles(f),w=-1,T=function(){if(w+=1,w<h.length){var I=h[w],x=y(f,I).split("\\").join("/");x=x.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),b(x)?i.fs.stat(I,function(k,R){k&&m(void 0,k),R.isFile()?i.fs.readFile(I,function(D,U){D?m(void 0,D):(S.addFile(p+x,U,"",R),T())}):(S.addFile(p+x+"/",Buffer.alloc(0),"",R),T())}):process.nextTick(()=>{T()})}else m(!0,void 0)};T()}})},addLocalFolderAsync2:function(f,m){let p=this;f=typeof f=="object"?f:{localPath:f};let b=$.resolve(g(f.localPath)),{zipPath:S,filter:l,namefix:h}=f;l instanceof RegExp?l=(function(I){return function(x){return I.test(x)}})(l):typeof l!="function"&&(l=function(){return!0}),S=S?g(S):"",h==="latin1"&&(h=I=>I.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof h!="function"&&(h=I=>I);let w=I=>$.join(S,h(y(b,I))),T=I=>$.win32.basename($.win32.normalize(h(I)));i.fs.open(b,"r",function(I){I&&I.code==="ENOENT"?m(void 0,B.Errors.FILE_NOT_FOUND(b)):I?m(void 0,I):i.findFilesAsync(b,function(x,k){if(x)return m(x);k=k.filter(R=>l(w(R))),k.length||m(void 0,!1),setImmediate(k.reverse().reduce(function(R,D){return function(U,H){if(U||H===!1)return setImmediate(R,U,!1);p.addLocalFileAsync({localPath:D,zipPath:$.dirname(w(D)),zipName:T(D)},R)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((p,b)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(S,l)=>{S&&b(S),l&&p(this)})})},addFile:function(f,m,p,b){f=d(f);let S=u(f),l=S!=null;l||(S=new Mi(r),S.entryName=f),S.comment=p||"";let h=typeof b=="object"&&b instanceof i.fs.Stats;h&&(S.header.time=b.mtime);var w=S.isDirectory?16:0;let T=S.isDirectory?16384:32768;return h?T|=4095&b.mode:typeof b=="number"?T|=4095&b:T|=S.isDirectory?493:420,w=(w|T<<16)>>>0,S.attr=w,S.setData(m),l||o.setEntry(S),S},getEntries:function(f){return o.password=f,o?o.entries:[]},getEntry:function(f){return u(f)},getEntryCount:function(){return o.getEntryCount()},forEach:function(f){return o.forEach(f)},extractEntryTo:function(f,m,p,b,S,l){b=pe(!1,b),S=pe(!1,S),p=pe(!0,p),l=Bn(S,l);var h=u(f);if(!h)throw B.Errors.NO_ENTRY();var w=a(h.entryName),T=c(m,l&&!h.isDirectory?a(l):p?w:$.basename(w));if(h.isDirectory){var I=o.getEntryChildren(h);return I.forEach(function(R){if(R.isDirectory)return;var D=R.getData();if(!D)throw B.Errors.CANT_EXTRACT_FILE();var U=a(p?R.entryName:R.entryName.substring(h.entryName.length)),H=c(m,U);let fe=S?R.header.fileAttr:void 0;i.writeFileTo(H,D,b,fe)}),!0}var x=h.getData(o.password);if(!x)throw B.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(T)&&!b)throw B.Errors.CANT_OVERRIDE();let k=S?f.header.fileAttr:void 0;return i.writeFileTo(T,x,b,k),!0},test:function(f){if(!o)return!1;for(var m of o.entries)try{if(m.isDirectory)continue;var p=m.getData(f);if(!p)return!1}catch{return!1}return!0},extractAllTo:function(f,m,p,b){if(p=pe(!1,p),b=Bn(p,b),m=pe(!1,m),!o)throw B.Errors.NO_ZIP();let S=[];o.entries.forEach(function(l){var h=c(f,a(l.entryName));if(l.isDirectory){i.makeDir(h),p&&S.push({path:h,attr:l.header.fileAttr});return}var w=l.getData(b);if(!w)throw B.Errors.CANT_EXTRACT_FILE();let T=p?l.header.fileAttr:void 0;i.writeFileTo(h,w,m,T);try{i.fs.utimesSync(h,l.header.time,l.header.time)}catch{}}),s(S)},extractAllToAsync:function(f,m,p,b){if(b=Bi(m,p,b),p=pe(!1,p),m=pe(!1,m),!b)return new Promise((x,k)=>{this.extractAllToAsync(f,m,p,function(R){R?k(R):x(this)})});if(!o){b(B.Errors.NO_ZIP());return}f=$.resolve(f);let S=x=>c(f,$.normalize(a(x.entryName))),l=(x,k)=>new Error(x+': "'+k+'"'),h=[],w=[];o.entries.forEach(x=>{x.isDirectory?h.push(x):w.push(x)});let T=[];for(let x of h){let k=S(x),R=p?x.header.fileAttr:void 0;try{i.makeDir(k)}catch{b(l("Unable to create folder",k));continue}R&&T.push({path:k,attr:R});try{i.fs.utimesSync(k,x.header.time,x.header.time)}catch{}}let I=x=>{if(!x)try{s(T)}catch(k){return b(l("Unable to set folder permissions",k.path||""))}b(x)};w.reverse().reduce(function(x,k){return function(R){if(R)x(R);else{let D=$.normalize(a(k.entryName)),U=c(f,D);k.getDataAsync(function(H,fe){if(fe)x(fe);else if(!H)x(B.Errors.CANT_EXTRACT_FILE());else{let $e=p?k.header.fileAttr:void 0;i.writeFileToAsync(U,H,m,$e,function(ve){if(!ve)return x(l("Unable to write file",U));i.fs.utimes(U,k.header.time,k.header.time,function(){x()})})}})}}},I)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&r.filename&&(f=r.filename),!!f){var p=o.compressToBuffer();if(p){var b=i.writeFileTo(f,p,!0);typeof m=="function"&&m(b?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:p,perm:b}=Object.assign({overwrite:!0},m);return new Promise((S,l)=>{!f&&r.filename&&(f=r.filename),f||l("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(h=>{let w=T=>T?S(T):l("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,h,p,b,w)},l)})},toBufferPromise:function(){return new Promise((f,m)=>{o.toAsyncBuffer(f,m)})},toBuffer:function(f,m,p,b){return typeof f=="function"?(o.toAsyncBuffer(f,m,p,b),null):o.compressToBuffer()}}}});var Nr=F(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0})});var lt=F(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.DEFAULT_PROJECT_FONT_IDS=ee.DENEB_GOOGLE_FONT_COUNT=ee.DENEB_FONT_BY_ID=ee.DENEB_FONT_REGISTRY=void 0;var at=[400,500,600,700],Zo=[400,700],Gt=[400,500,600,700];function A(e,t,n,r,i,s){let o=t;return{id:e,label:t,category:n,family:o,cssStack:s?.cssStack??`'${o}', ${n==="serif"||n==="slab-serif"?"Georgia, serif":n==="monospace"?"ui-monospace, monospace":"system-ui, sans-serif"}`,fontsourcePackage:r,googleQuery:i,googleFonts:!0,weights:s?.weights??at,italic:s?.italic,variable:s?.variable}}ee.DENEB_FONT_REGISTRY=[A("inter","Inter","sans-serif","inter","Inter",{variable:!0}),A("roboto","Roboto","sans-serif","roboto","Roboto"),A("open-sans","Open Sans","sans-serif","open-sans","Open+Sans",{variable:!0}),A("lato","Lato","sans-serif","lato","Lato",{italic:!0}),A("montserrat","Montserrat","sans-serif","montserrat","Montserrat",{variable:!0}),A("poppins","Poppins","sans-serif","poppins","Poppins"),A("nunito","Nunito","sans-serif","nunito","Nunito",{variable:!0}),A("raleway","Raleway","sans-serif","raleway","Raleway",{variable:!0}),A("dm-sans","DM Sans","sans-serif","dm-sans","DM+Sans",{variable:!0}),A("work-sans","Work Sans","sans-serif","work-sans","Work+Sans",{variable:!0}),A("fira-sans","Fira Sans","sans-serif","fira-sans","Fira+Sans"),A("manrope","Manrope","sans-serif","manrope","Manrope",{variable:!0}),A("oswald","Oswald","sans-serif","oswald","Oswald",{weights:[400,500,600,700]}),A("source-sans-3","Source Sans 3","sans-serif","source-sans-3","Source+Sans+3",{variable:!0}),A("quicksand","Quicksand","sans-serif","quicksand","Quicksand",{variable:!0}),A("plus-jakarta-sans","Plus Jakarta Sans","sans-serif","plus-jakarta-sans","Plus+Jakarta+Sans",{variable:!0}),{id:"satoshi",label:"Satoshi",category:"sans-serif",family:"Space Grotesk",cssStack:"'Space Grotesk', system-ui, sans-serif",fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:at,substituteId:"space-grotesk"},A("space-grotesk","Space Grotesk","sans-serif","space-grotesk","Space+Grotesk",{variable:!0}),A("figtree","Figtree","sans-serif","figtree","Figtree",{variable:!0}),A("urbanist","Urbanist","sans-serif","urbanist","Urbanist",{variable:!0}),A("outfit","Outfit","sans-serif","outfit","Outfit",{variable:!0}),{id:"general-sans",label:"General Sans",category:"sans-serif",family:"Figtree",cssStack:"'Figtree', system-ui, sans-serif",fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:at,substituteId:"figtree"},A("mulish","Mulish","sans-serif","mulish","Mulish",{variable:!0}),A("barlow","Barlow","sans-serif","barlow","Barlow"),A("rubik","Rubik","sans-serif","rubik","Rubik",{variable:!0}),A("geist","Geist","sans-serif","geist-sans","Geist",{variable:!0}),A("merriweather","Merriweather","serif","merriweather","Merriweather"),A("playfair-display","Playfair Display","serif","playfair-display","Playfair+Display"),A("lora","Lora","serif","lora","Lora",{variable:!0}),A("pt-serif","PT Serif","serif","pt-serif","PT+Serif"),A("eb-garamond","EB Garamond","serif","eb-garamond","EB+Garamond",{variable:!0}),A("libre-baskerville","Libre Baskerville","serif","libre-baskerville","Libre+Baskerville"),A("crimson-text","Crimson Text","serif","crimson-text","Crimson+Text"),A("cormorant-garamond","Cormorant Garamond","serif","cormorant-garamond","Cormorant+Garamond"),A("frank-ruhl-libre","Frank Ruhl Libre","serif","frank-ruhl-libre","Frank+Ruhl+Libre"),A("taviraj","Taviraj","serif","taviraj","Taviraj"),A("arapey","Arapey","serif","arapey","Arapey",{weights:[400],italic:!0}),A("caladea","Caladea","serif","caladea","Caladea"),A("roboto-slab","Roboto Slab","slab-serif","roboto-slab","Roboto+Slab",{variable:!0}),A("zilla-slab","Zilla Slab","slab-serif","zilla-slab","Zilla+Slab"),A("aleo","Aleo","slab-serif","aleo","Aleo",{variable:!0}),A("arvo","Arvo","slab-serif","arvo","Arvo"),A("bitter","Bitter","slab-serif","bitter","Bitter",{variable:!0}),A("enriqueta","Enriqueta","slab-serif","enriqueta","Enriqueta"),A("fira-code","Fira Code","monospace","fira-code","Fira+Code",{weights:Gt,variable:!0}),A("roboto-mono","Roboto Mono","monospace","roboto-mono","Roboto+Mono",{weights:Gt,variable:!0}),A("jetbrains-mono","JetBrains Mono","monospace","jetbrains-mono","JetBrains+Mono",{weights:Gt,variable:!0}),A("space-mono","Space Mono","monospace","space-mono","Space+Mono",{weights:[400,700],italic:!0}),A("bebas-neue","Bebas Neue","display","bebas-neue","Bebas+Neue",{weights:[400]}),A("fraunces","Fraunces","display","fraunces","Fraunces",{variable:!0}),A("cinzel","Cinzel","display","cinzel","Cinzel",{weights:Zo}),A("paytone-one","Paytone One","display","paytone-one","Paytone+One",{weights:[400]}),A("righteous","Righteous","display","righteous","Righteous",{weights:[400]}),A("abril-fatface","Abril Fatface","display","abril-fatface","Abril+Fatface",{weights:[400]}),{id:"system-sans",label:"System Sans",category:"system",family:"system-ui",cssStack:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:[]},{id:"editorial-serif",label:"Editorial Serif",category:"serif",family:"Playfair Display",cssStack:"'Playfair Display', Georgia, serif",fontsourcePackage:"playfair-display",googleQuery:"Playfair+Display",googleFonts:!0,weights:at,substituteId:"playfair-display"}];ee.DENEB_FONT_BY_ID=new Map(ee.DENEB_FONT_REGISTRY.map(e=>[e.id,e]));ee.DENEB_GOOGLE_FONT_COUNT=ee.DENEB_FONT_REGISTRY.filter(e=>e.googleFonts&&e.fontsourcePackage).length;ee.DEFAULT_PROJECT_FONT_IDS=["inter","plus-jakarta-sans","playfair-display"]});var Ce=F(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.normalizeFontId=Ie;ue.lookupFontDefinition=De;ue.resolveInstallableFont=Yo;ue.resolveFontFamily=Jo;ue.listFontsByCategory=Xo;ue.collectFontIdsFromSiteData=Qo;var ct=lt();function Ie(e){return e.trim().toLowerCase().replace(/['"]/g,"").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function De(e){if(!e||!e.trim())return null;let t=Ie(e),n=ct.DENEB_FONT_BY_ID.get(t);if(n)return n;for(let i of ct.DENEB_FONT_REGISTRY)if(Ie(i.label)===t||Ie(i.family)===t)return i;let r=e.split(",")[0]?.trim().replace(/^['"]|['"]$/g,"");if(r){let i=Ie(r);if(i&&i!==t)return De(r)}return null}function Yo(e){let t=De(e);return t?t.fontsourcePackage?t:t.substituteId?ct.DENEB_FONT_BY_ID.get(t.substituteId)??null:null:null}function Jo(e){if(!e||!e.trim())return;let t=De(e);return t?t.cssStack:e.includes(",")?e:`'${e.trim()}', system-ui, sans-serif`}function Xo(){var e;let t={};for(let n of ct.DENEB_FONT_REGISTRY)t[e=n.category]??(t[e]=[]),t[n.category].push(n);return t}function Qo(e){let t=new Set,n=c=>{if(typeof c!="string"||!c.trim())return;let d=De(c);if(d){t.add(d.id),d.substituteId&&t.add(d.substituteId);return}let u=Ie(c);u&&t.add(u)};if(!e||typeof e!="object")return[];let r=e,i=r.theme??r.template?.structure?.theme;n(i?.headingFont),n(i?.bodyFont);let s=r.styles;if(s&&typeof s=="object"&&!Array.isArray(s))for(let c of Object.values(s))c&&typeof c=="object"&&!Array.isArray(c)&&n(c.fontFamily);let o=new WeakSet,a=c=>{if(!(!c||typeof c!="object")&&!o.has(c)){if(o.add(c),Array.isArray(c)){c.forEach(a);return}for(let[d,u]of Object.entries(c))d.endsWith("Style")&&u&&typeof u=="object"&&n(u.fontFamily),a(u)}};return a(r.content),t.delete("system-sans"),Array.from(t)}});var Kt=F(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.formatResponsiveFontSize=Or;dt.formatFontSize=es;function Or(e){if(e==null||e==="")return;let t;if(typeof e=="number")t=e;else if(/^\d+(\.\d+)?px$/i.test(e.trim()))t=parseFloat(e);else if(/^\d+(\.\d+)?rem$/i.test(e.trim()))t=parseFloat(e)*16;else if(/^\d+$/.test(e.trim()))t=parseFloat(e);else return e;if(!Number.isFinite(t)||t<=0)return;let n=t/16,r=Math.max(n*.72,.75),i=n*1.15,s=Math.min(Math.max(n*.08,.5),3.5);return`clamp(${r.toFixed(3)}rem, ${(n*.55).toFixed(3)}rem + ${s.toFixed(2)}vw, ${i.toFixed(3)}rem)`}function es(e,t){if(!(e==null||e==="")){if(t?.responsive){let n=Or(e);if(n)return n}return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}}});var $r=F(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.buildGoogleFontsStylesheetUrl=rs;var Mr=lt(),ts=Ce();function ns(e){if(!e.googleQuery)return null;let t=e.weights.length>0?e.weights:[400],n=Array.from(new Set(t)).sort((r,i)=>r-i);if(e.italic){let r=n.flatMap(i=>[`0,${i}`,`1,${i}`]);return`family=${e.googleQuery}:ital,wght@${r.join(";")}`}if(e.variable||n.length>4){let r=n[0],i=n[n.length-1];return`family=${e.googleQuery}:wght@${r}..${i}`}return`family=${e.googleQuery}:wght@${n.join(";")}`}function rs(e){let t=[],n=new Set;for(let r of e){let i=Mr.DENEB_FONT_BY_ID.get(r)??(0,ts.lookupFontDefinition)(r);if(!i||!i.googleFonts||!i.googleQuery)continue;let s=i.substituteId&&!i.fontsourcePackage?i.substituteId:i.id,o=Mr.DENEB_FONT_BY_ID.get(s)??i;if(n.has(o.id))continue;n.add(o.id);let a=ns(o);a&&t.push(a)}return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`}});var Br=F(ne=>{"use strict";var is=ne&&ne.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Le=ne&&ne.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&is(t,e,n)};Object.defineProperty(ne,"__esModule",{value:!0});Le(Nr(),ne);Le(lt(),ne);Le(Ce(),ne);Le(Kt(),ne);Le($r(),ne)});var Ur=F(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0})});var jr=F(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.DENEB_STYLE_PATCH_MESSAGE=ie.STYLE_PATCH_MESSAGE=void 0;ie.isStylePatchPayload=os;ie.STYLE_PATCH_MESSAGE="FIVORA_PREVIEW_STYLE_PATCH";ie.DENEB_STYLE_PATCH_MESSAGE="DENEB_PREVIEW_STYLE_PATCH";function os(e){if(!e||typeof e!="object")return!1;let t=e,n=t.type;return n!==ie.STYLE_PATCH_MESSAGE&&n!==ie.DENEB_STYLE_PATCH_MESSAGE?!1:typeof t.targetPath=="string"&&typeof t.styleType=="string"&&typeof t.properties=="object"&&t.properties!==null}});var Yt=F(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.PREVIEW_LIST_ATTRIBUTE=O.PREVIEW_ITEM_ATTRIBUTE=O.PREVIEW_FIELD_ATTRIBUTE=O.STYLE_TYPE_ATTRIBUTE=O.STYLE_TARGET_ATTRIBUTE=void 0;O.buildStyleTargetSelector=zr;O.buildStyleFallbackSelectors=ss;O.STYLE_TARGET_ATTRIBUTE="data-preview-style-target";O.STYLE_TYPE_ATTRIBUTE="data-preview-style-type";O.PREVIEW_FIELD_ATTRIBUTE="data-preview-field-path";O.PREVIEW_ITEM_ATTRIBUTE="data-preview-item-path";O.PREVIEW_LIST_ATTRIBUTE="data-preview-list-path";function oe(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function zr(e){return`[${O.STYLE_TARGET_ATTRIBUTE}="${oe(e)}"]`}function ss(e,t){let n=[zr(e),`[${O.PREVIEW_FIELD_ATTRIBUTE}="${oe(e)}"]`,`[${O.PREVIEW_ITEM_ATTRIBUTE}="${oe(e)}"]`];if(t==="card"&&e.endsWith(".card")){let r=e.slice(0,-5);n.push(`[${O.PREVIEW_ITEM_ATTRIBUTE}="${oe(r)}"]`)}if(e.includes(":")){let[r,i]=e.split(":");i==="card"?n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${oe(r)}"] [${O.PREVIEW_ITEM_ATTRIBUTE}]`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${oe(r)}"] .card`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${oe(r)}"] article`):i&&n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${oe(r)}"] [${O.PREVIEW_FIELD_ATTRIBUTE}$=".${oe(i)}"]`)}return n}});var ut=F(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.resolveFontFamily=void 0;xe.resolveShadowPreset=cs;xe.resolveThemeToken=ds;var as=Ce();Object.defineProperty(xe,"resolveFontFamily",{enumerable:!0,get:function(){return as.resolveFontFamily}});var ls={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)"};function cs(e){if(e)return ls[e]??e}function ds(e){return e?e.startsWith("var(")?e:{primary:"var(--brand-color, #2563eb)",secondary:"var(--brand-secondary, #0f172a)",surface:"var(--surface-color, #ffffff)",background:"var(--page-bg, #f8fafc)",heading:"var(--heading-color, #0f172a)",muted:"var(--muted-color, #64748b)"}[e]??e:void 0}});var Xt=F(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.formatUnit=N;se.textStyleToCssVariables=Hr;se.cardStyleToCssVariables=Wr;se.buttonStyleToCssVariables=qr;se.gridStyleToCssVariables=Gr;se.sectionStyleToCssVariables=Kr;se.styleToCssVariables=ps;var us=Kt(),fs=Ce(),Ae=ut();function N(e){if(!(e===void 0||e===""||e===null))return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}function Jt(e,t){let n={},r=e.marginTop??e.spacingTop,i=e.marginBottom??e.spacingBottom,s=e.marginLeft??e.spacingLeft,o=e.marginRight??e.spacingRight;return r!==void 0&&(n[`${t}-margin-top`]=N(r)),i!==void 0&&(n[`${t}-margin-bottom`]=N(i)),s!==void 0&&(n[`${t}-margin-left`]=N(s)),o!==void 0&&(n[`${t}-margin-right`]=N(o)),n}function Hr(e){let t={...Jt(e,"--deneb")};return e.fontFamily&&(t["--deneb-font-family"]=(0,fs.resolveFontFamily)(e.fontFamily)),e.fontSize!==void 0&&(t["--deneb-font-size"]=(0,us.formatFontSize)(e.fontSize,{responsive:e.responsiveFontSize===!0})),e.fontWeight!==void 0&&(t["--deneb-font-weight"]=String(e.fontWeight)),e.lineHeight!==void 0&&(t["--deneb-line-height"]=(typeof e.lineHeight=="number",String(e.lineHeight))),e.letterSpacing&&(t["--deneb-letter-spacing"]=e.letterSpacing),e.color&&(t["--deneb-color"]=(0,Ae.resolveThemeToken)(e.color)),e.textAlign&&(t["--deneb-text-align"]=e.textAlign),e.textTransform&&(t["--deneb-text-transform"]=e.textTransform),t}function Wr(e){let t={...Jt(e,"--deneb-card")};return e.width!==void 0&&(t["--deneb-card-width"]=N(e.width)),e.minWidth!==void 0&&(t["--deneb-card-min-width"]=N(e.minWidth)),e.maxWidth!==void 0&&(t["--deneb-card-max-width"]=N(e.maxWidth)),e.height!==void 0&&(t["--deneb-card-height"]=N(e.height)),e.aspectRatio&&(t["--deneb-card-aspect-ratio"]=e.aspectRatio),e.paddingTop!==void 0&&(t["--deneb-card-pt"]=N(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-card-pb"]=N(e.paddingBottom)),e.paddingLeft!==void 0&&(t["--deneb-card-pl"]=N(e.paddingLeft)),e.paddingRight!==void 0&&(t["--deneb-card-pr"]=N(e.paddingRight)),e.borderRadius!==void 0&&(t["--deneb-card-radius"]=N(e.borderRadius)),e.borderWidth!==void 0&&(t["--deneb-card-border-w"]=N(e.borderWidth)),e.borderStyle&&(t["--deneb-card-border-s"]=e.borderStyle),e.borderColor&&(t["--deneb-card-border-c"]=e.borderColor),e.backgroundColor&&(t["--deneb-card-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.backgroundGradient&&(t["--deneb-card-bg-gradient"]=e.backgroundGradient),e.boxShadow&&(t["--deneb-card-shadow"]=(0,Ae.resolveShadowPreset)(e.boxShadow)),e.backdropBlur!==void 0&&(t["--deneb-card-blur"]=N(e.backdropBlur)),e.gap!==void 0&&(t["--deneb-card-gap"]=N(e.gap)),t}function qr(e){let t={...Jt(e,"--deneb-btn")};return e.borderRadius!==void 0&&(t["--deneb-btn-radius"]=N(e.borderRadius)),e.paddingX!==void 0&&(t["--deneb-btn-px"]=N(e.paddingX)),e.paddingY!==void 0&&(t["--deneb-btn-py"]=N(e.paddingY)),e.backgroundColor&&(t["--deneb-btn-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.textColor&&(t["--deneb-btn-color"]=(0,Ae.resolveThemeToken)(e.textColor)),e.borderColor&&(t["--deneb-btn-border-c"]=e.borderColor),e.hoverBackgroundColor&&(t["--deneb-btn-hover-bg"]=e.hoverBackgroundColor),e.hoverTextColor&&(t["--deneb-btn-hover-color"]=e.hoverTextColor),t}function Gr(e){let t={};return e.columns!==void 0&&(t["--deneb-grid-cols"]=String(e.columns)),e.minCardWidth&&(t["--deneb-grid-min-card"]=e.minCardWidth),e.gapX!==void 0&&(t["--deneb-grid-gap-x"]=N(e.gapX)),e.gapY!==void 0&&(t["--deneb-grid-gap-y"]=N(e.gapY)),e.equalHeight!==void 0&&(t["--deneb-grid-equal-height"]=e.equalHeight?"stretch":"start"),t}function Kr(e){let t={};return e.paddingTop!==void 0&&(t["--deneb-section-pt"]=N(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-section-pb"]=N(e.paddingBottom)),e.paddingX!==void 0&&(t["--deneb-section-px"]=N(e.paddingX)),e.maxWidth&&(t["--deneb-section-max-w"]=e.maxWidth),e.backgroundColor&&(t["--deneb-section-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.backgroundImage&&(t["--deneb-section-bg-image"]=e.backgroundImage),e.backgroundOverlayColor&&(t["--deneb-section-overlay"]=e.backgroundOverlayColor),e.backgroundOverlayOpacity!==void 0&&(t["--deneb-section-overlay-opacity"]=String(e.backgroundOverlayOpacity)),t}function ps(e,t){switch(e){case"text":return Hr(t);case"card":return Wr(t);case"button":return qr(t);case"grid":return Gr(t);case"section":return Kr(t);default:return{}}}});var en=F(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.isPlainObject=Qt;ft.deepMerge=Zr;function Qt(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Zr(e,t,n=0,r=new WeakSet){if(n>50)return{...e,...t};if(r.has(t))return t;r.add(t);let i={...e};for(let[s,o]of Object.entries(t))Qt(o)&&Qt(i[s])?i[s]=Zr(i[s],o,n+1,r):i[s]=o;return i}});var Qr=F(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.getLiveStyleCache=hs;be.applyCssVariablesToElement=Jr;be.findStyleTargetElement=ys;be.patchElementStyle=Xr;be.patchStyleByPath=Es;var Ne=Yt(),ms=en(),ae=Xt(),gs=Ce(),Yr=ut(),tn=new Map;function hs(){return tn}function Jr(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}function ys(e,t){if(typeof document>"u"||!e)return null;for(let n of(0,Ne.buildStyleFallbackSelectors)(e,t)){let r=document.querySelector(n);if(r)return r}return null}function Xr(e,t,n){let i=(e.getAttribute(Ne.STYLE_TARGET_ATTRIBUTE)??"")||e.getAttribute("data-preview-field-path")||"",s=i?tn.get(i)??{}:{},o=(0,ms.deepMerge)(s,n);i&&tn.set(i,o);let a=(0,ae.styleToCssVariables)(t,o);if(Jr(e,a),t==="text"){if(o.color){let c=(0,Yr.resolveThemeToken)(String(o.color))||String(o.color);e.style.setProperty("color",c,"important")}if(o.textAlign&&e.style.setProperty("text-align",String(o.textAlign),"important"),o.fontSize!==void 0){let c=(0,ae.formatUnit)(o.fontSize)||String(o.fontSize);e.style.setProperty("font-size",c,"important")}if(o.lineHeight!==void 0&&e.style.setProperty("line-height",String(o.lineHeight),"important"),o.fontFamily){let c=(0,gs.resolveFontFamily)(String(o.fontFamily))||String(o.fontFamily);e.style.setProperty("font-family",c,"important")}if(o.fontWeight!==void 0&&e.style.setProperty("font-weight",String(o.fontWeight),"important"),o.marginTop!==void 0||o.spacingTop!==void 0){let c=(0,ae.formatUnit)(o.marginTop??o.spacingTop);c&&e.style.setProperty("margin-top",c,"important")}if(o.marginBottom!==void 0||o.spacingBottom!==void 0){let c=(0,ae.formatUnit)(o.marginBottom??o.spacingBottom);c&&e.style.setProperty("margin-bottom",c,"important")}if(o.marginLeft!==void 0||o.spacingLeft!==void 0){let c=(0,ae.formatUnit)(o.marginLeft??o.spacingLeft);c&&e.style.setProperty("margin-left",c,"important")}if(o.marginRight!==void 0||o.spacingRight!==void 0){let c=(0,ae.formatUnit)(o.marginRight??o.spacingRight);c&&e.style.setProperty("margin-right",c,"important")}}else if(t==="card"){if(o.backgroundColor){let c=(0,Yr.resolveThemeToken)(String(o.backgroundColor))||String(o.backgroundColor);e.style.setProperty("background-color",c,"important"),e.style.setProperty("background",c,"important")}if(o.borderRadius!==void 0){let c=(0,ae.formatUnit)(o.borderRadius)||String(o.borderRadius);e.style.setProperty("border-radius",c,"important")}if(o.padding!==void 0||o.paddingTop!==void 0){let c=(0,ae.formatUnit)(o.padding??o.paddingTop);c&&e.style.setProperty("padding",c,"important")}if(o.boxShadow&&e.style.setProperty("box-shadow",String(o.boxShadow),"important"),o.borderColor&&e.style.setProperty("border-color",String(o.borderColor),"important"),o.borderWidth!==void 0){let c=(0,ae.formatUnit)(o.borderWidth)||String(o.borderWidth);e.style.setProperty("border-width",c,"important"),e.style.setProperty("border-style","solid","important")}}e.getAttribute(Ne.STYLE_TYPE_ATTRIBUTE)||e.setAttribute(Ne.STYLE_TYPE_ATTRIBUTE,t)}function Es(e,t,n){if(typeof document>"u"||!e)return!1;let r=!1;for(let i of(0,Ne.buildStyleFallbackSelectors)(e,t)){let s=document.querySelectorAll(i);s.length>0&&(s.forEach(o=>Xr(o,t,n)),r=!0)}return r}});var ei=F(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.isValidStyleKind=Ss;Oe.validateStyleTree=Ts;Oe.collectStyleTargetsFromHtml=ws;var bs=new Set(["text","card","button","grid","section"]);function Ss(e){return typeof e=="string"&&bs.has(e)}function Ts(e,t){let n=[];if(e==null)return n;if(typeof e!="object"||Array.isArray(e))return n.push({path:"styles",message:"styles must be an object"}),n;for(let[r,i]of Object.entries(e)){if(!r.trim()){n.push({path:"styles",message:"style path cannot be empty"});continue}if(typeof i!="object"||i===null||Array.isArray(i)){n.push({path:`styles.${r}`,message:"style entry must be an object"});continue}t&&!t.has(r)&&n.push({path:`styles.${r}`,message:"no matching data-preview-style-target marker in template"})}return n}function ws(e){let t=new Set,n=/data-preview-style-target=["']([^"']+)["']/g,r;for(;(r=n.exec(e))!==null;)t.add(r[1]);return t}});var ti=F(q=>{"use strict";var Ps=q&&q.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),le=q&&q.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Ps(t,e,n)};Object.defineProperty(q,"__esModule",{value:!0});le(Br(),q);le(Ur(),q);le(jr(),q);le(Yt(),q);le(Xt(),q);le(Qr(),q);le(ut(),q);le(en(),q);le(ei(),q)});var Vs={};Si(Vs,{runTemplatePreflight:()=>ui});module.exports=Ti(Vs);var li=require("node:child_process"),_=require("node:fs/promises"),ci=require("node:os"),v=require("node:path"),sn=Et(It());var Un=[{key:"content_image",label:"Content images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:200},{key:"business_logo",label:"Business logo",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:1},{key:"website_banner",label:"Website banner images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:10},{key:"gallery",label:"Gallery images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:30},{key:"product",label:"Product images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:50},{key:"service",label:"Service images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:50},{key:"shop_front",label:"Shop front images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:10},{key:"company_document",label:"Company documents",accept:["application/pdf","image/jpeg","image/png","image/webp"],maxSizeBytes:10485760,maxFiles:10},{key:"brochure_pdf",label:"Brochure PDF",accept:["application/pdf"],maxSizeBytes:10485760,maxFiles:5},{key:"restaurant_menu_pdf",label:"Restaurant menu PDF",accept:["application/pdf"],maxSizeBytes:10485760,maxFiles:5}];var Ui={business_logo:["logo"],website_banner:["hero","banners"],gallery:["gallery"],product:["products"],service:["services"],shop_front:["shopFront"],content_image:["contentImages"],company_document:["documents"],brochure_pdf:["brochures"],restaurant_menu_pdf:["menus"]};function jn(e,t=[]){return{project:{id:"template-validation",slug:"template-validation",title:"Template Validation",status:"APPROVED"},siteInstance:{id:"template-validation-instance",slug:"template-validation",domain:"template-validation.fivora.site",subdomain:"template-validation",customDomain:null,liveUrl:"https://template-validation.fivora.site"},api:{baseUrl:"https://api.fivora.site",catalogUrl:"https://api.fivora.site/site-catalog/template-validation/live-data",contactUrl:"https://api.fivora.site/site-contact",analyticsUrl:"https://api.fivora.site/site-analytics/page-view"},shop:{businessName:"Template Validation Shop",description:"Validation build payload that mirrors fivora-generated site data.",contact:{phone:"",email:"",whatsapp:""},address:{line1:"",city:"",district:"",province:"",postalCode:""},social:{facebook:"",instagram:"",tiktok:"",youtube:"",linkedin:"",website:""},logoUrl:""},template:{id:"template-validation",name:"Template Validation",engine:"NEXT_STATIC_EXPORT",structure:null},requirements:{websiteType:"",mainPurpose:"",targetCustomers:"",preferredLanguage:"",preferredColorTheme:"",preferredStyle:"",requiredPages:t,requiredFeatures:[],customerSpecialRequirements:""},content:e??{},media:ji(),seo:null}}function ji(){let e={};for(let t of Un){e[t.key]=[];for(let n of Ui[t.key]??[])e[n]||(e[n]=[])}return e}var zn=Et(It()),Pe={maxEntries:2e3,maxEntryUncompressedBytes:25*1024*1024,maxTotalUncompressedBytes:200*1024*1024,maxCompressionRatio:100},zi=new Set([".cache",".git",".next",".npm",".pnpm-store",".turbo","__macosx","node_modules"]),Hi=new Set(["build","coverage","dist","out"]);function Hn(e){let t;try{t=new zn.default(e).getEntries()}catch{throw new Error("Template package is not a valid ZIP archive.")}let n=new Set,r=[],i=0;if(t.length>Pe.maxEntries)throw new Error(`Template ZIP contains too many entries (${t.length}; maximum ${Pe.maxEntries}).`);for(let s of t){let o=qn(s.entryName);if(r.push(o),Wi(o))throw new Error(`Template ZIP contains an unsafe entry: ${s.entryName||"(empty path)"}.`);if(!s.isDirectory){let a=Number(s.header.size??0),c=Number(s.header.compressedSize??0);if(!Number.isSafeInteger(a)||a<0||a>Pe.maxEntryUncompressedBytes)throw new Error(`Template ZIP entry is too large after extraction: ${o}.`);if(i+=a,i>Pe.maxTotalUncompressedBytes)throw new Error(`Template ZIP expands beyond the ${Pe.maxTotalUncompressedBytes/(1024*1024)} MB limit.`);if(a>1024*1024&&a/Math.max(1,c)>Pe.maxCompressionRatio)throw new Error(`Template ZIP entry has an unsafe compression ratio: ${o}.`)}(!s.isDirectory&&He(o)||s.isDirectory&&He(o))&&n.add(o)}return{entries:r,forbiddenEntries:[...n]}}function Wn(e){let t=e.slice(0,8),n=e.length-t.length;return["Template ZIP contains generated, cached, secret, log, or nested archive files that must be removed.",`Remove: ${t.join(", ")}${n>0?`, and ${n} more`:""}.`,"Create a clean source-only ZIP and upload it again."].join(" ")}function qn(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Wi(e){let t=Gn(e);return!e||e.includes("\0")||e.startsWith("/")||/^[a-z]:\//i.test(e)||t.includes("..")}function He(e){let t=qn(e),n=Gn(t),r=n.at(-1)??"",i=n.some(y=>zi.has(y)),s=n[0]===".yarn"&&n[1]==="cache",o=n.some(y=>Hi.has(y)),a=n.some(y=>y===".deneb"||y.startsWith(".deneb-backup")),c=r===".env"||r.startsWith(".env."),d=r.endsWith(".zip"),u=r.endsWith(".log"),g=r.endsWith(".tsbuildinfo");return i||s||o||a||c||d||u||g||(r===".ds_store"||r==="thumbs.db")}function Gn(e){return e.split("/").map(t=>t.trim().toLowerCase()).filter(Boolean)}var qi={common:{label:"Common Content"},home:{label:"Home Page",pageKey:"home"},about:{label:"About Page",pageKey:"about_us"},services:{label:"Services",pageKey:"services"},products:{label:"Products",pageKey:"products"},gallery:{label:"Gallery",pageKey:"gallery"},contact:{label:"Contact Page",pageKey:"contact"},additionalPages:{label:"Additional Pages"}},Gi=new Set(["text","textarea","email","tel","url","image","number","boolean","select"]),Ki={version:1,sections:[{id:"common",path:"common",label:"Common Content",type:"object",fields:[{key:"logoUrl",type:"image",label:"Website logo",description:"Used by templates that read content.common.logoUrl or merchant.logoUrl."}]}]};function Zn(e){if(!e||typeof e!="object")return null;let t=e,r=(Array.isArray(t.sections)?t.sections:[]).map(i=>Zi(i)).filter(i=>!!i);return r.length===0?null:{version:typeof t.version=="number"&&Number.isFinite(t.version)?t.version:1,sections:r}}function Yn(e,t=[]){let n=new Map(t.map(i=>[i.id,i.label]));return{version:1,sections:Object.entries(e).map(([i,s])=>Ji(i,s,n)).filter(i=>!!i)}}function Fe(e){if(!e)return null;let t=new Map;for(let s of e.sections){let o=t.get(s.path);t.set(s.path,o?xt(o,s):s)}let n=[...t.values()],r=n.map(s=>s.path),i=n.map(s=>{let a=n.filter(d=>Ze(s.path,d.path)).sort((d,u)=>Kn(u.path)-Kn(d.path)).map(d=>nr({...e,sections:[d]},s.path)).filter(d=>!!d).reduce((d,u)=>xt(d,u),s),c=new Set(r.filter(d=>d!==s.path&&Ze(d,s.path)));return Ct(a,c)}).filter(s=>!!s);return{...e,sections:i}}function Ye(e){if(!e)return[];let t=new Map,n=[],r=new Set,i=(o,a,c)=>{let d=te(o),u=t.get(d);if(!u){t.set(d,{kind:a,sectionId:c});return}r.has(d)||(r.add(d),n.push({path:d,firstKind:u.kind,duplicateKind:a,firstSectionId:u.sectionId,duplicateSectionId:c}))},s=(o,a,c)=>{if(a.type==="object"){for(let d of a.fields??[])s(me(o,d.key),d,c);return}if(a.type==="list"){let d=te(o);i(d,"list",c);let u=`${d}[*]`;a.itemField&&i(u,"field",c);for(let g of a.fields??[])s(me(u,g.key),g,c);return}i(o,"field",c)};for(let o of e.sections)s(o.path,o,o.id);return n}function At(e,t){if(!e)return Fe(t);if(!t)return Fe(e);let n=Fe(e)??e,r=Fe(t)??t,i=n.sections.map(c=>c.path),s=n.sections.map(c=>{let d=nr(r,c.path);if(!d)return c;let u=new Set(i.filter(E=>E!==c.path&&Ze(E,c.path))),g=Ct(d,u);return g?xt(c,g):c}),o=new Set(n.sections.map(({path:c})=>c)),a=r.sections.filter(c=>!o.has(c.path)).map(c=>Ct(c,new Set(i.filter(d=>Ze(d,c.path))))).filter(c=>!!c);return Fe({...t,...e,sections:[...s,...a]})}function Jn(e){return e?At(e,Ki):null}function Zi(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.id),r=z(t.path),i=z(t.label),s=Qn(t.type);if(!n||!r||!i||!s)return null;let o={id:n,path:r,label:i,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:kt(t.maxLength),recommendedWidth:de(t.recommendedWidth),recommendedHeight:de(t.recommendedHeight),pageKey:z(t.pageKey)||void 0,..._t(t.sharedFieldKey)};if(s==="object"){let a=qe(t.fields);return{...o,type:s,fields:a}}if(s==="list"){let a=qe(t.fields),c=Xn(t.itemField);return a.length===0&&!c?null:{...o,type:s,fields:a.length>0?a:void 0,itemField:c??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:Ge(t.minItems),maxItems:Ge(t.maxItems)}}return{...o,type:s,options:s==="select"?vt(t.options):void 0}}function Ct(e,t){if(t.has(e.path))return null;if(e.type==="object"){let n=(e.fields??[]).map(r=>We(r,e.path,t)).filter(r=>!!r);return n.length===0?null:{...e,fields:n}}if(e.type==="list"){let n=(e.fields??[]).map(r=>We(r,e.path,t)).filter(r=>!!r);return(e.fields?.length??0)>0&&n.length===0&&!e.itemField?null:{...e,fields:n.length>0?n:void 0}}return e}function We(e,t,n){let r=me(t,e.key);if(n.has(r))return null;if(e.type==="object"){let i=e.fields.map(s=>We(s,r,n)).filter(s=>!!s);return i.length===0?null:{...e,fields:i}}if(e.type==="list"){let i=(e.fields??[]).map(s=>We(s,r,n)).filter(s=>!!s);return(e.fields?.length??0)>0&&i.length===0&&!e.itemField?null:{...e,fields:i.length>0?i:void 0}}return e}function qe(e){return Array.isArray(e)?e.map(t=>Yi(t)).filter(t=>!!t):[]}function Yi(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.key),r=z(t.label),i=Qn(t.type);if(!n||!r||!i)return null;let s={key:n,label:r,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:kt(t.maxLength),recommendedWidth:de(t.recommendedWidth),recommendedHeight:de(t.recommendedHeight),..._t(t.sharedFieldKey)};if(i==="object")return{...s,type:i,fields:qe(t.fields)};if(i==="list"){let o=qe(t.fields),a=Xn(t.itemField);return o.length===0&&!a?null:{...s,type:i,fields:o.length>0?o:void 0,itemField:a??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:Ge(t.minItems),maxItems:Ge(t.maxItems)}}return{...s,type:i,options:i==="select"?vt(t.options):void 0}}function Xn(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.label),r=er(t.type);return!n||!r?null:{label:n,type:r,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:kt(t.maxLength),recommendedWidth:de(t.recommendedWidth),recommendedHeight:de(t.recommendedHeight),..._t(t.sharedFieldKey),options:r==="select"?vt(t.options):void 0}}function _t(e){return typeof e=="string"&&e.trim()?{sharedFieldKey:e.trim()}:{}}function vt(e){if(!Array.isArray(e))return;let t=e.map(n=>z(n)).filter(n=>!!n);return t.length>0?t:void 0}function kt(e){return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<=1e4?e:void 0}function de(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function Ge(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:void 0}function Qn(e){return e==="object"?e:e==="list"||e==="array"?"list":er(e)}function er(e){return typeof e=="string"&&Gi.has(e)?e:null}function Ji(e,t,n){let r=qi[e],i=n.has(e)?e:void 0,s=!i&&e==="about"&&n.has("about_us")?"about_us":void 0,o=i||s||r?.pageKey,a=(o?n.get(o):void 0)||r?.label||or(e);return Array.isArray(t)?Xi(e,a,o,t):ge(t)?{id:e,path:e,label:a,pageKey:o,type:"object",fields:Object.entries(t).map(([c,d])=>Je(c,d))}:{id:e,path:e,label:a,pageKey:o,...Xe(e,t)}}function Je(e,t){let n=or(e);return Array.isArray(t)?Qi(e,n,t):ge(t)?{key:e,label:n,type:"object",fields:Object.entries(t).map(([r,i])=>Je(r,i))}:{key:e,label:n,...Xe(e,t)}}function Xi(e,t,n,r){let i=rr(r),s=sr(t);return ge(i)?{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,fields:Object.entries(i).map(([o,a])=>Je(o,a))}:{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,itemField:{label:s,...Xe(e,i)}}}function Qi(e,t,n){let r=rr(n),i=sr(t);return ge(r)?{key:e,label:t,type:"list",itemLabel:i,fields:Object.entries(r).map(([s,o])=>Je(s,o))}:{key:e,label:t,type:"list",itemLabel:i,itemField:{label:i,...Xe(e,r)}}}function xt(e,t){let n={...t,...e,pageKey:e.pageKey??t.pageKey,description:e.description??t.description,placeholder:e.placeholder??t.placeholder};if(e.type==="object"&&t.type==="object")return{...n,type:"object",fields:Ke(e.fields??[],t.fields??[])};if(e.type==="list"&&t.type==="list"){let r=Ke(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:tr(e.itemField,t.itemField),itemLabel:e.itemLabel??t.itemLabel,minItems:e.minItems??t.minItems,maxItems:e.maxItems??t.maxItems}}return{...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}}function Ke(e,t){let n=new Map(t.map(i=>[i.key,i]));return[...e.map(i=>{let s=n.get(i.key);return n.delete(i.key),s?eo(i,s):i}),...n.values()]}function eo(e,t){let n={...t,...e,description:e.description??t.description,placeholder:e.placeholder??t.placeholder};if(e.type==="object"&&t.type==="object")return{...n,type:"object",fields:Ke(e.fields,t.fields)};if(e.type==="list"&&t.type==="list"){let r=Ke(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:tr(e.itemField,t.itemField),itemLabel:e.itemLabel??t.itemLabel,minItems:e.minItems??t.minItems,maxItems:e.maxItems??t.maxItems}}return{...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}}function tr(e,t){return e?!t||e.type!==t.type?e:{...t,...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}:t}function nr(e,t){let n=(i,s,o)=>{let{key:a,...c}=i;return{...c,id:o.id,path:s,pageKey:o.pageKey}},r=(i,s,o)=>{if(te(s)===te(t))return n(i,s,o);if(i.type==="object")for(let a of i.fields){let c=r(a,me(s,a.key),o);if(c)return c}if(i.type==="list"){let a=`${te(s)}[*]`;for(let c of i.fields??[]){let d=r(c,me(a,c.key),o);if(d)return d}}return null};for(let i of e.sections){if(te(i.path)===te(t))return i;if(i.type==="object")for(let s of i.fields??[]){let o=r(s,me(i.path,s.key),i);if(o)return o}if(i.type==="list"){let s=`${te(i.path)}[*]`;for(let o of i.fields??[]){let a=r(o,me(s,o.key),i);if(a)return a}}}return null}function Ze(e,t){let n=te(e),r=te(t);return n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function te(e){return e.replace(/\[\d+\]/g,"[*]").trim()}function Kn(e){return te(e).split(/\.|\[/).filter(Boolean).length}function rr(e){let t=e.filter(ge);return t.length===0?e.find(n=>n!=null):t.reduce((n,r)=>ir(n,r),{})}function ir(e,t){let n={...e};for(let[r,i]of Object.entries(t)){let s=n[r];if(ge(s)&&ge(i)){n[r]=ir(s,i);continue}if(Array.isArray(s)&&Array.isArray(i)){n[r]=[...s,...i];continue}(s==null||Array.isArray(s)&&s.length===0)&&(n[r]=i)}return n}function Xe(e,t){let n=to(e,t);if(n!=="image"||typeof t!="string"||!t.trim())return{type:n};try{let r=new URL(t,"https://fivora-template.invalid"),i=de(Number(r.searchParams.get("w")??r.searchParams.get("width"))),s=de(Number(r.searchParams.get("h")??r.searchParams.get("height")));return{type:n,...i?{recommendedWidth:i}:{},...s?{recommendedHeight:s}:{}}}catch{return{type:n}}}function to(e,t){if(typeof t=="boolean")return"boolean";if(typeof t=="number")return"number";let n=e.toLowerCase();return n.includes("email")?"email":n.includes("phone")||n.includes("mobile")||n.includes("whatsapp")||n.includes("contactnumber")?"tel":n.includes("image")||n.includes("logo")||n.includes("banner")||n.includes("thumbnail")||n.includes("photo")?"image":n.includes("url")||n.includes("link")||typeof t=="string"&&/^https?:\/\//i.test(t.trim())?"url":n.includes("description")||n.includes("about")||n.includes("mission")||n.includes("vision")||n.includes("history")||n.includes("hours")||n.includes("address")||n.includes("body")||typeof t=="string"&&t.length>120?"textarea":"text"}function me(e,t){return e?`${e}.${t}`:t}function z(e){return typeof e=="string"?e.trim():""}function ge(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function or(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function sr(e){return/ies$/i.test(e)?e.replace(/ies$/i,"y"):/s$/i.test(e)&&!/ss$/i.test(e)?e.replace(/s$/i,""):e}var no=["primary","secondary","accent","background","text","surface","surfaceAlt","heading","mutedText","border","headerBackground","footerBackground","cardBackground","buttonBackground","buttonText"],ro=["headingFont","bodyFont","baseSize","headingScale","bodyLineHeight","headingLineHeight","headingWeight","bodyWeight","letterSpacing"],io=["heroMinHeight","sectionPadding","contentMaxWidth","containerPadding","sectionGap","elementGap","gridGap"],oo=["textAlign","contentAlign","heroTextAlign","cardTextAlign","gridColumns"],so=["cardWidth","cardMinHeight","cardPadding","cardRadius","cardBorderWidth","cardShadow","buttonPadding","buttonRadius","buttonShadow","imageRadius","headerHeight"],ao=["backgroundColor","textColor","headingColor","minHeight","padding","contentMaxWidth","gap","textAlign","contentAlign","cardBackgroundColor","cardWidth","cardMinHeight","cardRadius","gridColumns"],lo=["fontFamily","fontSize","lineHeight","fontWeight","letterSpacing","color","backgroundColor","textAlign","width","height","minWidth","minHeight","maxWidth","maxHeight","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius"];function re(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function co(e){let t=e.trim();if(!t)return"";if(!(t.length>160)&&!/[;{}<>\r\n]/.test(t)&&!/(?:url\s*\(|expression\s*\(|@import|javascript:)/i.test(t))return t}function ar(e){let t=e.trim().toLowerCase(),n=t.match(/^#([0-9a-f]{3})$/);return n?`#${[...n[1]].map(r=>r.repeat(2)).join("")}`:/^#[0-9a-f]{6}$/.test(t)?t:null}function uo(e){if(!re(e))return;let t={};for(let[n,r]of Object.entries(e).slice(0,64)){if(typeof r!="string")continue;let i=ar(n),s=ar(r);!i||!s||(t[i]=s)}return Object.keys(t).length>0?t:void 0}function he(e,t){if(!re(e))return;let n={};for(let r of t){if(typeof e[r]!="string")continue;let i=co(e[r]);i!==void 0&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function fo(e){return/^[a-zA-Z0-9_-]{1,64}$/.test(e)}function po(e){return/^[a-zA-Z0-9_.:\[\]-]{1,180}$/.test(e)}function mo(){return{version:1}}function go(e){if(!re(e))return mo();let t=he(e.colors,no),n=uo(e.colorReplacements),r=he(e.typography,ro),i=he(e.spacing,io),s=he(e.layout,oo),o=he(e.components,so),a={};if(re(e.sections))for(let[d,u]of Object.entries(e.sections)){if(!fo(d)||!re(u))continue;let E={...he(u,ao)??{}};typeof u.visible=="boolean"&&(E.visible=u.visible),Object.keys(E).length>0&&(a[d]=E)}let c={};if(re(e.elementStyles))for(let[d,u]of Object.entries(e.elementStyles).slice(0,256)){if(!po(d)||!re(u))continue;let g=he(u,lo);g&&Object.keys(g).length>0&&(c[d]=g)}return{version:1,...t?{colors:t}:{},...n?{colorReplacements:n}:{},...r?{typography:r}:{},...i?{spacing:i}:{},...s?{layout:s}:{},...o?{components:o}:{},...Object.keys(a).length>0?{sections:a}:{},...Object.keys(c).length>0?{elementStyles:c}:{}}}function lr(e){if(!re(e))return null;let t=e.themeSchema;if(!re(t))return null;let n=go(re(t.defaults)?{version:1,...t.defaults}:null),r={...n.colors?{colors:n.colors}:{},...n.typography?{typography:n.typography}:{},...n.spacing?{spacing:n.spacing}:{},...n.layout?{layout:n.layout}:{},...n.components?{components:n.components}:{},...n.sections?{sections:n.sections}:{}};return{version:typeof t.version=="number"?t.version:1,tokens:Array.isArray(t.tokens)?t.tokens.filter(i=>typeof i=="string"):void 0,...Object.keys(r).length>0?{defaults:r}:{}}}var ho=e=>new Error(e),yo=new Set(["npm install","npm ci","pnpm install","pnpm install --frozen-lockfile","yarn install","yarn install --frozen-lockfile"]),Eo=new Set(["npm run build","pnpm run build","yarn build","yarn run build"]);function dr(e,t=ho){let n=E=>{throw t(E)};(!e||typeof e!="object")&&n("Template manifest is missing or invalid.");let r=e;r.framework!=="nextjs-static-export"&&n('Template manifest framework must be "nextjs-static-export".'),(typeof r.siteDataFile!="string"||!r.siteDataFile.trim())&&n("Template manifest siteDataFile is required.");let i=typeof r.version=="number"&&Number.isFinite(r.version)?r.version:1,s=bo(r.visualEditing,i,t),o=Zn(r.editorSchema),a=lr(r),c=Array.isArray(r.colorPalette)?r.colorPalette.filter(E=>!!E&&typeof E=="object").flatMap(E=>{let y=typeof E.color=="string"?E.color.trim().toLowerCase():"";if(!/^#[0-9a-f]{6}$/.test(y))return[];let f=typeof E.usageCount=="number"&&Number.isFinite(E.usageCount)?Math.max(1,Math.floor(E.usageCount)):1;return[{color:y,usageCount:f}]}).slice(0,40):[],d=Ye(o);if(d.length>0){let E=d.slice(0,5).map(y=>`"${y.path}"`).join(", ");n(`Template editorSchema declares the same editable path in more than one place: ${E}. Keep each primitive field and list in exactly one section; a dedicated nested section must not also be repeated inside its ancestor section.`)}let u=cr(r.installCommand,yo,"installCommand",n),g=cr(r.buildCommand,Eo,"buildCommand",n);return{framework:"nextjs-static-export",version:i,siteDataFile:r.siteDataFile.trim(),editorSchema:o,pages:Array.isArray(r.pages)?r.pages.filter(E=>!!E&&typeof E=="object").map(E=>{let y=typeof E.id=="string"&&E.id.trim()?E.id.trim():null,f=typeof E.label=="string"&&E.label.trim()?E.label.trim():null;return!y||!f?n("Each template manifest page must include id and label."):{id:y,label:f,route:typeof E.route=="string"&&E.route.trim()?E.route.trim():void 0,required:typeof E.required=="boolean"?E.required:!1,description:typeof E.description=="string"?E.description.trim():void 0}}):void 0,visualEditing:s,...a?{themeSchema:a}:{},...c.length>0?{colorPalette:c}:{},outputDirectory:typeof r.outputDirectory=="string"?r.outputDirectory.trim():void 0,installCommand:u,buildCommand:g,basePathEnvVar:typeof r.basePathEnvVar=="string"?r.basePathEnvVar.trim():"NEXT_PUBLIC_SITE_BASE_PATH",publicSiteUrlEnvVar:typeof r.publicSiteUrlEnvVar=="string"?r.publicSiteUrlEnvVar.trim():void 0}}function cr(e,t,n,r){if(e==null||e==="")return;if(typeof e!="string")return r(`Template manifest ${n} must be a string.`);let i=e.trim().replace(/\s+/g," ");return t.has(i)?i:r(`Template manifest ${n} is not allowed. Use a standard npm, pnpm, or yarn install/build command.`)}function bo(e,t,n){let r=a=>{throw n(a)};if(!e||typeof e!="object"||Array.isArray(e))return t>=2&&r('Template manifest version 2 requires visualEditing.contractVersion 1 and visualEditing.mode "strict".'),{contractVersion:1,mode:"legacy"};let i=e;i.contractVersion!==1&&r("Template visualEditing.contractVersion must be 1.");let s=i.mode==="strict"||i.mode==="legacy"?i.mode:null;if(!s)return r('Template visualEditing.mode must be "strict" or "legacy".');t>=2&&s!=="strict"&&r('Template manifest version 2 requires visualEditing.mode "strict".');let o=Array.isArray(i.controlOnlyPaths)?i.controlOnlyPaths.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean):[];return{contractVersion:1,mode:s,controlOnlyPaths:o.length>0?o:void 0}}var So={"data-preview-field-path":"field","data-preview-list-path":"list","data-preview-item-path":"item","data-preview-page-key":"page"},ur=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*`([\s\S]*?)`\s*\}|\{\s*"([^"]*)"\s*\}|\{\s*'([^']*)'\s*\})/g,fr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=/g,pr=String.raw`[^.[\]\s]+`,To=new RegExp(String.raw`^${pr}(?:\[(?:\d+|\*)\])*(?:\.${pr}(?:\[(?:\d+|\*)\])*)*$`),wo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Po=new Set(["head","script","style","noscript","svg","template"]),mr=new Set(["html","body","main","header","footer","nav","section","article","aside","form","div","ul","ol","table","thead","tbody","tfoot","tr"]),Qe="FIVORA_PREVIEW_SITE_DATA",Er=`${["MARKET","PLACE"].join("")}_PREVIEW_`,et=`${Er}SITE_DATA`;var tt="FIVORA_PREVIEW_READY",Ft=`${Er}READY`,Io=tt;function Ot(e,t){let n={fieldPatterns:new Set,concreteFields:new Set,listPatterns:new Set,concreteLists:new Set,itemPatterns:new Set,concreteItems:new Set};if(e)for(let[r,i]of Object.entries(e))Bt(i,r,n);for(let r of t?.sections??[])Vt(r.path,r,n);return{fieldPatterns:[...n.fieldPatterns].sort(),concreteFields:[...n.concreteFields].sort(),listPatterns:[...n.listPatterns].sort(),concreteLists:[...n.concreteLists].sort(),itemPatterns:[...n.itemPatterns].sort(),concreteItems:[...n.concreteItems].sort()}}function jt(e,t){let n=Pr(e??{});for(let r of t?.sections??[])Ao(n,r.path,r);return n}function br(e,t){let n=structuredClone(e??{});for(let r of t?.sections??[])Co(n,r.path,r);return $t(n,"")}function Sr(e){let t=[],n=[];for(let r of e){let i=new Set;ur.lastIndex=0;for(let s of r.content.matchAll(ur)){let o=s[1],a=s[2]??s[3]??s[4]??s[5]??s[6]??"",c=s.index??0;i.add(c),t.push({kind:So[o],value:Ee(a).trim(),filePath:r.filePath,artifactKind:r.kind,offset:c,line:j(r.content,c)})}fr.lastIndex=0;for(let s of r.content.matchAll(fr)){let o=s.index??0;i.has(o)||n.push(`${r.filePath}:${j(r.content,o)} ${s[1]} must use a literal string or a JSX template literal.`)}}return{markers:t,unparseableAttributes:n}}function Tr(e){let t=e.manifestVersion>=2||e.visualEditing?.mode==="strict"?"strict":"legacy",n=[],r=[],i=Ot(e.contentDefaults,e.editorSchema),s=Sr(e.artifacts),o=s.markers;e.contentDefaults||n.push('site-data.json must contain a JSON object at "content".'),e.editorSchema||n.push("An editor schema could not be derived from site-data.json content."),Wo(e.editorSchema,n),qo(e.editorSchema,n),Fo(e.editorSchema,n,e.pages),Ro(e.editorSchema,e.contentDefaults,n),Lo(e.artifacts,n),No(e.artifacts,n),Oo(e.artifacts,e.contentDefaults,e.editorSchema,n),r.push(...s.unparseableAttributes.map(T=>`${T} Exported exact markers may still satisfy strict coverage.`));let a=J(o,"field",n),c=J(o,"list",n),d=J(o,"item",n),u=o.filter(T=>T.artifactKind==="html"),g=J(u,"field",n),E=J(u,"list",n),y=J(u,"item",n),f=o.filter(T=>T.artifactKind==="source"),m=J(f,"field",n),p=J(f,"list",n),b=J(f,"item",n),S=Ir(e.visualEditing?.controlOnlyPaths??[],i,n);Dt({label:"editable field",expectedPatterns:i.fieldPatterns,concretePaths:i.concreteFields,htmlMarkerPaths:g,sourceMarkerPaths:m,controlOnlyPaths:S,findings:n}),Dt({label:"editable list",expectedPatterns:i.listPatterns,concretePaths:i.concreteLists,htmlMarkerPaths:E,sourceMarkerPaths:p,controlOnlyPaths:[],findings:n}),Dt({label:"editable list item",expectedPatterns:i.itemPatterns,concretePaths:i.concreteItems,htmlMarkerPaths:y,sourceMarkerPaths:b,controlOnlyPaths:[],findings:n}),Lt("field",a,i.fieldPatterns,i.concreteFields,n),Lt("list",c,i.listPatterns,i.concreteLists,n),Lt("item",d,i.itemPatterns,i.concreteItems,n),Cr(e.manifestVersion,e.pages??[],o,e.artifacts,n),xr({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:o,fieldPaths:G([...i.fieldPatterns.filter(T=>!T.includes("[*]")),...i.concreteFields]),listPaths:G([...i.listPatterns.filter(T=>!T.includes("[*]")),...i.concreteLists]),itemPaths:i.concreteItems,controlOnlyPaths:S,findings:n});let l=Mo(e.artifacts,e.pages??[]);t==="strict"?n.push(...l):r.push(...l);let h=G(n),w=G(r);return t==="legacy"?{mode:t,errors:[],warnings:G([...h.map(T=>`[legacy] ${T}`),...w]),inventory:i,markers:o}:{mode:t,errors:h,warnings:w,inventory:i,markers:o}}function wr(e){let t=[],n=[],r=Ot(e.contentDefaults,e.editorSchema),i=jt(e.contentDefaults,e.editorSchema),s=Ot(i,e.editorSchema),o=G([...r.fieldPatterns.filter(m=>!m.includes("[*]")),...s.concreteFields]),a=G([...r.listPatterns.filter(m=>!m.includes("[*]")),...s.concreteLists]),c=s.concreteItems,d=e.artifacts.filter(m=>m.kind==="html"),u=Sr(d),g=J(u.markers,"field",t),E=J(u.markers,"list",t),y=J(u.markers,"item",t),f=Ir(e.visualEditing?.controlOnlyPaths??[],r,t);Rt({markerPaths:g,expectedPaths:s.concreteFields,knownPatterns:r.fieldPatterns,attribute:"field",findings:t}),Rt({markerPaths:E,expectedPaths:s.concreteLists,knownPatterns:r.listPatterns,attribute:"list",findings:t}),Rt({markerPaths:y,expectedPaths:s.concreteItems,knownPatterns:r.itemPatterns,attribute:"item",findings:t});for(let m of o)ot(m,f)||g.includes(m)||t.push(`Empty-state export removed data-preview-field-path="${m}". Keep the editable target mounted when its value is empty, false, or zero.`);for(let m of a)E.includes(m)||t.push(`Empty-state export removed data-preview-list-path="${m}". Keep the list container mounted when the list has no items.`);for(let m of c)y.includes(m)||t.push(`Empty-state export removed data-preview-item-path="${m}" required by minItems/required list validation.`);return Cr(e.manifestVersion,e.pages??[],u.markers,d,t),xr({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:u.markers,fieldPaths:o,listPaths:a,itemPaths:c,controlOnlyPaths:f,findings:t}),n.push(...u.unparseableAttributes),{errors:G(t),warnings:G(n),requiredFieldPaths:o,requiredListPaths:a,requiredItemPaths:c}}function Rt(e){let t=new Set(e.expectedPaths),n=new Set(e.knownPatterns);for(let r of e.markerPaths)r.includes("[*]")||t.has(r)||!n.has(K(r))||e.findings.push(`Empty-state export rendered out-of-range data-preview-${e.attribute}-path="${r}" for a list item that does not exist. Render list items from the actual site-data array instead of fixed indexes or placeholder cards.`)}function Co(e,t,n){let r=t.split(".").map(o=>o.trim()).filter(Boolean);if(r.length===0||r.some(o=>o.includes("[")))return;let i=e;for(let o of r.slice(0,-1)){let a=i[o];Q(a)||(i[o]={}),i=i[o]}let s=r.at(-1);Mt(i,s,n,t)}function Mt(e,t,n,r){if(n.type==="list"){let i=Array.isArray(e[t])?[...e[t]]:[],s=ye(n.maxItems),o=Math.min(s??Number.MAX_SAFE_INTEGER,s===0?0:Math.max(1,ye(n.minItems)??(n.required?1:0)));for(;i.length<o;)i.push(void 0);e[t]=i.map((a,c)=>{let d=`${r}[${c}]`;if(n.itemField)return gr(a,n.itemField.type,d,n.itemField.options);let u=Q(a)?a:{};for(let g of n.fields??[])Mt(u,g.key,g,X(d,g.key));return u});return}if(n.type==="object"){let i=Q(e[t])?e[t]:{};e[t]=i;for(let s of n.fields??[])Mt(i,s.key,s,X(r,s.key));return}e[t]=gr(e[t],n.type,r,n.options)}function gr(e,t,n,r){return t==="number"?typeof e=="number"&&Number.isFinite(e)&&e!==0?e:1:t==="boolean"?e===!0?e:!0:typeof e=="string"&&e.trim()&&(t!=="select"||!r?.length||r.includes(e))?e:t==="select"?r?.[0]??nt(n):t==="url"?`https://template-validation.example.invalid/${rt(n)}`:t==="image"?`/template-validation-${rt(n)}.svg`:t==="email"?"validation@example.invalid":t==="tel"?"+12025550142":nt(n)}function $t(e,t){return Array.isArray(e)?e.map((n,r)=>$t(n,`${t}[${r}]`)):Q(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let i=X(t,n);return[n,$t(r,i)]})):typeof e=="string"?e.trim()?e:xo(t):typeof e=="number"?Number.isFinite(e)&&e!==0?e:1:typeof e=="boolean"?!0:e??nt(t)}function xo(e){let t=e.toLowerCase();return t.includes("email")?"validation@example.invalid":t.includes("phone")||t.includes("mobile")||t.includes("whatsapp")||t.includes("contactnumber")?"+12025550142":t.includes("image")||t.includes("logo")||t.includes("banner")||t.includes("thumbnail")||t.includes("photo")?`/template-validation-${rt(e)}.svg`:t.includes("url")||t.includes("link")?`https://template-validation.example.invalid/${rt(e)}`:nt(e)}function nt(e){return`Validation ${e||"content"}`}function rt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"content"}function Pr(e){return Array.isArray(e)?[]:Q(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Pr(n)])):typeof e=="string"?"":typeof e=="number"?0:typeof e=="boolean"?!1:e}function Ao(e,t,n){let r=t.split(".").map(o=>o.trim()).filter(Boolean);if(r.length===0||r.some(o=>o.includes("[")))return;let i=e;for(let o of r.slice(0,-1)){let a=i[o];Q(a)||(i[o]={}),i=i[o]}let s=r.at(-1);zt(i,s,n)}function zt(e,t,n){if(n.type==="list"){let r=Math.min(ye(n.maxItems)??Number.MAX_SAFE_INTEGER,ye(n.minItems)??(n.required?1:0));e[t]=Array.from({length:r},()=>_o(n));return}if(n.type==="object"){let r=Q(e[t])?e[t]:{};e[t]=r;for(let i of n.fields??[])zt(r,i.key,i);return}e[t]=n.type==="number"?0:n.type==="boolean"?!1:""}function _o(e){if(e.itemField)return e.itemField.type==="number"?0:e.itemField.type==="boolean"?!1:"";let t={};for(let n of e.fields??[])zt(t,n.key,n);return t}function Bt(e,t,n){if(Array.isArray(e)){let r=K(t);n.listPatterns.add(r),n.concreteLists.add(t),n.itemPatterns.add(`${r}[*]`),e.forEach((i,s)=>{let o=`${t}[${s}]`;n.concreteItems.add(o),Array.isArray(i)||Q(i)?Bt(i,o,n):(n.fieldPatterns.add(K(o)),n.concreteFields.add(o))});return}if(Q(e)){for(let[r,i]of Object.entries(e))Bt(i,X(t,r),n);return}n.fieldPatterns.add(K(t)),n.concreteFields.add(t)}function Vt(e,t,n){if(t.type==="object"){for(let r of t.fields??[])Vt(X(e,r.key),r,n);return}if(t.type==="list"){let r=K(e),i=`${r}[*]`;n.listPatterns.add(r),n.itemPatterns.add(i),t.itemField&&n.fieldPatterns.add(i);for(let s of t.fields??[])Vt(X(i,s.key),s,n);return}n.fieldPatterns.add(K(e))}function J(e,t,n){let r=[];for(let i of e.filter(s=>s.kind===t)){let s=Re(i.value);if(!s){n.push(`${i.filePath}:${vr(i)} has invalid data-preview-${t}-path "${i.value}".`);continue}r.push(s)}return G(r)}function Ir(e,t,n){let r=[];for(let i of e){let s=Re(i);if(!s){n.push(`controlOnlyPaths contains invalid path "${i}".`);continue}if(![...t.fieldPatterns,...t.concreteFields].some(a=>Ut(s,a))){n.push(`controlOnlyPaths contains unknown editable field path "${s}".`);continue}r.push(s)}return G(r)}function Dt(e){for(let t of e.expectedPatterns){if(ot(t,e.controlOnlyPaths))continue;let n=e.concretePaths.filter(r=>K(r)===t);if(!t.includes("[*]")){e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${Nt(e.label)}="${t}" for ${e.label}.`);continue}e.sourceMarkerPaths.some(r=>Go(r,t))||e.findings.push(`Source is missing dynamic data-preview-${Nt(e.label)} mapping for ${e.label} "${t}". Use an exact JSX template path such as [\${index}] so newly added and reordered items remain editable.`),n.length>0}for(let t of e.concretePaths)e.expectedPatterns.includes(t)||ot(t,e.controlOnlyPaths)||e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${Nt(e.label)}="${t}" for concrete ${e.label}.`)}function Lt(e,t,n,r,i){for(let s of t)n.some(a=>Ut(s,a))||r.some(a=>Ut(s,a))||i.push(`data-preview-${e}-path references unknown path "${s}".`)}function Cr(e,t,n,r,i){let s=r.filter(u=>u.kind==="html"),o=n.filter(u=>u.kind==="page"&&u.artifactKind==="html"),a=new Set(t.map(u=>u.id)),c=new Set,d=new Map;t.length===0&&i.push("Strict visual editing requires at least one manifest pages[] entry.");for(let u of t){c.has(u.id)&&i.push(`Manifest pages[] contains duplicate id "${u.id}".`),c.add(u.id);let g=Wt(u.route)??(e<2?_r(u.id):null);if(!g){i.push(`Manifest page "${u.id}" must declare a canonical route for strict visual editing.`);continue}let E=d.get(g);E?i.push(`Manifest pages "${E}" and "${u.id}" use duplicate route "${g}".`):d.set(g,u.id);let y=s.filter(p=>qt(p.filePath,g));if(y.length===0){i.push(`Manifest page "${u.id}" route "${g}" has no exported HTML file.`);continue}let f=new Set(y.map(p=>p.filePath));o.some(p=>p.value===u.id&&f.has(p.filePath))||i.push(`Exported route "${g}" is missing data-preview-page-key="${u.id}".`)}for(let u of n.filter(g=>g.kind==="page"))a.has(u.value)||i.push(`${u.filePath}:${vr(u)} data-preview-page-key references unknown manifest page "${u.value}".`)}function xr(e){let t=(e.schema?.sections??[]).map(i=>({section:i,canonicalPath:Re(i.path)})).filter(i=>!!i.canonicalPath),n=new Map(e.pages.map(i=>[i.id,i])),r=(i,s)=>{for(let o of s){if(i==="field"&&ot(o,e.controlOnlyPaths))continue;let a=t.filter(E=>vo(o,E.canonicalPath)).sort((E,y)=>y.canonicalPath.length-E.canonicalPath.length)[0];if(!a?.section.pageKey)continue;let c=n.get(a.section.pageKey);if(!c){e.findings.push(`editorSchema section "${a.section.path}" assigns ${hr(i)} "${o}" to unknown manifest page "${a.section.pageKey}".`);continue}let d=Wt(c.route)??(e.manifestVersion<2?_r(c.id):null);!d||!e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&Re(E.value)===o)||e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&Re(E.value)===o&&qt(E.filePath,d))||e.findings.push(`Page-owned ${hr(i)} "${o}" from editorSchema section "${a.section.path}" must render data-preview-${ko(i)}="${o}" on manifest page "${c.id}" route "${d}". Shared sections without pageKey may render globally.`)}};r("field",G(e.fieldPaths)),r("list",G(e.listPaths)),r("item",G(e.itemPaths))}function vo(e,t){let n=K(e),r=K(t);return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function hr(e){return e==="field"?"editable field":e==="list"?"editable list":"editable list item"}function ko(e){return e==="field"?"field-path":e==="list"?"list-path":"item-path"}function Fo(e,t,n=[]){let r=new Set(n.map(o=>o.id?.trim()).filter(o=>!!o)),i=(o,a)=>{if(!a?.some(c=>typeof c=="string"&&c.trim().length>0)){t.push(`editorSchema select field "${o}" must declare at least one non-empty option for strict visual editing. Add options: ["First option", ...] or change the field type.`);return}if(r.size>0&&/(?:destination|action|targetpage|buttonaction|pagekey)/i.test(o))for(let d of a){let u=typeof d=="string"?d.trim():"";u&&u!=="none"&&u!=="external"&&!r.has(u)&&t.push(`editorSchema select field "${o}" declares destination option "${u}" which is not in fivora-template.json pages[]. Declared pages: ${[...r].join(", ")}.`)}},s=(o,a)=>{if(a.type==="select"){i(o,a.options);return}if(a.type==="object"){for(let d of a.fields??[])s(X(o,d.key),d);return}if(a.type!=="list")return;let c=`${K(o)}[*]`;a.itemField?.type==="select"&&i(c,a.itemField.options);for(let d of a.fields??[])s(X(c,d.key),d)};for(let o of e?.sections??[])s(o.path,o)}function Ro(e,t,n){let r=(s,o)=>{if(o.type==="object"){for(let g of o.fields??[])r(X(s,g.key),g);return}if(o.type!=="list")return;let a=ye(o.minItems),c=ye(o.maxItems);o.minItems!==void 0&&a===null&&n.push(`editorSchema list "${s}" minItems must be a non-negative safe integer.`),o.maxItems!==void 0&&c===null&&n.push(`editorSchema list "${s}" maxItems must be a non-negative safe integer.`);let d=a??(o.required?1:0);c!==null&&d>c&&n.push(`editorSchema list "${s}" requires at least ${d} item${d===1?"":"s"} but maxItems is ${c}. Increase maxItems or lower minItems/required.`);let u=`${K(s)}[*]`;for(let g of o.fields??[])r(X(u,g.key),g)},i=(s,o,a)=>{if(o.type==="object"){let u=Q(a)?a:{};for(let g of o.fields??[])i(X(s,g.key),g,u[g.key]);return}if(o.type!=="list")return;let c=Array.isArray(a)?a:[],d=ye(o.maxItems);d!==null&&c.length>d&&n.push(`site-data.json content list "${s}" contains ${c.length} items, exceeding editorSchema maxItems ${d}.`);for(let[u,g]of c.entries()){let E=Q(g)?g:{};for(let y of o.fields??[])i(X(`${s}[${u}]`,y.key),y,E[y.key])}};for(let s of e?.sections??[])r(s.path,s),i(s.path,s,Do(t??{},s.path))}function ye(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:null}function Do(e,t){let n=e;for(let r of t.split(".").map(i=>i.trim())){if(!r||!Q(n))return;n=n[r]}return n}function Lo(e,t){let n=[/\b(?:setAttribute|setAttributeNS|toggleAttribute)\s*\(\s*['"`]data-preview-static['"`]/m,/\.(?:attr|prop)\s*\(\s*['"`]data-preview-static['"`]/m,/\bdataset\s*(?:\.\s*previewStatic|\[\s*['"`]previewStatic['"`]\s*\])\s*=/m,/\b(?:innerHTML|outerHTML)\s*\+?=[^;]{0,500}data-preview-static/m,/\.(?:replace|replaceAll)\s*\([\s\S]{0,500}?data-preview-static/m];for(let r of e.filter(i=>i.kind==="source")){let i=n.map(u=>u.exec(r.content)).find(u=>!!u),s=r.content.search(/data-preview-static/),o=/\b(?:writeFile|writeFileSync|appendFile|appendFileSync)\s*\(/m.exec(r.content),a=/\.[cm]?[jt]s$/i.test(r.filePath),c=s>=0&&a&&o;if(!i&&!c)continue;let d=i?.index??s;t.push(`${r.filePath}:${j(r.content,d)} programmatically injects data-preview-static. Author each intentional static annotation directly on the smallest source element; blanket or post-build annotation bypasses strict editable-content validation.`)}}function No(e,t){let n=e.filter(y=>y.kind==="source"),r=n.map(y=>y.content).join(`
3
- `);if(/(?:import|export)\s+[\s\S]*?\b(?:SiteDataProvider|BaseSiteDataProvider|useSiteData|DenebProvider|DenebSiteDataProvider|DenebUiProvider)\b[\s\S]*?\bfrom\s+['"][^'"]*['"]/m.test(r)||/(?:import|export)\s+[\s\S]*?\bfrom\s+['"](?:@fivora\/|deneb-ui|@deneb-ui\/)/m.test(r)||/<(?:SiteDataProvider|BaseSiteDataProvider|DenebProvider|DenebSiteDataProvider|DenebUiProvider|[A-Za-z_$][\w$]*\.(?:SiteDataProvider|DenebProvider))\b/m.test(r))return;let s=r.includes(Qe)||r.includes(et),o=r.includes(tt)||r.includes(Ft),a=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(r)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(r),c=/\bset[A-Z_$][\w$]*\s*\(/m.test(r)||/\bdispatch\s*\(/m.test(r)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(r),d=n.some(y=>{let f=y.content,m=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(f)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(f),p=/\bset[A-Z_$][\w$]*\s*\(/m.test(f)||/\bdispatch\s*\(/m.test(f)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(f);return(f.includes(Qe)||f.includes(et))&&m&&p}),g=/\bcreateContext\s*[<(]/m.test(r)&&/(?:\.Provider\b|<[A-Za-z_$][\w$]*Provider\b)/m.test(r)&&/\buseContext\s*[<(]/m.test(r)||/\buseSyncExternalStore\s*[<(]/m.test(r)||/\bcreate(?:Store|Signal)\s*[<(]/m.test(r)&&/\buse[A-Z_$][\w$]*(?:Store|Data)\s*[<(]/m.test(r),E=n.some(y=>(y.content.includes(tt)||y.content.includes(Ft))&&/\bpostMessage\s*\(/m.test(y.content));s||t.push(`Preview runtime source must implement the "${Qe}" (or legacy "${et}") protocol so editor changes replace the rendered site data instead of remaining in a static JSON import.`),o||t.push(`Preview runtime source must implement the "${tt}" (or legacy "${Ft}") protocol so the editor can wait for a live preview before sending data.`),(!a||!c||!d)&&t.push(`Preview runtime source must handle "${Qe}" (or legacy "${et}") and apply its payload through a reactive state setter, reducer, or store update in the same live-data module.`),g||t.push("Preview runtime source must expose live site data through a recognizable reactive provider/hook (for example createContext + Provider + useContext, useSyncExternalStore, or a reactive store hook). Static site-data.json imports alone cannot be certified."),E||t.push(`Preview runtime source must call postMessage with "${Io}" after its live-data listener is ready.`)}function Oo(e,t,n,r){let i=e.filter(y=>y.kind==="source"),s=[/\/products\/\$\{/m,/['"`]\/products\/['"`]\s*\+\s*(?:encodeURIComponent\s*\()?/m];for(let y of i){let f=s.map(m=>m.exec(y.content)).find(m=>!!m);f&&r.push(`${y.filePath}:${j(y.content,f.index)} uses a build-time dynamic /products/:id URL. Live catalog items can be added after a static export, so product links must use the stable exported route /products/detail/?id=... and resolve the ID from the live catalog on the client.`)}let o=Array.isArray(t?.products)||!!n?.sections.some(y=>y.path==="products"||y.path.startsWith("products["))||i.some(y=>/data-preview-(?:list|item|field)-path\s*=\s*(?:["']products|\{\s*`products)/m.test(y.content)),a=i.some(y=>/\bplatformProductDetailHref\s*\(/m.test(y.content)||/\/products\/detail\/?\?[^'"`\s}]*\bid=/m.test(y.content)),c=i.some(y=>/(?:^|\/)src\/(?:app\/products\/detail\/page|pages\/products\/detail)\.[cm]?[jt]sx?$/i.test(y.filePath.replace(/\\/g,"/"))||/\b(?:PlatformProductDetail|usePlatformProductDetail)\b/m.test(y.content)),d=i.some(y=>/(?:^|\/)src\/(?:app\/products\/\[[^/]+\]\/page|pages\/products\/\[[^/]+\])\.[cm]?[jt]sx?$/i.test(y.filePath.replace(/\\/g,"/"))),u=i.some(y=>/\brenderProduct\s*=/m.test(y.content)||/\busePlatformProductDetail\s*\(/m.test(y.content)),g=a||c||o&&d;if(g&&!a&&r.push("Templates with product-detail navigation must link every product through platformProductDetailHref(product.id) or /products/detail/?id=... so products added after the static build use the native detail page."),g&&!c&&r.push("Templates with product-detail navigation must provide a stable client product page at src/app/products/detail/page.* using PlatformProductDetail or usePlatformProductDetail."),g&&d&&c&&!u&&r.push("The template has a native dynamic product-detail page, but its stable live-catalog page does not reuse that design. Pass the native renderer through PlatformProductDetail renderProduct or render it from usePlatformProductDetail so old and newly-added products have the same layout."),!g)return;e.some(y=>y.kind==="html"&&/(?:^|\/)products\/detail\/(?:index\.)?html$/i.test(y.filePath.replace(/\\/g,"/")))||r.push("The template product catalog requires products/detail/index.html, but the static export does not contain it. Add a stable client detail page that reads the query ID and hydrates the matching item from the live catalog.")}function Mo(e,t){let n=[];for(let r of e.filter(i=>i.kind==="html"&&!$o(i.filePath,t)))n.push(...Bo(r));return n}function $o(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");return/^(?:404|500|_error|_not-found)(?:\/index)?\.html$/i.test(n)?!t.some(i=>{let s=Wt(i.route);return s?qt(n,s):!1}):!1}function Bo(e){let t=[],n=[],r=e.content.matchAll(/<!--[\s\S]*?-->|<![^>]*>|<\/?[^>]+>|[^<]+/g);for(let i of r){let s=i[0],o=i.index??0,a=n.at(-1);if(s.startsWith("<!--")||s.startsWith("<!"))continue;if(s.startsWith("</")){let d=s.slice(2,-1).trim().split(/\s+/)[0]?.toLowerCase(),u=n.map(g=>g.tag).lastIndexOf(d);u>=0&&(t.push(...Vo(e,n[u])),n.splice(u));continue}if(s.startsWith("<")){let d=s.match(/^<\s*([a-zA-Z0-9:-]+)/);if(!d)continue;let u=d[1].toLowerCase(),g=/\bdata-preview-field-path\s*=/.test(s),E=/\bdata-preview-list-path\s*=/.test(s),y=/\bdata-preview-item-path\s*=/.test(s),f=g||E||y;if(g)for(let T of n)T.ownsFieldMarker&&(T.hasNestedFieldMarker=!0);let m=s.match(/\bdata-preview-static\s*=\s*(?:"([^"]*)"|'([^']*)')/),p=!!m;p&&!(m?.[1]??m?.[2]??"").trim()&&t.push(`${e.filePath}:${j(e.content,o)} data-preview-static requires a reason.`),f&&(p||a?.staticCovered)&&t.push(`${e.filePath}:${j(e.content,o)} data-preview field/list/item markers cannot be on or inside data-preview-static. The visual editor intentionally ignores targets beneath a static ancestor.`),g&&mr.has(u)&&t.push(`${e.filePath}:${j(e.content,o)} data-preview-field-path cannot be placed on broad <${u}> content containers. Put the marker on the exact visible text, media, link, or control that the field edits.`),p&&mr.has(u)&&t.push(`${e.filePath}:${j(e.content,o)} data-preview-static cannot cover a broad <${u}> content container. Mark only the smallest genuinely non-editable element.`);let b=!!a?.hidden||Ho(s,u);f&&b&&t.push(`${e.filePath}:${j(e.content,o)} data-preview field/list/item marker is hidden. Strict visual-edit targets must remain visible and clickable in the exported page.`);let S=s.match(/\bdata-preview-field-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null,l=s.match(/\bdata-preview-item-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null;l&&a?.itemPath&&!yr(l,a.itemPath)&&t.push(`${e.filePath}:${j(e.content,o)} repeated item "${l}" is nested inside unrelated item "${a.itemPath}". One visual card must be one object-list item; do not couple parallel arrays by index.`);let h=l??a?.itemPath??null;S&&h&&/\[\d+\]/.test(S)&&!yr(S,h)&&t.push(`${e.filePath}:${j(e.content,o)} repeated field "${S}" is rendered inside item "${h}" but belongs to a different list. Model one visual card as one object-list item instead of coupling parallel arrays by index.`);let w={tag:u,ignored:!!a?.ignored||Po.has(u),hidden:b,fieldCovered:!!a?.fieldCovered||g,staticCovered:!!a?.staticCovered||p,ownsFieldMarker:g,hasNestedFieldMarker:!1,fieldPath:S,itemPath:h,shopAttributeValues:Uo(s,u),visibleTextParts:[],offset:o};if(!w.ignored&&!w.fieldCovered&&!w.staticCovered){let T=zo(e,s,u,o);t.push(...T),u==="img"&&!w.hidden&&T.length===0&&t.push(`${e.filePath}:${j(e.content,o)} rendered <img> is not covered by data-preview-field-path or data-preview-static. Bind business media to an exact image field, or mark an intentional fixed/decorative image static with a reason.`)}!wo.has(u)&&!/\/\s*>$/.test(s)&&n.push(w);continue}let c=Ht(s);if(it(c))for(let d of n)d.ownsFieldMarker&&d.visibleTextParts.push(c);a?.ignored||a?.fieldCovered||a?.staticCovered||it(c)&&t.push(`${e.filePath}:${j(e.content,o)} visible text "${st(c,72)}" is not covered by data-preview-field-path or data-preview-static.`)}return t}function yr(e,t){let n=Ee(e).trim(),r=Ee(t).trim();return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function Vo(e,t){if(!t.ownsFieldMarker||t.hasNestedFieldMarker||t.shopAttributeValues.length===0)return[];let n=Ht(t.visibleTextParts.join(" "));return!it(n)||t.shopAttributeValues.some(r=>jo(r,n))?[]:[`${e.filePath}:${j(e.content,t.offset)} data-preview-field-path="${t.fieldPath??""}" cannot cover both <${t.tag}> action/media attributes and different visible text "${st(n,72)}". Put the action/media marker on the element and the label marker on an exact nested text element.`]}function Uo(e,t){return[...e.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)].map(n=>({name:n[1].toLowerCase(),value:Ee(n[2]??n[3]??"").trim()})).filter(({name:n,value:r})=>Ar(t,n,r)).map(({value:n})=>n)}function jo(e,t){let n=r=>Ee(r).replace(/^(?:mailto:|tel:|sms:|https?:\/\/)/i,"").replace(/^www\./i,"").replace(/\/+$/g,"").replace(/\s+/g,"").toLowerCase();return n(e)===n(t)}function zo(e,t,n,r){let i=[],s=[...t.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)];for(let u of s){let g=u[1].toLowerCase(),E=Ee(u[2]??u[3]??"").trim();Ar(n,g,E)&&i.push(`${e.filePath}:${j(e.content,r)} ${n}[${g}="${st(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let o=[...t.matchAll(/\b(placeholder|alt|title|aria-label|value)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)],a=t.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i),c=(a?.[1]??a?.[2]??"").toLowerCase();for(let u of o){let g=u[1].toLowerCase(),E=Ht(u[2]??u[3]??"");!(g==="aria-label"||g==="title"||g==="alt"&&n==="img"||g==="placeholder"&&["input","textarea"].includes(n)||g==="value"&&["input","button"].includes(n)&&!["hidden","checkbox","radio"].includes(c))||!it(E)||i.push(`${e.filePath}:${j(e.content,r)} ${n}[${g}="${st(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let d=t.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i);return d&&/(?:background|background-image)\s*:[^;]*url\(/i.test(d[1]??d[2]??"")&&i.push(`${e.filePath}:${j(e.content,r)} background image is not covered by data-preview-field-path or data-preview-static.`),i}function Ho(e,t){if(/\bhidden(?:\s|=|\/?>)/i.test(e)||/\baria-hidden\s*=\s*(?:"true"|'true')/i.test(e))return!0;if(t==="input"){let i=e.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i);if((i?.[1]??i?.[2]??"").trim().toLowerCase()==="hidden")return!0}let n=e.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i),r=n?.[1]??n?.[2]??"";return/\bdisplay\s*:\s*none\b/i.test(r)||/\bvisibility\s*:\s*hidden\b/i.test(r)}function Wo(e,t){let n=new Set,r=new Set;for(let i of e?.sections??[])n.has(i.id)&&t.push(`editorSchema.sections contains duplicate id "${i.id}".`),r.has(i.path)&&t.push(`editorSchema.sections contains duplicate path "${i.path}".`),n.add(i.id),r.add(i.path)}function qo(e,t){for(let n of Ye(e)){let r=n.firstKind===n.duplicateKind?n.firstKind:"field/list";t.push(`editorSchema declares duplicate editable ${r} path "${n.path}" in sections "${n.firstSectionId}" and "${n.duplicateSectionId}". Each editable path must be owned by exactly one section.`)}}function Ar(e,t,n){return!n||n.startsWith("data:")||n.startsWith("blob:")||n.includes("/_next/")||n.includes("${")?!1:t==="href"?e==="a"&&!/^(?:javascript:|data:|blob:)/i.test(n):t==="src"&&["img","video","source"].includes(e)||t==="poster"&&e==="video"}function Ht(e){return Ee(e).replace(/\s+/g," ").trim()}function it(e){return e.length<=2||!new RegExp("\\p{L}","u").test(e)?!1:!/^(?:true|false|null|undefined)$/i.test(e)}function Nt(e){return e==="editable field"?"field-path":e==="editable list"?"list-path":"item-path"}function Go(e,t){return t.includes("[*]")?e.includes("[*]")&&e===t:e===t}function Ut(e,t){return K(e)===K(t)}function ot(e,t){return t.some(n=>n.includes("[*]")?K(e)===n:e===n)}function Re(e){let t=e.trim().replace(/\[\s*\$\{[^}]+\}\s*\]/g,"[*]").replace(/\[\s+/g,"[").replace(/\s+\]/g,"]");return To.test(t)?t:null}function K(e){return e.replace(/\[\d+\]/g,"[*]")}function X(e,t){return e?`${e}.${t}`:t}function Wt(e){if(!e)return null;let t=e.trim();return!t.startsWith("/")||t.includes("?")||t.includes("#")||t.includes("\\")||t.includes("..")?null:t==="/"?t:t.replace(/\/+$/,"")}function _r(e){return e==="home"?"/":`/${e}`}function qt(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");if(t==="/")return n==="index.html";let r=t.replace(/^\/+/,"");return n===`${r}.html`||n===`${r}/index.html`}function Q(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ee(e){return e.replace(/&quot;/gi,'"').replace(/&#39;|&#x27;/gi,"'").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&nbsp;/gi," ")}function vr(e){return e.line}function j(e,t){let n=1;for(let r=0;r<t;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function G(e){return[...new Set(e)].sort()}function st(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}\u2026`}function Fr(e){let t=e.filter((n,r)=>n.required===!0||r===0).map(n=>n.id);return t.length>0?t:e.slice(0,1).map(n=>n.id)}function kr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ko(e,t,n){let r=e.trim().split(/[?#]/,1)[0];return r==="/"||r===""?n?"/":`/${t}`:/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith("//")?n?"/":`/${t}`:`/${r.replace(/^\/+|\/+$/g,"")}`}function Rr(e,t=[]){let r=(kr(e)&&Array.isArray(e.pages)?e.pages:[]).flatMap((s,o)=>{if(!kr(s)||typeof s.id!="string"||!s.id.trim())return[];let a=s.id.trim(),c=typeof s.label=="string"&&s.label.trim()?s.label.trim():a.replace(/_/g," ");return[{id:a,label:c,route:Ko(typeof s.route=="string"?s.route:"",a,o===0)}]});return r.length>0?r:t.map(s=>s.trim()).filter(Boolean).map((s,o)=>({id:s,label:s.replace(/_/g," "),route:o===0?"/":`/${s}`}))}function Dr(e){let t=new Set(e.selectedPages),n=e.pageDefinitions.filter(i=>!t.has(i.id)),r=[];for(let i of e.html.matchAll(/<[a-z][^>]*\b(?:href|formaction|data-href|data-route|data-url)\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>/gi)){let s=i[1]??i[2]??"";if(!s.trim()||s.trim().startsWith("#")||/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(s.trim()))continue;let o=s.split(/[?#]/,1)[0],a=e.basePath?.replace(/\/+$/g,"")||"",d=`/${(a&&(o===a||o.startsWith(`${a}/`))?o.slice(a.length)||"/":o).replace(/\/index\.html$/i,"/").replace(/\.html$/i,"").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"")}`,u=d==="/"?"/":d,g=n.find(E=>{let y=E.route==="/"?"/":`/${E.route.replace(/^\/+|\/+$/g,"")}`;return y==="/"?u==="/":u===y||u.startsWith(`${y}/`)});g&&r.push({pageId:g.id,route:g.route,href:o})}return r}var pt=Et(ti());function ni(e){let t=[],n=new Set;for(let s of e.artifacts)if(s.kind==="html")for(let o of(0,pt.collectStyleTargetsFromHtml)(s.content))n.add(o);let i=(e.siteData&&typeof e.siteData=="object"&&!Array.isArray(e.siteData)?e.siteData:null)?.styles;return t.push(...(0,pt.validateStyleTree)(i,n.size>0?n:void 0)),t}var _e="deneb-template-validator",yt="1.0.0",mt="fivora-template.json",Is=2500,Cs=12*1024*1024,di="/template-validation",xs={NODE_ENV:"development",NPM_CONFIG_PRODUCTION:"false",npm_config_production:"false",NPM_CONFIG_INCLUDE:"dev",npm_config_include:"dev",NPM_CONFIG_OMIT:"",NPM_CONFIG_omit:"",NPM_CONFIG_IGNORE_SCRIPTS:"true",npm_config_ignore_scripts:"true",PNPM_CONFIG_IGNORE_SCRIPTS:"true",YARN_IGNORE_SCRIPTS:"true",YARN_PRODUCTION:"false"},rn=class{constructor(t,n){this.options=t;this.report={validator:_e,version:yt,command:t.command,input:(0,v.resolve)(t.inputPath),status:"passed",startedAt:n.toISOString(),durationMs:0,steps:[],warnings:[]}}options;report;async step(t,n,r){let i=Date.now();this.options.json||process.stdout.write(`\u2192 ${t}
3
+ `);if(/(?:import|export)\s+[\s\S]*?\b(?:SiteDataProvider|BaseSiteDataProvider|useSiteData|DenebProvider|DenebSiteDataProvider|DenebUiProvider)\b[\s\S]*?\bfrom\s+['"][^'"]*['"]/m.test(r)||/(?:import|export)\s+[\s\S]*?\bfrom\s+['"](?:@fivora\/|deneb-ui|@deneb-ui\/)/m.test(r)||/<(?:SiteDataProvider|BaseSiteDataProvider|DenebProvider|DenebSiteDataProvider|DenebUiProvider|[A-Za-z_$][\w$]*\.(?:SiteDataProvider|DenebProvider))\b/m.test(r))return;let s=r.includes(Qe)||r.includes(et),o=r.includes(tt)||r.includes(Ft),a=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(r)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(r),c=/\bset[A-Z_$][\w$]*\s*\(/m.test(r)||/\bdispatch\s*\(/m.test(r)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(r),d=n.some(y=>{let f=y.content,m=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(f)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(f),p=/\bset[A-Z_$][\w$]*\s*\(/m.test(f)||/\bdispatch\s*\(/m.test(f)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(f);return(f.includes(Qe)||f.includes(et))&&m&&p}),g=/\bcreateContext\s*[<(]/m.test(r)&&/(?:\.Provider\b|<[A-Za-z_$][\w$]*Provider\b)/m.test(r)&&/\buseContext\s*[<(]/m.test(r)||/\buseSyncExternalStore\s*[<(]/m.test(r)||/\bcreate(?:Store|Signal)\s*[<(]/m.test(r)&&/\buse[A-Z_$][\w$]*(?:Store|Data)\s*[<(]/m.test(r),E=n.some(y=>(y.content.includes(tt)||y.content.includes(Ft))&&/\bpostMessage\s*\(/m.test(y.content));s||t.push(`Preview runtime source must implement the "${Qe}" (or legacy "${et}") protocol so editor changes replace the rendered site data instead of remaining in a static JSON import.`),o||t.push(`Preview runtime source must implement the "${tt}" (or legacy "${Ft}") protocol so the editor can wait for a live preview before sending data.`),(!a||!c||!d)&&t.push(`Preview runtime source must handle "${Qe}" (or legacy "${et}") and apply its payload through a reactive state setter, reducer, or store update in the same live-data module.`),g||t.push("Preview runtime source must expose live site data through a recognizable reactive provider/hook (for example createContext + Provider + useContext, useSyncExternalStore, or a reactive store hook). Static site-data.json imports alone cannot be certified."),E||t.push(`Preview runtime source must call postMessage with "${Io}" after its live-data listener is ready.`)}function Oo(e,t,n,r){let i=e.filter(y=>y.kind==="source"),s=[/\/products\/\$\{/m,/['"`]\/products\/['"`]\s*\+\s*(?:encodeURIComponent\s*\()?/m];for(let y of i){let f=s.map(m=>m.exec(y.content)).find(m=>!!m);f&&r.push(`${y.filePath}:${j(y.content,f.index)} uses a build-time dynamic /products/:id URL. Live catalog items can be added after a static export, so product links must use the stable exported route /products/detail/?id=... and resolve the ID from the live catalog on the client.`)}let o=Array.isArray(t?.products)||!!n?.sections.some(y=>y.path==="products"||y.path.startsWith("products["))||i.some(y=>/data-preview-(?:list|item|field)-path\s*=\s*(?:["']products|\{\s*`products)/m.test(y.content)),a=i.some(y=>/\bplatformProductDetailHref\s*\(/m.test(y.content)||/\/products\/detail\/?\?[^'"`\s}]*\bid=/m.test(y.content)),c=i.some(y=>/(?:^|\/)src\/(?:app\/products\/detail\/page|pages\/products\/detail)\.[cm]?[jt]sx?$/i.test(y.filePath.replace(/\\/g,"/"))||/\b(?:PlatformProductDetail|usePlatformProductDetail)\b/m.test(y.content)),d=i.some(y=>/(?:^|\/)src\/(?:app\/products\/\[[^/]+\]\/page|pages\/products\/\[[^/]+\])\.[cm]?[jt]sx?$/i.test(y.filePath.replace(/\\/g,"/"))),u=i.some(y=>/\brenderProduct\s*=/m.test(y.content)||/\busePlatformProductDetail\s*\(/m.test(y.content)),g=a||c||o&&d;if(g&&!a&&r.push("Templates with product-detail navigation must link every product through platformProductDetailHref(product.id) or /products/detail/?id=... so products added after the static build use the native detail page."),g&&!c&&r.push("Templates with product-detail navigation must provide a stable client product page at src/app/products/detail/page.* using PlatformProductDetail or usePlatformProductDetail."),g&&d&&c&&!u&&r.push("The template has a native dynamic product-detail page, but its stable live-catalog page does not reuse that design. Pass the native renderer through PlatformProductDetail renderProduct or render it from usePlatformProductDetail so old and newly-added products have the same layout."),!g)return;e.some(y=>y.kind==="html"&&/(?:^|\/)products\/detail\/(?:index\.)?html$/i.test(y.filePath.replace(/\\/g,"/")))||r.push("The template product catalog requires products/detail/index.html, but the static export does not contain it. Add a stable client detail page that reads the query ID and hydrates the matching item from the live catalog.")}function Mo(e,t){let n=[];for(let r of e.filter(i=>i.kind==="html"&&!$o(i.filePath,t)))n.push(...Bo(r));return n}function $o(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");return/^(?:404|500|_error|_not-found)(?:\/index)?\.html$/i.test(n)?!t.some(i=>{let s=Wt(i.route);return s?qt(n,s):!1}):!1}function Bo(e){let t=[],n=[],r=e.content.matchAll(/<!--[\s\S]*?-->|<![^>]*>|<\/?[^>]+>|[^<]+/g);for(let i of r){let s=i[0],o=i.index??0,a=n.at(-1);if(s.startsWith("<!--")||s.startsWith("<!"))continue;if(s.startsWith("</")){let d=s.slice(2,-1).trim().split(/\s+/)[0]?.toLowerCase(),u=n.map(g=>g.tag).lastIndexOf(d);u>=0&&(t.push(...Vo(e,n[u])),n.splice(u));continue}if(s.startsWith("<")){let d=s.match(/^<\s*([a-zA-Z0-9:-]+)/);if(!d)continue;let u=d[1].toLowerCase(),g=/\bdata-preview-field-path\s*=/.test(s),E=/\bdata-preview-list-path\s*=/.test(s),y=/\bdata-preview-item-path\s*=/.test(s),f=g||E||y;if(g)for(let T of n)T.ownsFieldMarker&&(T.hasNestedFieldMarker=!0);let m=s.match(/\bdata-preview-static\s*=\s*(?:"([^"]*)"|'([^']*)')/),p=!!m;p&&!(m?.[1]??m?.[2]??"").trim()&&t.push(`${e.filePath}:${j(e.content,o)} data-preview-static requires a reason.`),f&&(p||a?.staticCovered)&&t.push(`${e.filePath}:${j(e.content,o)} data-preview field/list/item markers cannot be on or inside data-preview-static. The visual editor intentionally ignores targets beneath a static ancestor.`),g&&mr.has(u)&&t.push(`${e.filePath}:${j(e.content,o)} data-preview-field-path cannot be placed on broad <${u}> content containers. Put the marker on the exact visible text, media, link, or control that the field edits.`),p&&mr.has(u)&&t.push(`${e.filePath}:${j(e.content,o)} data-preview-static cannot cover a broad <${u}> content container. Mark only the smallest genuinely non-editable element.`);let b=!!a?.hidden||Ho(s,u);f&&b&&t.push(`${e.filePath}:${j(e.content,o)} data-preview field/list/item marker is hidden. Strict visual-edit targets must remain visible and clickable in the exported page.`);let S=s.match(/\bdata-preview-field-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null,l=s.match(/\bdata-preview-item-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null;l&&a?.itemPath&&!yr(l,a.itemPath)&&t.push(`${e.filePath}:${j(e.content,o)} repeated item "${l}" is nested inside unrelated item "${a.itemPath}". One visual card must be one object-list item; do not couple parallel arrays by index.`);let h=l??a?.itemPath??null;S&&h&&/\[\d+\]/.test(S)&&!yr(S,h)&&t.push(`${e.filePath}:${j(e.content,o)} repeated field "${S}" is rendered inside item "${h}" but belongs to a different list. Model one visual card as one object-list item instead of coupling parallel arrays by index.`);let w={tag:u,ignored:!!a?.ignored||Po.has(u),hidden:b,fieldCovered:!!a?.fieldCovered||g,staticCovered:!!a?.staticCovered||p,ownsFieldMarker:g,hasNestedFieldMarker:!1,fieldPath:S,itemPath:h,shopAttributeValues:Uo(s,u),visibleTextParts:[],offset:o};if(!w.ignored&&!w.fieldCovered&&!w.staticCovered){let T=zo(e,s,u,o);t.push(...T),u==="img"&&!w.hidden&&T.length===0&&t.push(`${e.filePath}:${j(e.content,o)} rendered <img> is not covered by data-preview-field-path or data-preview-static. Bind business media to an exact image field, or mark an intentional fixed/decorative image static with a reason.`)}!wo.has(u)&&!/\/\s*>$/.test(s)&&n.push(w);continue}let c=Ht(s);if(it(c))for(let d of n)d.ownsFieldMarker&&d.visibleTextParts.push(c);a?.ignored||a?.fieldCovered||a?.staticCovered||it(c)&&t.push(`${e.filePath}:${j(e.content,o)} visible text "${st(c,72)}" is not covered by data-preview-field-path or data-preview-static.`)}return t}function yr(e,t){let n=Ee(e).trim(),r=Ee(t).trim();return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function Vo(e,t){if(!t.ownsFieldMarker||t.hasNestedFieldMarker||t.shopAttributeValues.length===0)return[];let n=Ht(t.visibleTextParts.join(" "));return!it(n)||t.shopAttributeValues.some(r=>jo(r,n))?[]:[`${e.filePath}:${j(e.content,t.offset)} data-preview-field-path="${t.fieldPath??""}" cannot cover both <${t.tag}> action/media attributes and different visible text "${st(n,72)}". Put the action/media marker on the element and the label marker on an exact nested text element.`]}function Uo(e,t){return[...e.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)].map(n=>({name:n[1].toLowerCase(),value:Ee(n[2]??n[3]??"").trim()})).filter(({name:n,value:r})=>Ar(t,n,r)).map(({value:n})=>n)}function jo(e,t){let n=r=>Ee(r).replace(/^(?:mailto:|tel:|sms:|https?:\/\/)/i,"").replace(/^www\./i,"").replace(/\/+$/g,"").replace(/\s+/g,"").toLowerCase();return n(e)===n(t)}function zo(e,t,n,r){let i=[],s=[...t.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)];for(let u of s){let g=u[1].toLowerCase(),E=Ee(u[2]??u[3]??"").trim();Ar(n,g,E)&&i.push(`${e.filePath}:${j(e.content,r)} ${n}[${g}="${st(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let o=[...t.matchAll(/\b(placeholder|alt|title|aria-label|value)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)],a=t.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i),c=(a?.[1]??a?.[2]??"").toLowerCase();for(let u of o){let g=u[1].toLowerCase(),E=Ht(u[2]??u[3]??"");!(g==="aria-label"||g==="title"||g==="alt"&&n==="img"||g==="placeholder"&&["input","textarea"].includes(n)||g==="value"&&["input","button"].includes(n)&&!["hidden","checkbox","radio"].includes(c))||!it(E)||i.push(`${e.filePath}:${j(e.content,r)} ${n}[${g}="${st(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let d=t.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i);return d&&/(?:background|background-image)\s*:[^;]*url\(/i.test(d[1]??d[2]??"")&&i.push(`${e.filePath}:${j(e.content,r)} background image is not covered by data-preview-field-path or data-preview-static.`),i}function Ho(e,t){if(/(?:^|\s)hidden(?:\s|=|\/?>)/i.test(e)||/\baria-hidden\s*=\s*(?:"true"|'true')/i.test(e))return!0;if(t==="input"){let i=e.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i);if((i?.[1]??i?.[2]??"").trim().toLowerCase()==="hidden")return!0}let n=e.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i),r=n?.[1]??n?.[2]??"";return/\bdisplay\s*:\s*none\b/i.test(r)||/\bvisibility\s*:\s*hidden\b/i.test(r)}function Wo(e,t){let n=new Set,r=new Set;for(let i of e?.sections??[])n.has(i.id)&&t.push(`editorSchema.sections contains duplicate id "${i.id}".`),r.has(i.path)&&t.push(`editorSchema.sections contains duplicate path "${i.path}".`),n.add(i.id),r.add(i.path)}function qo(e,t){for(let n of Ye(e)){let r=n.firstKind===n.duplicateKind?n.firstKind:"field/list";t.push(`editorSchema declares duplicate editable ${r} path "${n.path}" in sections "${n.firstSectionId}" and "${n.duplicateSectionId}". Each editable path must be owned by exactly one section.`)}}function Ar(e,t,n){return!n||n.startsWith("data:")||n.startsWith("blob:")||n.includes("/_next/")||n.includes("${")?!1:t==="href"?e==="a"&&!/^(?:javascript:|data:|blob:)/i.test(n):t==="src"&&["img","video","source"].includes(e)||t==="poster"&&e==="video"}function Ht(e){return Ee(e).replace(/\s+/g," ").trim()}function it(e){return e.length<=2||!new RegExp("\\p{L}","u").test(e)?!1:!/^(?:true|false|null|undefined)$/i.test(e)}function Nt(e){return e==="editable field"?"field-path":e==="editable list"?"list-path":"item-path"}function Go(e,t){return t.includes("[*]")?e.includes("[*]")&&e===t:e===t}function Ut(e,t){return K(e)===K(t)}function ot(e,t){return t.some(n=>n.includes("[*]")?K(e)===n:e===n)}function Re(e){let t=e.trim().replace(/\[\s*\$\{[^}]+\}\s*\]/g,"[*]").replace(/\[\s+/g,"[").replace(/\s+\]/g,"]");return To.test(t)?t:null}function K(e){return e.replace(/\[\d+\]/g,"[*]")}function X(e,t){return e?`${e}.${t}`:t}function Wt(e){if(!e)return null;let t=e.trim();return!t.startsWith("/")||t.includes("?")||t.includes("#")||t.includes("\\")||t.includes("..")?null:t==="/"?t:t.replace(/\/+$/,"")}function _r(e){return e==="home"?"/":`/${e}`}function qt(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");if(t==="/")return n==="index.html";let r=t.replace(/^\/+/,"");return n===`${r}.html`||n===`${r}/index.html`}function Q(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ee(e){return e.replace(/&quot;/gi,'"').replace(/&#39;|&#x27;/gi,"'").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&nbsp;/gi," ")}function vr(e){return e.line}function j(e,t){let n=1;for(let r=0;r<t;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function G(e){return[...new Set(e)].sort()}function st(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}\u2026`}function Fr(e){let t=e.filter((n,r)=>n.required===!0||r===0).map(n=>n.id);return t.length>0?t:e.slice(0,1).map(n=>n.id)}function kr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ko(e,t,n){let r=e.trim().split(/[?#]/,1)[0];return r==="/"||r===""?n?"/":`/${t}`:/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith("//")?n?"/":`/${t}`:`/${r.replace(/^\/+|\/+$/g,"")}`}function Rr(e,t=[]){let r=(kr(e)&&Array.isArray(e.pages)?e.pages:[]).flatMap((s,o)=>{if(!kr(s)||typeof s.id!="string"||!s.id.trim())return[];let a=s.id.trim(),c=typeof s.label=="string"&&s.label.trim()?s.label.trim():a.replace(/_/g," ");return[{id:a,label:c,route:Ko(typeof s.route=="string"?s.route:"",a,o===0)}]});return r.length>0?r:t.map(s=>s.trim()).filter(Boolean).map((s,o)=>({id:s,label:s.replace(/_/g," "),route:o===0?"/":`/${s}`}))}function Dr(e){let t=new Set(e.selectedPages),n=e.pageDefinitions.filter(i=>!t.has(i.id)),r=[];for(let i of e.html.matchAll(/<[a-z][^>]*\b(?:href|formaction|data-href|data-route|data-url)\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>/gi)){let s=i[1]??i[2]??"";if(!s.trim()||s.trim().startsWith("#")||/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(s.trim()))continue;let o=s.split(/[?#]/,1)[0],a=e.basePath?.replace(/\/+$/g,"")||"",d=`/${(a&&(o===a||o.startsWith(`${a}/`))?o.slice(a.length)||"/":o).replace(/\/index\.html$/i,"/").replace(/\.html$/i,"").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"")}`,u=d==="/"?"/":d,g=n.find(E=>{let y=E.route==="/"?"/":`/${E.route.replace(/^\/+|\/+$/g,"")}`;return y==="/"?u==="/":u===y||u.startsWith(`${y}/`)});g&&r.push({pageId:g.id,route:g.route,href:o})}return r}var pt=Et(ti());function ni(e){let t=[],n=new Set;for(let s of e.artifacts)if(s.kind==="html")for(let o of(0,pt.collectStyleTargetsFromHtml)(s.content))n.add(o);let i=(e.siteData&&typeof e.siteData=="object"&&!Array.isArray(e.siteData)?e.siteData:null)?.styles;return t.push(...(0,pt.validateStyleTree)(i,n.size>0?n:void 0)),t}var _e="deneb-template-validator",yt="1.0.0",mt="fivora-template.json",Is=2500,Cs=12*1024*1024,di="/template-validation",xs={NODE_ENV:"development",NPM_CONFIG_PRODUCTION:"false",npm_config_production:"false",NPM_CONFIG_INCLUDE:"dev",npm_config_include:"dev",NPM_CONFIG_OMIT:"",NPM_CONFIG_omit:"",NPM_CONFIG_IGNORE_SCRIPTS:"true",npm_config_ignore_scripts:"true",PNPM_CONFIG_IGNORE_SCRIPTS:"true",YARN_IGNORE_SCRIPTS:"true",YARN_PRODUCTION:"false"},rn=class{constructor(t,n){this.options=t;this.report={validator:_e,version:yt,command:t.command,input:(0,v.resolve)(t.inputPath),status:"passed",startedAt:n.toISOString(),durationMs:0,steps:[],warnings:[]}}options;report;async step(t,n,r){let i=Date.now();this.options.json||process.stdout.write(`\u2192 ${t}
4
4
  `);try{let s=await n();return this.report.steps.push({name:t,status:"passed",durationMs:Date.now()-i,...r?{detail:r}:{}}),this.options.json||process.stdout.write(` \u2713 ${t}
5
5
  `),s}catch(s){throw this.report.steps.push({name:t,status:"failed",durationMs:Date.now()-i,detail:Me(s)}),s}}skip(t,n){this.report.steps.push({name:t,status:"skipped",durationMs:0,detail:n}),this.warn(n)}warn(t){this.report.warnings.includes(t)||this.report.warnings.push(t),this.options.json||process.stdout.write(` ! ${t}
6
6
  `)}finish(t,n){this.report.durationMs=Date.now()-t.getTime(),n&&(this.report.status="failed",this.report.error=Me(n))}print(){if(this.options.json){process.stdout.write(`${JSON.stringify(this.report,null,2)}
@@ -19,7 +19,7 @@ Run "${_e} --help" for usage.
19
19
  ${u}${g}
20
20
 
21
21
  Please downgrade, remove, or replace these dependencies to versions compatible with Node 20.`)}}async function vs(e,t){let n=(0,v.join)(e,"package.json"),r;try{r=JSON.parse(await(0,_.readFile)(n,"utf8"))}catch{return}let i=Object.keys(r.dependencies||{}),s=[{name:"@react-three/drei",pattern:/@react-three\/drei/},{name:"@react-three/fiber",pattern:/@react-three\/fiber/},{name:"three",pattern:/(?:from\s+['"]three(?:\/[^'"]*)?['"]|require\(['"]three)/},{name:"framer-motion",pattern:/framer-motion/},{name:"pixi.js",pattern:/pixi\.js/},{name:"babylonjs",pattern:/babylonjs/}],o=await ht(e,/\.(tsx?|jsx?|mjs|cjs)$/i),c=(await Promise.all(o.map(d=>(0,_.readFile)(d,"utf8").catch(()=>"")))).join(`
22
- `);if(c.includes("next/font/google"))throw new Error('Template package contains "next/font/google" imports (e.g. in layout.tsx). In Fivora preview sandboxes and offline builds, next/font/google causes build failures (ETIMEDOUT) because external Google Fonts cannot be fetched at compile time. Replace next/font/google with DENEB self-hosted fonts by running "deneb fonts install .".');for(let d of s)i.includes(d.name)&&!d.pattern.test(c)&&t.warn(`Unused dependency detected: "${d.name}" is declared in package.json dependencies but is never imported in any source file. Removing unused dependencies prevents platform engine conflicts and significantly speeds up live preview warm-up.`)}async function ks(e,t,n,r,i,s){if(i.skipBuild){s.skip("Simulate interactive preview warm-up","Skipped by --skip-build.");return}await(0,_.writeFile)(r,n,"utf8");let o=t.outputDirectory?.trim()||"out";await pi(e,o);let a="/uploads/generated-sites/template-preview/simulation",c={NODE_ENV:"production",...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:a}:{NEXT_PUBLIC_SITE_BASE_PATH:a},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:`https://fivora.com${a}/`}:{}},d=t.buildCommand?.trim()||"npm run build";await an(d,e,c,i.json);let u=Se(e,o);await(0,_.access)(u).catch(()=>{throw new Error(`Interactive preview build did not produce output directory "${o}".`)});let g=await ht(u,/\.html$/i);if(g.length===0)throw new Error(`Interactive preview build produced no HTML files in output directory "${o}".`);for(let E of g.slice(0,10)){let y=await(0,_.readFile)(E,"utf8");if(!y.includes("<!DOCTYPE")&&!y.includes("<html"))throw new Error(`Generated preview HTML "${(0,v.relative)(e,E)}" is malformed.`)}}async function ii(e,t,n){let r=await n.step("Validate manifest",()=>Fs(e));if(r.version<2)throw new Error('New template package uploads require fivora-template.json version 2 with visualEditing.contractVersion 1 and visualEditing.mode "strict".');await n.step("Check required package files",async()=>{await(0,_.access)((0,v.join)(e,"package.json")).catch(()=>{throw new Error("Template package must contain package.json at ZIP root.")})});let{contentDefaults:i,originalSiteData:s,siteDataPath:o}=await n.step("Validate site data",()=>Rs(e,r)),a=Ds(r,i),c=Fr(r.pages??[]);try{if(await n.step("Check platform runtime compatibility",async()=>{await _s(e,n)}),await n.step("Audit package dependencies",async()=>{await vs(e,n)}),t.skipInstall)n.skip("Install dependencies","Dependency installation was skipped by --skip-install.");else{let y=r.installCommand?.trim()||"npm install";await n.step("Install dependencies",()=>an(y,e,xs,t.json))}let d=br(i,a);await si(o,d,c),await oi(e,r,t,n,"Build probe-content fixture");let u=await ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate probe-content contract",()=>{let y=Tr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:d,editorSchema:a,artifacts:u}),f=Rr({pages:r.pages},r.pages?.map(p=>p.id)??[]),m=new Set(y.markers.filter(p=>p.kind==="page"&&p.artifactKind==="html"&&c.includes(p.value)).map(p=>p.filePath));y.errors.push(...new Set(u.filter(p=>p.kind==="html"&&m.has(p.filePath)).flatMap(p=>Dr({html:p.content,pageDefinitions:f,selectedPages:c,basePath:di}).map(b=>`${p.filePath} still renders href="${b.href}" for unselected page "${b.pageId}". Filter every header, hero, body, card, and footer link with requirements.requiredPages.`))));for(let p of y.warnings)n.warn(p);nn("Template visual-editing contract validation failed.",y.errors)}),await n.step("Validate real-time style contract",()=>{let y=ni({siteData:d,artifacts:u});nn("Template real-time style validation failed.",y.map(f=>`${f.path}: ${f.message}`))});let g=jt(i,a);await si(o,g),await oi(e,r,t,n,"Build empty-state fixture");let E=await ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate empty-state contract",()=>{let y=wr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:i,editorSchema:a,artifacts:E});for(let f of y.warnings)n.warn(f);nn("Template strict empty-state visual-editing validation failed.",y.errors)}),await n.step("Simulate interactive preview warm-up",async()=>{await ks(e,r,s,o,t,n)})}finally{await(0,_.writeFile)(o,s,"utf8").catch(()=>{})}}async function oi(e,t,n,r,i){if(n.skipBuild){r.skip(i,`${i} was skipped by --skip-build.`);let s=Se(e,t.outputDirectory?.trim()||"out");await(0,_.access)(s).catch(()=>{throw new Error(`Cannot use --skip-build because output directory "${t.outputDirectory?.trim()||"out"}" does not exist.`)});return}await r.step(i,async()=>{let s=t.outputDirectory?.trim()||"out";await pi(e,s);let o={...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:di}:{},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:"https://template-validation.example.invalid"}:{},NODE_ENV:"production"};await an(t.buildCommand?.trim()||"npm run build",e,o,n.json),await(0,_.access)(Se(e,s)).catch(()=>{throw new Error(`Template build completed, but output directory "${s}" was not created.`)})})}async function Fs(e){let t=(0,v.join)(e,mt),n;try{n=JSON.parse(await(0,_.readFile)(t,"utf8"))}catch(r){throw new Error(`${mt} is missing from the package root or is not valid JSON: ${Me(r)}`)}return dr(n)}async function Rs(e,t){let n=Se(e,t.siteDataFile),r,i;try{r=await(0,_.readFile)(n,"utf8"),i=JSON.parse(r)}catch(a){throw new Error(`Template site data file "${t.siteDataFile}" is missing or is not valid JSON: ${Me(a)}`)}if(!i.content||typeof i.content!="object"||Array.isArray(i.content))throw new Error(`Template site data file "${t.siteDataFile}" must contain a JSON object at "content".`);let s=structuredClone(i.content),o=typeof i.shop?.logoUrl=="string"?i.shop.logoUrl.trim():"";if(o){let a=s.common&&typeof s.common=="object"&&!Array.isArray(s.common)?s.common:{};s.common={...a,logoUrl:typeof a.logoUrl=="string"&&a.logoUrl.trim()?a.logoUrl:o}}return{contentDefaults:s,originalSiteData:r,siteDataPath:n}}function Ds(e,t){return Jn(At(e.editorSchema??null,Yn(t,e.pages??[])))}async function si(e,t,n=[]){await(0,_.mkdir)((0,v.dirname)(e),{recursive:!0}),await(0,_.writeFile)(e,JSON.stringify(jn(t,n),null,2),"utf8")}async function fi(e,t){if(!(await(0,_.stat)(e).catch(()=>null))?.isDirectory())throw new Error(`Template source directory does not exist: ${e}`);let r=new sn.default,i=0,s=0,o=0,a=async c=>{let d=await(0,_.readdir)(c,{withFileTypes:!0});d.sort((u,g)=>u.name.localeCompare(g.name));for(let u of d){let g=(0,v.join)(c,u.name),E=(0,v.relative)(e,g).split(v.sep).join("/");if(He(E)){o+=1;continue}let y=await(0,_.lstat)(g);if(y.isSymbolicLink())throw new Error(`Template source contains a symbolic link that cannot be packaged safely: ${E}`);if(y.isDirectory()){await a(g);continue}if(!y.isFile())continue;let f=await(0,_.readFile)(g);r.addFile(E,f),i+=1,s+=f.byteLength}};if(await a(e),i===0)throw new Error("Template source directory is empty.");return await(0,_.mkdir)((0,v.dirname)(t),{recursive:!0}),await(0,_.writeFile)(t,r.toBuffer()),{bytes:s,files:i,excluded:o}}async function on(e,t){return gt(e),await(0,_.mkdir)(t,{recursive:!0}),new sn.default(e).extractAllTo(t,!0),t}function gt(e){let t=Hn(e);if(t.forbiddenEntries.length>0)throw new Error(Wn(t.forbiddenEntries));if(!t.entries.includes(mt))throw new Error(`${mt} must be at the ZIP root. Do not wrap the template in an extra parent directory.`)}async function ai(e,t){let n=Se(e,t),[r,i]=await Promise.all([ht(e,/\.(?:[cm]?[jt]sx?|html?)$/i,n),ht(n,/\.html?$/i)]),s=[],o=0;for(let a of r.slice(0,Is)){let c=await(0,_.readFile)(a,"utf8");if(o+=Buffer.byteLength(c),o>Cs)break;s.push({filePath:`source/${(0,v.relative)(e,a).split(v.sep).join("/")}`,kind:"source",content:c})}for(let a of i)s.push({filePath:(0,v.relative)(n,a).split(v.sep).join("/"),kind:"html",content:await(0,_.readFile)(a,"utf8")});return s}async function ht(e,t,n){let r=new Set([".git",".next",".turbo","build","coverage","dist","node_modules"]),i=[],s=async o=>{if(n&&(0,v.resolve)(o)===(0,v.resolve)(n))return;let a=await(0,_.readdir)(o,{withFileTypes:!0});for(let c of a){let d=(0,v.join)(o,c.name);c.isDirectory()?r.has(c.name.toLowerCase())||await s(d):c.isFile()&&t.test(c.name)&&i.push(d)}};return await s(e),i.sort()}async function pi(e,t){let n=Se(e,t);n!==(0,v.resolve)(e)&&await(0,_.rm)(n,{recursive:!0,force:!0});for(let r of[".next",".turbo"])await(0,_.rm)(Se(e,r),{recursive:!0,force:!0})}async function an(e,t,n,r){e.trim()&&await new Promise((i,s)=>{let o=(0,li.spawn)(e,{cwd:t,env:{...process.env,...n},shell:!0,stdio:["ignore","pipe","pipe"]}),a="",c=(d,u)=>{let g=d.toString();a=`${a}${g}`.slice(-64*1024),r||u.write(d)};o.stdout?.on("data",d=>c(d,process.stdout)),o.stderr?.on("data",d=>c(d,process.stderr)),o.on("error",s),o.on("close",(d,u)=>{if(d===0){i();return}let g=Ms(a);s(new Error([`Command failed: ${e}`,u?`Process stopped by signal ${u}.`:`Exit code: ${d??"unknown"}.`,...g?[g]:[]].join(`
22
+ `);if(c.includes("next/font/google"))throw new Error('Template package contains "next/font/google" imports (e.g. in layout.tsx). In Fivora preview sandboxes and offline builds, next/font/google causes build failures (ETIMEDOUT) because external Google Fonts cannot be fetched at compile time. Replace next/font/google with DENEB self-hosted fonts by running "deneb fonts install .".');for(let d of s)i.includes(d.name)&&!d.pattern.test(c)&&t.warn(`Unused dependency detected: "${d.name}" is declared in package.json dependencies but is never imported in any source file. Removing unused dependencies prevents platform engine conflicts and significantly speeds up live preview warm-up.`)}async function ks(e,t,n,r,i,s){if(i.skipBuild){s.skip("Simulate interactive preview warm-up","Skipped by --skip-build.");return}await(0,_.writeFile)(r,n,"utf8");let o=t.outputDirectory?.trim()||"out";await pi(e,o);let a="/uploads/generated-sites/template-preview/simulation",c={NODE_ENV:"production",...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:a}:{NEXT_PUBLIC_SITE_BASE_PATH:a},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:`https://fivora.com${a}/`}:{}},d=t.buildCommand?.trim()||"npm run build";await an(d,e,c,i.json);let u=Se(e,o);await(0,_.access)(u).catch(()=>{throw new Error(`Interactive preview build did not produce output directory "${o}".`)});let g=await ht(u,/\.html$/i);if(g.length===0)throw new Error(`Interactive preview build produced no HTML files in output directory "${o}".`);for(let E of g.slice(0,10)){let y=await(0,_.readFile)(E,"utf8");if(!y.includes("<!DOCTYPE")&&!y.includes("<html"))throw new Error(`Generated preview HTML "${(0,v.relative)(e,E)}" is malformed.`)}}async function ii(e,t,n){let r=await n.step("Validate manifest",()=>Fs(e));if(r.version<2)throw new Error('New template package uploads require fivora-template.json version 2 with visualEditing.contractVersion 1 and visualEditing.mode "strict".');await n.step("Check required package files",async()=>{await(0,_.access)((0,v.join)(e,"package.json")).catch(()=>{throw new Error("Template package must contain package.json at ZIP root.")})});let{contentDefaults:i,originalSiteData:s,siteDataPath:o}=await n.step("Validate site data",()=>Rs(e,r)),a=Ds(r,i),c=Fr(r.pages??[]);try{if(await n.step("Check platform runtime compatibility",async()=>{await _s(e,n)}),await n.step("Audit package dependencies",async()=>{await vs(e,n)}),t.skipInstall)n.skip("Install dependencies","Dependency installation was skipped by --skip-install.");else{let y=r.installCommand?.trim()||"npm install";await n.step("Install dependencies",()=>an(y,e,xs,t.json))}let d=br(i,a);await si(o,d,c),await oi(e,r,t,n,"Build probe-content fixture");let u=await ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate probe-content contract",()=>{let y=Tr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:d,editorSchema:a,artifacts:u}),f=Rr({pages:r.pages},r.pages?.map(p=>p.id)??[]),m=new Set(y.markers.filter(p=>p.kind==="page"&&p.artifactKind==="html"&&c.includes(p.value)).map(p=>p.filePath));y.errors.push(...new Set(u.filter(p=>p.kind==="html"&&m.has(p.filePath)).flatMap(p=>Dr({html:p.content,pageDefinitions:f,selectedPages:c,basePath:di}).map(b=>`${p.filePath} still renders href="${b.href}" for unselected page "${b.pageId}". Filter every header, hero, body, card, and footer link with requirements.requiredPages.`))));for(let p of y.warnings)n.warn(p);nn("Template visual-editing contract validation failed.",y.errors)}),await n.step("Validate real-time style contract",()=>{let y=ni({siteData:d,artifacts:u});nn("Template real-time style validation failed.",y.map(f=>`${f.path}: ${f.message}`))});let g=jt(i,a);await si(o,g),await oi(e,r,t,n,"Build empty-state fixture");let E=await ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate empty-state contract",()=>{let y=wr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:i,editorSchema:a,artifacts:E});for(let f of y.warnings)n.warn(f);nn("Template strict empty-state visual-editing validation failed.",y.errors)}),await n.step("Simulate interactive preview warm-up",async()=>{await ks(e,r,s,o,t,n)})}finally{await(0,_.writeFile)(o,s,"utf8").catch(()=>{})}}async function oi(e,t,n,r,i){if(n.skipBuild){r.skip(i,`${i} was skipped by --skip-build.`);let s=Se(e,t.outputDirectory?.trim()||"out");await(0,_.access)(s).catch(()=>{throw new Error(`Cannot use --skip-build because output directory "${t.outputDirectory?.trim()||"out"}" does not exist.`)});return}await r.step(i,async()=>{let s=t.outputDirectory?.trim()||"out";await pi(e,s);let o={...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:di}:{},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:"https://template-validation.example.invalid"}:{},NODE_ENV:"production"};await an(t.buildCommand?.trim()||"npm run build",e,o,n.json),await(0,_.access)(Se(e,s)).catch(()=>{throw new Error(`Template build completed, but output directory "${s}" was not created.`)})})}async function Fs(e){let t=(0,v.join)(e,mt),n;try{n=JSON.parse(await(0,_.readFile)(t,"utf8"))}catch(r){throw new Error(`${mt} is missing from the package root or is not valid JSON: ${Me(r)}`)}return dr(n)}async function Rs(e,t){let n=Se(e,t.siteDataFile),r,i;try{r=await(0,_.readFile)(n,"utf8"),i=JSON.parse(r)}catch(a){throw new Error(`Template site data file "${t.siteDataFile}" is missing or is not valid JSON: ${Me(a)}`)}if(!i.content||typeof i.content!="object"||Array.isArray(i.content))throw new Error(`Template site data file "${t.siteDataFile}" must contain a JSON object at "content".`);let s=structuredClone(i.content),o=typeof i.shop?.logoUrl=="string"?i.shop.logoUrl.trim():"";if(o){let a=s.common&&typeof s.common=="object"&&!Array.isArray(s.common)?s.common:{};s.common={...a,logoUrl:typeof a.logoUrl=="string"&&a.logoUrl.trim()?a.logoUrl:o}}return{contentDefaults:s,originalSiteData:r,siteDataPath:n}}function Ds(e,t){return Jn(At(e.editorSchema??null,Yn(t,e.pages??[])))}async function si(e,t,n=[]){await(0,_.mkdir)((0,v.dirname)(e),{recursive:!0}),await(0,_.writeFile)(e,JSON.stringify(jn(t,n),null,2),"utf8")}async function fi(e,t){if(!(await(0,_.stat)(e).catch(()=>null))?.isDirectory())throw new Error(`Template source directory does not exist: ${e}`);let r=new sn.default,i=0,s=0,o=0,a=async c=>{let d=await(0,_.readdir)(c,{withFileTypes:!0});d.sort((u,g)=>u.name.localeCompare(g.name));for(let u of d){let g=(0,v.join)(c,u.name),E=(0,v.relative)(e,g).split(v.sep).join("/");if(He(E)){o+=1;continue}let y=await(0,_.lstat)(g);if(y.isSymbolicLink())throw new Error(`Template source contains a symbolic link that cannot be packaged safely: ${E}`);if(y.isDirectory()){await a(g);continue}if(!y.isFile())continue;let f=await(0,_.readFile)(g);r.addFile(E,f),i+=1,s+=f.byteLength}};if(await a(e),i===0)throw new Error("Template source directory is empty.");return await(0,_.mkdir)((0,v.dirname)(t),{recursive:!0}),await(0,_.writeFile)(t,r.toBuffer()),{bytes:s,files:i,excluded:o}}async function on(e,t){return gt(e),await(0,_.mkdir)(t,{recursive:!0}),new sn.default(e).extractAllTo(t,!0),t}function gt(e){let t=Hn(e);if(t.forbiddenEntries.length>0)throw new Error(Wn(t.forbiddenEntries));if(!t.entries.includes(mt))throw new Error(`${mt} must be at the ZIP root. Do not wrap the template in an extra parent directory.`)}async function ai(e,t){let n=Se(e,t),[r,i]=await Promise.all([ht(e,/\.(?:[cm]?[jt]sx?|html?)$/i,n),ht(n,/\.html?$/i)]),s=[],o=0;for(let a of r.slice(0,Is)){let c=await(0,_.readFile)(a,"utf8");if(o+=Buffer.byteLength(c),o>Cs)break;s.push({filePath:`source/${(0,v.relative)(e,a).split(v.sep).join("/")}`,kind:"source",content:c})}for(let a of i)s.push({filePath:(0,v.relative)(n,a).split(v.sep).join("/"),kind:"html",content:await(0,_.readFile)(a,"utf8")});return s}async function ht(e,t,n){let r=new Set([".git",".next",".turbo","build","coverage","dist","node_modules"]),i=[],s=async o=>{if(n&&(0,v.resolve)(o)===(0,v.resolve)(n))return;let a=await(0,_.readdir)(o,{withFileTypes:!0});for(let c of a){let d=(0,v.join)(o,c.name);c.isDirectory()?(r.has(c.name.toLowerCase())||c.name.startsWith(".deneb"))||await s(d):c.isFile()&&t.test(c.name)&&i.push(d)}};return await s(e),i.sort()}async function pi(e,t){let n=Se(e,t);n!==(0,v.resolve)(e)&&await(0,_.rm)(n,{recursive:!0,force:!0});for(let r of[".next",".turbo"])await(0,_.rm)(Se(e,r),{recursive:!0,force:!0})}async function an(e,t,n,r){e.trim()&&await new Promise((i,s)=>{let o=(0,li.spawn)(e,{cwd:t,env:{...process.env,...n},shell:!0,stdio:["ignore","pipe","pipe"]}),a="",c=(d,u)=>{let g=d.toString();a=`${a}${g}`.slice(-64*1024),r||u.write(d)};o.stdout?.on("data",d=>c(d,process.stdout)),o.stderr?.on("data",d=>c(d,process.stderr)),o.on("error",s),o.on("close",(d,u)=>{if(d===0){i();return}let g=Ms(a);s(new Error([`Command failed: ${e}`,u?`Process stopped by signal ${u}.`:`Exit code: ${d??"unknown"}.`,...g?[g]:[]].join(`
23
23
  `)))})})}function nn(e,t){if(t.length===0)return;let n=t.slice(0,36),r=t.length-n.length;throw new Error([e,...n.map(i=>`- ${i}`),...r>0?[`- ${r} additional contract errors were omitted.`]:[]].join(`
24
24
  `))}function Se(e,t){let n=(0,v.resolve)(e),r=(0,v.resolve)(e,t),i=`${n}${v.sep}`;if(r!==n&&!r.startsWith(i))throw new Error("Template path resolves outside the workspace.");return r}async function mi(e,t){if((0,v.extname)(e).toLowerCase()!==".zip")throw new Error(`Package output must use the .zip extension: ${e}`);let n=await(0,_.stat)(e).catch(()=>null);if(n&&!t)throw new Error(`Output already exists: ${e}. Use --force to replace it after validation passes.`);if(n?.isDirectory())throw new Error(`Output path is a directory: ${e}`)}async function Ls(e,t,n){let r=(0,v.dirname)(t),i=(0,v.join)(r,`.${(0,v.basename)(t)}.${process.pid}-${Date.now()}.tmp`);await(0,_.mkdir)(r,{recursive:!0});try{await(0,_.copyFile)(e,i),await mi(t,n),n&&await(0,_.rm)(t,{force:!0}),await(0,_.rename)(i,t)}finally{await(0,_.rm)(i,{force:!0}).catch(()=>{})}}function Ns(e){if(e.includes("--help")||e.includes("-h"))return Os(),null;if(e.includes("--version")||e.includes("-v"))return process.stdout.write(`${yt}
25
25
  `),null;let t=[...e],r=t[0]==="validate"||t[0]==="package"?t.shift():"validate",i="",s,o=!1,a=!1,c=!1,d=!1;for(let u=0;u<t.length;u+=1){let g=t[u];if(g==="--json")o=!0;else if(g==="--force")a=!0;else if(g==="--skip-build")c=!0;else if(g==="--skip-install")d=!0;else if(g==="--output"||g==="-o"){if(s=t[u+1],u+=1,!s)throw new Error(`${g} requires a file path.`)}else if(g.startsWith("--output="))s=g.slice(9);else{if(g.startsWith("-"))throw new Error(`Unknown option: ${g}`);if(!i)i=g;else throw new Error(`Unexpected argument: ${g}`)}}if(!i)throw new Error(`Template path is required. Run "${_e} --help" for usage.`);if(r==="package"&&(c||d))throw new Error("The package command cannot use --skip-build or --skip-install because the final ZIP must pass full validation.");if(r==="validate"&&s)throw new Error("--output is only valid with the package command.");return{command:r,inputPath:i,outputPath:s,json:o,force:a,skipBuild:c,skipInstall:d}}function Os(){process.stdout.write(`Fivora Template Preflight Validator v${yt}