@deneb-ui/cli 2.0.110 → 2.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/cli",
3
- "version": "2.0.110",
3
+ "version": "2.0.112",
4
4
  "description": "Official DENEB CLI — scaffold, convert, validate, and package Fivora-ready storefront templates.",
5
5
  "bin": {
6
6
  "deneb": "bin/index.js",
@@ -49,7 +49,7 @@
49
49
  "license": "MIT",
50
50
  "dependencies": {
51
51
  "@babel/parser": "^7.28.0",
52
- "@deneb-ui/core": "^2.0.110",
52
+ "@deneb-ui/core": "^2.0.112",
53
53
  "@octokit/rest": "^22.0.1",
54
54
  "adm-zip": "^0.6.0",
55
55
  "dotenv": "^17.4.2",
@@ -613,7 +613,7 @@ export function findDoubleBasePathNextRouterCalls(source: string) {
613
613
  .map((match) => stripNonCode(match[1]))
614
614
  .join(' ');
615
615
  const codeOnly = stripNonCode(expression);
616
- return /\b(?:[A-Za-z_$][\w$]*\s*\.\s*)*[A-Za-z_$][\w$]*(?:base_?path|path_?base)[\w$]*\b/i.test(
616
+ return /\b(?:[A-Za-z_$][\w$]*\s*\.\s*)*(?:[A-Za-z_$][\w$]*(?:base_?path|path_?base)[\w$]*|platformProductDetailHref)\b/i.test(
617
617
  `${codeOnly} ${templateExpressions}`,
618
618
  );
619
619
  };
@@ -1,34 +1,34 @@
1
1
  #!/usr/bin/env node
2
- var Mi=Object.create;var We=Object.defineProperty;var Bi=Object.getOwnPropertyDescriptor;var ji=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var F=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},zi=(e,t)=>{for(var n in t)We(e,n,{get:t[n],enumerable:!0})},bn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ji(t))!Ui.call(e,i)&&i!==n&&We(e,i,{get:()=>t[i],enumerable:!(r=Bi(t,i))||r.enumerable});return e};var Ct=(e,t,n)=>(n=e!=null?Mi(Vi(e)):{},bn(t||!e||!e.__esModule?We(n,"default",{value:e,enumerable:!0}):n,e)),Hi=e=>bn(We({},"__esModule",{value:!0}),e);var _t=F((ha,Sn)=>{Sn.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 Ge=F(wn=>{var Tn={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 qi(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(Tn))wn[e]=qi(Tn[e])});var _n=F((Ea,Cn)=>{var Wi=require("fs"),j=require("path"),Pn=_t(),Gi=Ge(),Zi=typeof process=="object"&&process.platform==="win32",In=e=>typeof e=="object"&&e!==null,xn=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 $(e){this.sep=j.sep,this.fs=Wi,In(e)&&In(e.fs)&&typeof e.fs.statSync=="function"&&(this.fs=e.fs)}Cn.exports=$;$.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(l){if(l.message&&l.message.startsWith("ENOENT"))t.fs.mkdirSync(i);else throw l}if(o&&o.isFile())throw Gi.FILE_IN_THE_WAY(`"${i}"`)}})}n(e)};$.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=j.dirname(e);i.fs.existsSync(o)||i.makeDir(o);var l;try{l=i.fs.openSync(e,"w",438)}catch{i.fs.chmodSync(e,438),l=i.fs.openSync(e,"w",438)}if(l)try{i.fs.writeSync(l,t,0,t.length,0)}finally{i.fs.closeSync(l)}return i.fs.chmodSync(e,r||438),!0};$.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(l,c){if(o&&c&&c.isDirectory())return i(!1);var u=j.dirname(e);s.fs.exists(u,function(f){if(!f)try{s.makeDir(u)}catch{return i(!1)}let g=function(E){s.fs.write(E,t,0,t.length,0,function(S){s.fs.close(E,function(){if(S)return i(!1);s.fs.chmod(e,r||438,function(){i(!0)})})})};s.fs.open(e,"w",438,function(E,S){E?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(m,d){if(m||!d)return i(!1);g(d)})}):S?g(S):i(!1)})})})})};$.prototype.findFiles=function(e){let t=this;function n(r,i,s,o){typeof i=="boolean"&&(s=i,i=void 0);let l=[];return t.fs.readdirSync(r).forEach(function(c){let u=j.join(r,c),f=t.fs.statSync(u);if((!i||i.test(u))&&l.push(j.normalize(u)+(f.isDirectory()?t.sep:"")),f.isDirectory()&&s){let g=t.fs.realpathSync(u);o.has(g)||(o.add(g),l=l.concat(n(u,i,s,o)))}}),l}return n(e,void 0,!0,new Set([t.fs.realpathSync(e)]))};$.prototype.findFilesAsync=function(e,t){let n=this,r=[],i=!1,s=function(l){i||(i=!0,t(l,l?void 0:r))},o=function(l,c,u){n.fs.readdir(l,function(f,g){if(f)return u(f);let E=g.length;if(!E)return u();g.forEach(function(S){let m=j.join(l,S);n.fs.stat(m,function(d,p){if(d)return u(d);if(!p){--E||u();return}if(r.push(j.normalize(m)+(p.isDirectory()?n.sep:"")),!p.isDirectory()){--E||u();return}n.fs.realpath(m,function(h,b){if(h)return u(h);if(c.has(b)){--E||u();return}c.add(b),o(m,c,function(a){if(a)return u(a);--E||u()})})})})})};n.fs.realpath(e,function(l,c){if(l)return s(l);o(e,new Set([c]),s)})};$.prototype.getAttributes=function(){};$.prototype.setAttributes=function(){};$.crc32update=function(e,t){return xn[(e^t)&255]^e>>>8};$.crc32=function(e){typeof e=="string"&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=$.crc32update(n,e[r++]);return~n>>>0};$.methodToString=function(e){switch(e){case Pn.STORED:return"STORED ("+e+")";case Pn.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}};$.canonical=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.join(".",t)};$.zipnamefix=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.posix.join(".",t)};$.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]};$.sanitize=function(e,t){e=j.resolve(j.normalize(e));for(var n=t.split("/"),r=0,i=n.length;r<i;r++){var s=j.normalize(j.join(e,n.slice(r,i).join(j.sep)));if(s===e||s.startsWith(e+j.sep))return s}return j.normalize(j.join(e,j.basename(t)))};$.toBuffer=function(t,n){return Buffer.isBuffer(t)?t:t instanceof Uint8Array?Buffer.from(t):typeof t=="string"?n(t):Buffer.alloc(0)};$.readBigUInt64LE=function(e,t){let n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n};$.writeBigUInt64LE=function(e,t,n){let r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)};$.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)};$.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};$.isWin=Zi;$.crcTable=xn});var kn=F((ba,An)=>{var Ki=require("path");An.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=Ki.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 Fn=F((Sa,vn)=>{vn.exports={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")}});var Ie=F((Ta,Pe)=>{Pe.exports=_n();Pe.exports.Constants=_t();Pe.exports.Errors=Ge();Pe.exports.FileAttr=kn();Pe.exports.decoder=Fn()});var Dn=F((wa,Rn)=>{var ue=Ie(),I=ue.Constants;Rn.exports=function(){var e=20,t=10,n=0,r=0,i=0,s=0,o=0,l=0,c=0,u=0,f=0,g=0,E=0,S=0,m=0;e|=ue.isWin?2560:768,n|=I.FLG_EFS;let d={extraLen:0},p=a=>Math.max(0,a)>>>0,h=a=>Math.max(0,a)&65535,b=a=>Math.max(0,a)&255;return i=ue.fromDate2DOS(new Date),{get made(){return e},set made(a){e=a},get version(){return t},set version(a){t=a},get flags(){return n},set flags(a){n=a},get flags_efs(){return(n&I.FLG_EFS)>0},set flags_efs(a){a?n|=I.FLG_EFS:n&=~I.FLG_EFS},get flags_desc(){return(n&I.FLG_DESC)>0},set flags_desc(a){a?n|=I.FLG_DESC:n&=~I.FLG_DESC},get method(){return r},set method(a){switch(a){case I.STORED:this.version=10;break;case I.DEFLATED:default:this.version=20}r=a},get time(){return ue.fromDOS2Date(this.timeval)},set time(a){a=new Date(a),this.timeval=ue.fromDate2DOS(a)},get timeval(){return i},set timeval(a){i=p(a)},get timeHighByte(){return b(i>>>8)},get crc(){return s},set crc(a){s=p(a)},get compressedSize(){return o},set compressedSize(a){o=p(a)},get size(){return l},set size(a){l=p(a)},get fileNameLength(){return c},set fileNameLength(a){c=a},get extraLength(){return u},set extraLength(a){u=a},get extraLocalLength(){return d.extraLen},set extraLocalLength(a){d.extraLen=a},get commentLength(){return f},set commentLength(a){f=a},get diskNumStart(){return g},set diskNumStart(a){g=p(a)},get inAttr(){return E},set inAttr(a){E=p(a)},get attr(){return S},set attr(a){S=p(a)},get fileAttr(){return(S||0)>>16&4095},get offset(){return m},set offset(a){m=p(a)},get encrypted(){return(n&I.FLG_ENC)===I.FLG_ENC},get centralHeaderSize(){return I.CENHDR+c+u+f},get realDataOffset(){return m+I.LOCHDR+d.fnameLen+d.extraLen},get localHeader(){return d},loadLocalHeaderFromBinary:function(a){var y=a.slice(m,m+I.LOCHDR);if(y.readUInt32LE(0)!==I.LOCSIG)throw ue.Errors.INVALID_LOC();d.version=y.readUInt16LE(I.LOCVER),d.flags=y.readUInt16LE(I.LOCFLG),d.flags_desc=(d.flags&I.FLG_DESC)>0,d.method=y.readUInt16LE(I.LOCHOW),d.time=y.readUInt32LE(I.LOCTIM),d.crc=y.readUInt32LE(I.LOCCRC),d.compressedSize=y.readUInt32LE(I.LOCSIZ),d.size=y.readUInt32LE(I.LOCLEN),d.fnameLen=y.readUInt16LE(I.LOCNAM),d.extraLen=y.readUInt16LE(I.LOCEXT);let w=m+I.LOCHDR+d.fnameLen,T=w+d.extraLen;return a.slice(w,T)},loadFromBinary:function(a){if(a.length!==I.CENHDR||a.readUInt32LE(0)!==I.CENSIG)throw ue.Errors.INVALID_CEN();e=a.readUInt16LE(I.CENVEM),t=a.readUInt16LE(I.CENVER),n=a.readUInt16LE(I.CENFLG),r=a.readUInt16LE(I.CENHOW),i=a.readUInt32LE(I.CENTIM),s=a.readUInt32LE(I.CENCRC),o=a.readUInt32LE(I.CENSIZ),l=a.readUInt32LE(I.CENLEN),c=a.readUInt16LE(I.CENNAM),u=a.readUInt16LE(I.CENEXT),f=a.readUInt16LE(I.CENCOM),g=a.readUInt16LE(I.CENDSK),E=a.readUInt16LE(I.CENATT),S=a.readUInt32LE(I.CENATX),m=a.readUInt32LE(I.CENOFF)},localHeaderToBinary:function(){var a=Buffer.alloc(I.LOCHDR);return a.writeUInt32LE(I.LOCSIG,0),a.writeUInt16LE(t,I.LOCVER),a.writeUInt16LE(n&~I.FLG_DESC,I.LOCFLG),a.writeUInt16LE(r,I.LOCHOW),a.writeUInt32LE(i,I.LOCTIM),a.writeUInt32LE(s,I.LOCCRC),a.writeUInt32LE(o,I.LOCSIZ),a.writeUInt32LE(l,I.LOCLEN),a.writeUInt16LE(c,I.LOCNAM),a.writeUInt16LE(d.extraLen,I.LOCEXT),a},centralHeaderToBinary:function(){var a=Buffer.alloc(I.CENHDR+c+u+f);return a.writeUInt32LE(I.CENSIG,0),a.writeUInt16LE(e,I.CENVEM),a.writeUInt16LE(t,I.CENVER),a.writeUInt16LE(n&~I.FLG_DESC,I.CENFLG),a.writeUInt16LE(r,I.CENHOW),a.writeUInt32LE(i,I.CENTIM),a.writeUInt32LE(s,I.CENCRC),a.writeUInt32LE(o,I.CENSIZ),a.writeUInt32LE(l,I.CENLEN),a.writeUInt16LE(c,I.CENNAM),a.writeUInt16LE(u,I.CENEXT),a.writeUInt16LE(f,I.CENCOM),a.writeUInt16LE(g,I.CENDSK),a.writeUInt16LE(E,I.CENATT),a.writeUInt32LE(S,I.CENATX),a.writeUInt32LE(m,I.CENOFF),a},toJSON:function(){let a=function(y){return y+" bytes"};return{made:e,version:t,flags:n,method:ue.methodToString(r),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:a(o),size:a(l),fileNameLength:a(c),extraLength:a(u),commentLength:a(f),diskNumStart:g,inAttr:E,attr:S,offset:m,centralHeaderSize:a(I.CENHDR+c+u+f)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Ln=F((Pa,Nn)=>{var Y=Ie(),C=Y.Constants;Nn.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 l=0;o.writeUInt32LE(C.ZIP64SIG,l),Y.writeBigUInt64LE(o,C.ZIP64HDR-C.ZIP64LEAD,l+C.ZIP64SIZE),o.writeUInt16LE(45,l+C.ZIP64VEM),o.writeUInt16LE(45,l+C.ZIP64VER),o.writeUInt32LE(0,l+C.ZIP64DSK),o.writeUInt32LE(0,l+C.ZIP64DSKDIR),Y.writeBigUInt64LE(o,e,l+C.ZIP64SUB),Y.writeBigUInt64LE(o,t,l+C.ZIP64TOT),Y.writeBigUInt64LE(o,n,l+C.ZIP64SIZB),Y.writeBigUInt64LE(o,r,l+C.ZIP64OFF);let c=r+n;return l+=C.ZIP64HDR,o.writeUInt32LE(C.END64SIG,l),o.writeUInt32LE(0,l+C.END64START),Y.writeBigUInt64LE(o,c,l+C.END64OFF),o.writeUInt32LE(1,l+C.END64NUMDISKS),l+=C.END64HDR,o.writeUInt32LE(C.ENDSIG,l),o.writeUInt32LE(0,l+4),o.writeUInt16LE(Math.min(e,C.EF_ZIP64_OR_16),l+C.ENDSUB),o.writeUInt16LE(Math.min(t,C.EF_ZIP64_OR_16),l+C.ENDTOT),o.writeUInt32LE(Math.min(n,C.EF_ZIP64_OR_32),l+C.ENDSIZ),o.writeUInt32LE(Math.min(r,C.EF_ZIP64_OR_32),l+C.ENDOFF),o.writeUInt16LE(i,l+C.ENDCOM),o.fill(" ",l+C.ENDHDR),o},toJSON:function(){let o=function(l,c){let u=l.toString(16).toUpperCase();for(;u.length<c;)u="0"+u;return"0x"+u};return{diskEntries:e,totalEntries:t,size:n+" bytes",offset:o(r,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var kt=F(At=>{At.EntryHeader=Dn();At.MainHeader=Ln()});var $n=F((xa,On)=>{On.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(l){s.push(l),o+=l.length}),i.on("end",function(){var l=Buffer.alloc(o),c=0;l.fill(0);for(var u=0;u<s.length;u++){var f=s[u];f.copy(l,c),c+=f.length}r&&r(l)}),i.end(e)}}}});var Bn=F((Ca,Mn)=>{var Yi=+(process?.versions?.node??"").split(".")[0]||0;Mn.exports=function(e,t){var n=require("zlib");let r=Yi>=15&&t>0?{maxOutputLength:t}:{};return{inflate:function(){return n.inflateRawSync(e,r)},inflateAsync:function(i){var s=n.createInflateRaw(r),o=[],l=0;s.on("data",function(c){o.push(c),l+=c.length}),s.on("end",function(){var c=Buffer.alloc(l),u=0;c.fill(0);for(var f=0;f<o.length;f++){var g=o[f];g.copy(c,u),u+=g.length}i&&i(c)}),s.end(e)}}}});var Hn=F((_a,zn)=>{"use strict";var{randomFillSync:jn}=require("crypto"),Ji=Ge(),Xi=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}),Un=(e,t)=>Math.imul(e,t)>>>0,Vn=(e,t)=>Xi[(e^t)&255]^e>>>8,Le=()=>typeof jn=="function"?jn(Buffer.alloc(12)):Le.node();Le.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 Ze={genSalt:Le};function Ke(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])}Ke.prototype.updateKeys=function(e){let t=this.keys;return t[0]=Vn(t[0],e),t[1]+=t[0]&255,t[1]=Un(t[1],134775813)+1,t[2]=Vn(t[2],t[1]>>>24),e};Ke.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return Un(e,e^1)>>8&255};function Qi(e){let t=new Ke(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 eo(e){let t=new Ke(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 to(e,t,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let r=Qi(n),i=r(e.slice(0,12)),s=(t.flags&8)===8?t.timeHighByte:t.crc>>>24;if(i[11]!==s)throw Ji.WRONG_PASSWORD();return r(e.slice(12))}function no(e){Buffer.isBuffer(e)&&e.length>=12?Ze.genSalt=function(){return e.slice(0,12)}:e==="node"?Ze.genSalt=Le.node:Ze.genSalt=Le}function ro(e,t,n,r=!1){e==null&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));let i=eo(n),s=Ze.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)}zn.exports={decrypt:to,encrypt:ro,_salter:no}});var qn=F(Ye=>{Ye.Deflater=$n();Ye.Inflater=Bn();Ye.ZipCrypto=Hn()});var Ft=F((ka,Wn)=>{var N=Ie(),io=kt(),K=N.Constants,vt=qn();Wn.exports=function(e,t){var n=new io.EntryHeader,r=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,l=Buffer.alloc(0),c=Buffer.alloc(0),u=!0;let f=e,g=typeof f.decoder=="object"?f.decoder:N.decoder;u=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 S(a){let y=n.flags_desc||n.localHeader.flags_desc?n.crc:n.localHeader.crc;return N.crc32(a)===y}function m(a,y,w){if(typeof y>"u"&&typeof a=="string"&&(w=a,a=void 0),s)return a&&y&&y(Buffer.alloc(0),N.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var T=E();if(T.length===0)return a&&y&&y(T),T;if(n.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw N.Errors.INVALID_PASS_PARAM();T=vt.ZipCrypto.decrypt(T,n,w)}var P;switch(n.method){case N.Constants.STORED:if(P=Buffer.alloc(T.length),T.copy(P),S(P))return a&&y&&y(P),P;throw a&&y&&y(P,N.Errors.BAD_CRC()),N.Errors.BAD_CRC();case N.Constants.DEFLATED:var x=new vt.Inflater(T,n.size);if(a)x.inflateAsync(function(v){y&&(S(v)?y(v):y(v,N.Errors.BAD_CRC()))});else{if(P=x.inflate(),!S(P))throw N.Errors.BAD_CRC(`"${g.decode(r)}"`);return P}break;default:throw a&&y&&y(Buffer.alloc(0),N.Errors.UNKNOWN_METHOD()),N.Errors.UNKNOWN_METHOD()}}function d(a,y){if((!o||!o.length)&&Buffer.isBuffer(t))return a&&y&&y(E()),E();if(o.length&&!s){var w;switch(n.method){case N.Constants.STORED:return n.compressedSize=n.size,w=Buffer.alloc(o.length),o.copy(w),a&&y&&y(w),w;default:case N.Constants.DEFLATED:var T=new vt.Deflater(o);if(a)T.deflateAsync(function(x){w=Buffer.alloc(x.length),n.compressedSize=x.length,x.copy(w),y&&y(w)});else{var P=T.deflate();return n.compressedSize=P.length,P}T=null;break}}else if(a&&y)y(Buffer.alloc(0));else return Buffer.alloc(0)}function p(a,y){return N.readBigUInt64LE(a,y)}function h(a){try{for(var y=0,w,T,P;y+4<a.length;)w=a.readUInt16LE(y),y+=2,T=a.readUInt16LE(y),y+=2,P=a.slice(y,y+T),y+=T,K.ID_ZIP64===w&&b(P)}catch{throw N.Errors.EXTRA_FIELD_PARSE_ERROR()}}function b(a){var y,w,T,P;a.length>=K.EF_ZIP64_SCOMP&&(y=p(a,K.EF_ZIP64_SUNCOMP),n.size===K.EF_ZIP64_OR_32&&(n.size=y)),a.length>=K.EF_ZIP64_RHO&&(w=p(a,K.EF_ZIP64_SCOMP),n.compressedSize===K.EF_ZIP64_OR_32&&(n.compressedSize=w)),a.length>=K.EF_ZIP64_DSN&&(T=p(a,K.EF_ZIP64_RHO),n.offset===K.EF_ZIP64_OR_32&&(n.offset=T)),a.length>=K.EF_ZIP64_DSN+4&&(P=a.readUInt32LE(K.EF_ZIP64_DSN),n.diskNumStart===K.EF_ZIP64_OR_16&&(n.diskNumStart=P))}return{get entryName(){return g.decode(r)},get rawEntryName(){return r},set entryName(a){r=N.toBuffer(a,g.encode);var y=r[r.length-1];s=y===47||y===92,n.fileNameLength=r.length},get efs(){return typeof u=="function"?u(this.entryName):u},get extra(){return l},set extra(a){l=a,n.extraLength=a.length,h(a)},get comment(){return g.decode(i)},set comment(a){if(i=N.toBuffer(a,g.encode),n.commentLength=i.length,i.length>65535)throw N.Errors.COMMENT_TOO_LONG()},get name(){let a=g.decode(r);return s?a.replace(/[/\\]$/,"").split("/").pop():a.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return d(!1,null)},getCompressedDataAsync:function(a){d(!0,a)},setData:function(a){o=N.toBuffer(a,N.decoder.encode),!s&&o.length?(n.size=o.length,n.method=N.Constants.DEFLATED,n.crc=N.crc32(a),n.changed=!0):n.method=N.Constants.STORED},getData:function(a){return n.changed?o:m(!1,null,a)},getDataAsync:function(a,y){n.changed?a(o):m(!0,a,y)},set attr(a){n.attr=a},get attr(){return n.attr},set header(a){n.loadFromBinary(a)},get header(){return n},packCentralHeader:function(){n.flags_efs=this.efs,n.extraLength=l.length;var a=n.centralHeaderToBinary(),y=N.Constants.CENHDR;return r.copy(a,y),y+=r.length,l.copy(a,y),y+=n.extraLength,i.copy(a,y),a},packLocalHeader:function(){let a=0;n.flags_efs=this.efs,n.extraLocalLength=c.length;let y=n.localHeaderToBinary(),w=Buffer.alloc(y.length+r.length+n.extraLocalLength);return y.copy(w,a),a+=y.length,r.copy(w,a),a+=r.length,c.copy(w,a),a+=c.length,w},toJSON:function(){let a=function(y){return"<"+(y&&y.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:n.toJSON(),compressedData:a(t),data:a(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Kn=F((va,Zn)=>{var Gn=Ft(),oo=kt(),W=Ie();Zn.exports=function(e,t){var n=[],r=Object.create(null),i=Buffer.alloc(0),s=new oo.MainHeader,o=!1,l=null;let c=new Set,u=t,{noSort:f,decoder:g}=u;e?m(u.readEntries):o=!0;function E(){let p=new Set;for(let h of Object.keys(r)){let b=h.split("/");if(b.pop(),!!b.length)for(let a=0;a<b.length;a++){let y=b.slice(0,a+1).join("/")+"/";p.add(y)}}for(let h of p)if(!(h in r)){let b=new Gn(u);b.entryName=h,b.attr=16,b.temporary=!0,n.push(b),r[b.entryName]=b,c.add(b)}}function S(){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,h=0;h<n.length;h++){var b=p,a=new Gn(u,e);a.header=e.slice(b,b+=W.Constants.CENHDR),a.entryName=e.slice(b,b+=a.header.fileNameLength),a.header.extraLength&&(a.extra=e.slice(b,b+=a.header.extraLength)),a.header.commentLength&&(a.comment=e.slice(b,b+a.header.commentLength)),p+=a.header.centralHeaderSize,n[h]=a,r[a.entryName]=a}c.clear(),E()}function m(p){var h=e.length-W.Constants.ENDHDR,b=Math.max(0,h-65535),a=b,y=e.length,w=-1,T=0;for(typeof u.trailingSpace=="boolean"&&u.trailingSpace&&(b=0),h;h>=a;h--)if(e[h]===80){if(e.readUInt32LE(h)===W.Constants.ENDSIG){w=h,T=h,y=h+W.Constants.ENDHDR,a=h-W.Constants.END64HDR;continue}if(e.readUInt32LE(h)===W.Constants.END64SIG){a=b;continue}if(e.readUInt32LE(h)===W.Constants.ZIP64SIG){w=h,y=h+W.readBigUInt64LE(e,h+W.Constants.ZIP64SIZE)+W.Constants.ZIP64LEAD;break}}if(w==-1)throw W.Errors.INVALID_FORMAT();s.loadFromBinary(e.slice(w,y)),s.commentLength&&(i=e.slice(T+W.Constants.ENDHDR)),p&&S()}function d(){n.length>1&&!f&&(n=n.map(p=>({entry:p,key:p.entryName.toLowerCase()})).sort((p,h)=>p.key.localeCompare(h.key)).map(p=>p.entry))}return{get entries(){return o||S(),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||S(),r[p]||null},setEntry:function(p){o||S(),n.push(p),r[p.entryName]=p,s.totalEntries=n.length},deleteFile:function(p,h=!0){o||S();let b=r[p];this.getEntryChildren(b,h).map(y=>y.entryName).forEach(this.deleteEntry)},deleteEntry:function(p){o||S();let h=r[p],b=n.indexOf(h);b>=0&&(n.splice(b,1),delete r[p],s.totalEntries=n.length)},getEntryChildren:function(p,h=!0){if(o||S(),typeof p=="object")if(p.isDirectory&&h){let b=[],a=p.entryName;for(let y of n)y.entryName.startsWith(a)&&b.push(y);return b}else return[p];return[]},getChildCount:function(p){if(p&&p.isDirectory){let h=this.getEntryChildren(p);return h.includes(p)?h.length-1:h.length}return 0},compressToBuffer:function(){o||S(),d();let p=[],h=[],b=0,a=0;s.size=0,s.offset=0;let y=0;for(let P of this.entries){let x=P.getCompressedData();P.header.offset=a;let v=P.packLocalHeader(),R=v.length+x.length;a+=R,p.push(v),p.push(x);let D=P.packCentralHeader();h.push(D),s.size+=D.length,b+=R+D.length,y++}b+=s.mainHeaderSize,s.offset=a,s.totalEntries=y,a=0;let w=Buffer.alloc(b);for(let P of p)P.copy(w,a),a+=P.length;for(let P of h)P.copy(w,a),a+=P.length;let T=s.toBinary();return i&&i.copy(T,T.length-i.length),T.copy(w,a),e=w,o=!1,w},toAsyncBuffer:function(p,h,b,a){try{o||S(),d();let y=[],w=[],T=0,P=0,x=0;s.size=0,s.offset=0;let v=function(R){if(R.length>0){let D=R.shift(),V=D.entryName+D.extra.toString();b&&b(V),D.getCompressedDataAsync(function(q){a&&a(V),D.header.offset=P;let ge=D.packLocalHeader(),qe=ge.length+q.length;P+=qe,y.push(ge),y.push(q);let Ne=D.packCentralHeader();w.push(Ne),s.size+=Ne.length,T+=qe+Ne.length,x++,v(R)})}else{T+=s.mainHeaderSize,s.offset=P,s.totalEntries=x,P=0;let D=Buffer.alloc(T);y.forEach(function(q){q.copy(D,P),P+=q.length}),w.forEach(function(q){q.copy(D,P),P+=q.length});let V=s.toBinary();i&&i.copy(V,V.length-i.length),V.copy(D,P),e=D,o=!1,p(D)}};v(Array.from(this.entries))}catch(y){h(y)}}}}});var Rt=F((Fa,Jn)=>{var B=Ie(),M=require("path"),so=Ft(),ao=Kn(),he=(...e)=>B.findLast(e,t=>typeof t=="boolean"),Yn=(...e)=>B.findLast(e,t=>typeof t=="string"),lo=(...e)=>B.findLast(e,t=>typeof t=="function"),co={noSort:!1,readEntries:!1,method:B.Constants.NONE,fs:null};Jn.exports=function(e,t){let n=null,r=Object.assign(Object.create(null),co);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=m=>{m.filter(d=>d.attr).sort((d,p)=>p.path.length-d.path.length).forEach(d=>i.fs.chmodSync(d.path,d.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 ao(n,r),{canonical:l,sanitize:c,zipnamefix:u}=B;function f(m){if(m&&o){var d;if(typeof m=="string"&&(d=o.getEntry(M.posix.normalize(m))),typeof m=="object"&&typeof m.entryName<"u"&&typeof m.header<"u"&&(d=o.getEntry(m.entryName)),d)return d}return null}function g(m){let{join:d,normalize:p,sep:h}=M.posix;return d(M.isAbsolute(m)?"/":".",p(h+m.split("\\").join(h)+h))}function E(m){return m instanceof RegExp?(function(d){return function(p){return d.test(p)}})(m):typeof m!="function"?()=>!0:m}let S=(m,d)=>{let p=d.slice(-1);return p=p===i.sep?i.sep:"",M.relative(m,d)+p};return{readFile:function(m,d){var p=f(m);return p&&p.getData(d)||null},childCount:function(m){let d=f(m);if(d)return o.getChildCount(d)},readFileAsync:function(m,d){var p=f(m);p?p.getDataAsync(d):d(null,"getEntry failed for:"+m)},readAsText:function(m,d){var p=f(m);if(p){var h=p.getData();if(h&&h.length)return h.toString(d||"utf8")}return""},readAsTextAsync:function(m,d,p){var h=f(m);h?h.getDataAsync(function(b,a){if(a){d(b,a);return}b&&b.length?d(b.toString(p||"utf8")):d("")}):d("")},deleteFile:function(m,d=!0){var p=f(m);p&&o.deleteFile(p.entryName,d)},deleteEntry:function(m){var d=f(m);d&&o.deleteEntry(d.entryName)},addZipComment:function(m){o.comment=m},getZipComment:function(){return o.comment||""},addZipEntryComment:function(m,d){var p=f(m);p&&(p.comment=d)},getZipEntryComment:function(m){var d=f(m);return d&&d.comment||""},updateFile:function(m,d){var p=f(m);p&&p.setData(d)},addLocalFile:function(m,d,p,h){if(i.fs.existsSync(m)){d=d?g(d):"";let b=M.win32.basename(M.win32.normalize(m));d+=p||b;let a=i.fs.statSync(m),y=a.isFile()?i.fs.readFileSync(m):Buffer.alloc(0);a.isDirectory()&&(d+=i.sep),this.addFile(d,y,h,a)}else throw B.Errors.FILE_NOT_FOUND(m)},addLocalFileAsync:function(m,d){m=typeof m=="object"?m:{localPath:m};let p=M.resolve(m.localPath),{comment:h}=m,{zipPath:b,zipName:a}=m,y=this;i.fs.stat(p,function(w,T){if(w)return d(w,!1);b=b?g(b):"";let P=M.win32.basename(M.win32.normalize(p));if(b+=a||P,T.isFile())i.fs.readFile(p,function(x,v){return x?d(x,!1):(y.addFile(b,v,h,T),setImmediate(d,void 0,!0))});else if(T.isDirectory())return b+=i.sep,y.addFile(b,Buffer.alloc(0),h,T),setImmediate(d,void 0,!0)})},addLocalFolder:function(m,d,p){if(p=E(p),d=d?g(d):"",m=M.normalize(m),i.fs.existsSync(m)){let h=i.findFiles(m),b=this;if(h.length)for(let a of h){let y=M.join(d,S(m,a));p(y)&&b.addLocalFile(a,M.dirname(y))}}else throw B.Errors.FILE_NOT_FOUND(m)},addLocalFolderAsync:function(m,d,p,h){h=E(h),p=p?g(p):"",m=M.normalize(m);var b=this;i.fs.open(m,"r",function(a){if(a&&a.code==="ENOENT")d(void 0,B.Errors.FILE_NOT_FOUND(m));else if(a)d(void 0,a);else{var y=i.findFiles(m),w=-1,T=function(){if(w+=1,w<y.length){var P=y[w],x=S(m,P).split("\\").join("/");x=x.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),h(x)?i.fs.stat(P,function(v,R){v&&d(void 0,v),R.isFile()?i.fs.readFile(P,function(D,V){D?d(void 0,D):(b.addFile(p+x,V,"",R),T())}):(b.addFile(p+x+"/",Buffer.alloc(0),"",R),T())}):process.nextTick(()=>{T()})}else d(!0,void 0)};T()}})},addLocalFolderAsync2:function(m,d){let p=this;m=typeof m=="object"?m:{localPath:m};let h=M.resolve(g(m.localPath)),{zipPath:b,filter:a,namefix:y}=m;a instanceof RegExp?a=(function(P){return function(x){return P.test(x)}})(a):typeof a!="function"&&(a=function(){return!0}),b=b?g(b):"",y==="latin1"&&(y=P=>P.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof y!="function"&&(y=P=>P);let w=P=>M.join(b,y(S(h,P))),T=P=>M.win32.basename(M.win32.normalize(y(P)));i.fs.open(h,"r",function(P){P&&P.code==="ENOENT"?d(void 0,B.Errors.FILE_NOT_FOUND(h)):P?d(void 0,P):i.findFilesAsync(h,function(x,v){if(x)return d(x);v=v.filter(R=>a(w(R))),v.length||d(void 0,!1),setImmediate(v.reverse().reduce(function(R,D){return function(V,q){if(V||q===!1)return setImmediate(R,V,!1);p.addLocalFileAsync({localPath:D,zipPath:M.dirname(w(D)),zipName:T(D)},R)}},d))})})},addLocalFolderPromise:function(m,d){return new Promise((p,h)=>{this.addLocalFolderAsync2(Object.assign({localPath:m},d),(b,a)=>{b&&h(b),a&&p(this)})})},addFile:function(m,d,p,h){m=u(m);let b=f(m),a=b!=null;a||(b=new so(r),b.entryName=m),b.comment=p||"";let y=typeof h=="object"&&h instanceof i.fs.Stats;y&&(b.header.time=h.mtime);var w=b.isDirectory?16:0;let T=b.isDirectory?16384:32768;return y?T|=4095&h.mode:typeof h=="number"?T|=4095&h:T|=b.isDirectory?493:420,w=(w|T<<16)>>>0,b.attr=w,b.setData(d),a||o.setEntry(b),b},getEntries:function(m){return o.password=m,o?o.entries:[]},getEntry:function(m){return f(m)},getEntryCount:function(){return o.getEntryCount()},forEach:function(m){return o.forEach(m)},extractEntryTo:function(m,d,p,h,b,a){h=he(!1,h),b=he(!1,b),p=he(!0,p),a=Yn(b,a);var y=f(m);if(!y)throw B.Errors.NO_ENTRY();var w=l(y.entryName),T=c(d,a&&!y.isDirectory?l(a):p?w:M.basename(w));if(y.isDirectory){var P=o.getEntryChildren(y);return P.forEach(function(R){if(R.isDirectory)return;var D=R.getData();if(!D)throw B.Errors.CANT_EXTRACT_FILE();var V=l(p?R.entryName:R.entryName.substring(y.entryName.length)),q=c(d,V);let ge=b?R.header.fileAttr:void 0;i.writeFileTo(q,D,h,ge)}),!0}var x=y.getData(o.password);if(!x)throw B.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(T)&&!h)throw B.Errors.CANT_OVERRIDE();let v=b?m.header.fileAttr:void 0;return i.writeFileTo(T,x,h,v),!0},test:function(m){if(!o)return!1;for(var d of o.entries)try{if(d.isDirectory)continue;var p=d.getData(m);if(!p)return!1}catch{return!1}return!0},extractAllTo:function(m,d,p,h){if(p=he(!1,p),h=Yn(p,h),d=he(!1,d),!o)throw B.Errors.NO_ZIP();let b=[];o.entries.forEach(function(a){var y=c(m,l(a.entryName));if(a.isDirectory){i.makeDir(y),p&&b.push({path:y,attr:a.header.fileAttr});return}var w=a.getData(h);if(!w)throw B.Errors.CANT_EXTRACT_FILE();let T=p?a.header.fileAttr:void 0;i.writeFileTo(y,w,d,T);try{i.fs.utimesSync(y,a.header.time,a.header.time)}catch{}}),s(b)},extractAllToAsync:function(m,d,p,h){if(h=lo(d,p,h),p=he(!1,p),d=he(!1,d),!h)return new Promise((x,v)=>{this.extractAllToAsync(m,d,p,function(R){R?v(R):x(this)})});if(!o){h(B.Errors.NO_ZIP());return}m=M.resolve(m);let b=x=>c(m,M.normalize(l(x.entryName))),a=(x,v)=>new Error(x+': "'+v+'"'),y=[],w=[];o.entries.forEach(x=>{x.isDirectory?y.push(x):w.push(x)});let T=[];for(let x of y){let v=b(x),R=p?x.header.fileAttr:void 0;try{i.makeDir(v)}catch{h(a("Unable to create folder",v));continue}R&&T.push({path:v,attr:R});try{i.fs.utimesSync(v,x.header.time,x.header.time)}catch{}}let P=x=>{if(!x)try{s(T)}catch(v){return h(a("Unable to set folder permissions",v.path||""))}h(x)};w.reverse().reduce(function(x,v){return function(R){if(R)x(R);else{let D=M.normalize(l(v.entryName)),V=c(m,D);v.getDataAsync(function(q,ge){if(ge)x(ge);else if(!q)x(B.Errors.CANT_EXTRACT_FILE());else{let qe=p?v.header.fileAttr:void 0;i.writeFileToAsync(V,q,d,qe,function(Ne){if(!Ne)return x(a("Unable to write file",V));i.fs.utimes(V,v.header.time,v.header.time,function(){x()})})}})}}},P)()},writeZip:function(m,d){if(arguments.length===1&&typeof m=="function"&&(d=m,m=""),!m&&r.filename&&(m=r.filename),!!m){var p=o.compressToBuffer();if(p){var h=i.writeFileTo(m,p,!0);typeof d=="function"&&d(h?null:new Error("failed"),"")}}},writeZipPromise:function(m,d){let{overwrite:p,perm:h}=Object.assign({overwrite:!0},d);return new Promise((b,a)=>{!m&&r.filename&&(m=r.filename),m||a("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(y=>{let w=T=>T?b(T):a("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(m,y,p,h,w)},a)})},toBufferPromise:function(){return new Promise((m,d)=>{o.toAsyncBuffer(m,d)})},toBuffer:function(m,d,p,h){return typeof m=="function"?(o.toAsyncBuffer(m,d,p,h),null):o.compressToBuffer()}}}});var Wr=F(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0})});var ht=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 gt=[400,500,600,700],Es=[400,700],tn=[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??gt,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:gt,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:gt,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:tn,variable:!0}),A("roboto-mono","Roboto Mono","monospace","roboto-mono","Roboto+Mono",{weights:tn,variable:!0}),A("jetbrains-mono","JetBrains Mono","monospace","jetbrains-mono","JetBrains+Mono",{weights:tn,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:Es}),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:gt,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 _e=F(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.normalizeFontId=Ce;pe.lookupFontDefinition=Me;pe.resolveInstallableFont=bs;pe.resolveFontFamily=Ss;pe.listFontsByCategory=Ts;pe.collectFontIdsFromSiteData=ws;var yt=ht();function Ce(e){return e.trim().toLowerCase().replace(/['"]/g,"").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function Me(e){if(!e||!e.trim())return null;let t=Ce(e),n=yt.DENEB_FONT_BY_ID.get(t);if(n)return n;for(let i of yt.DENEB_FONT_REGISTRY)if(Ce(i.label)===t||Ce(i.family)===t)return i;let r=e.split(",")[0]?.trim().replace(/^['"]|['"]$/g,"");if(r){let i=Ce(r);if(i&&i!==t)return Me(r)}return null}function bs(e){let t=Me(e);return t?t.fontsourcePackage?t:t.substituteId?yt.DENEB_FONT_BY_ID.get(t.substituteId)??null:null:null}function Ss(e){if(!e||!e.trim())return;let t=Me(e);return t?t.cssStack:e.includes(",")?e:`'${e.trim()}', system-ui, sans-serif`}function Ts(){var e;let t={};for(let n of yt.DENEB_FONT_REGISTRY)t[e=n.category]??(t[e]=[]),t[n.category].push(n);return t}function ws(e){let t=new Set,n=c=>{if(typeof c!="string"||!c.trim())return;let u=Me(c);if(u){t.add(u.id),u.substituteId&&t.add(u.substituteId);return}let f=Ce(c);f&&t.add(f)};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,l=c=>{if(!(!c||typeof c!="object")&&!o.has(c)){if(o.add(c),Array.isArray(c)){c.forEach(l);return}for(let[u,f]of Object.entries(c))u.endsWith("Style")&&f&&typeof f=="object"&&n(f.fontFamily),l(f)}};return l(r.content),t.delete("system-sans"),Array.from(t)}});var nn=F(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.formatResponsiveFontSize=Gr;Et.formatFontSize=Ps;function Gr(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 Ps(e,t){if(!(e==null||e==="")){if(t?.responsive){let n=Gr(e);if(n)return n}return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}}});var Kr=F(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.buildGoogleFontsStylesheetUrl=Cs;var Zr=ht(),Is=_e();function xs(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 Cs(e){let t=[],n=new Set;for(let r of e){let i=Zr.DENEB_FONT_BY_ID.get(r)??(0,Is.lookupFontDefinition)(r);if(!i||!i.googleFonts||!i.googleQuery)continue;let s=i.substituteId&&!i.fontsourcePackage?i.substituteId:i.id,o=Zr.DENEB_FONT_BY_ID.get(s)??i;if(n.has(o.id))continue;n.add(o.id);let l=xs(o);l&&t.push(l)}return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`}});var Yr=F(re=>{"use strict";var _s=re&&re.__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]})),Be=re&&re.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&_s(t,e,n)};Object.defineProperty(re,"__esModule",{value:!0});Be(Wr(),re);Be(ht(),re);Be(_e(),re);Be(nn(),re);Be(Kr(),re)});var Xr=F(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0})});var Qr=F(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.DENEB_STYLE_PATCH_MESSAGE=se.STYLE_PATCH_MESSAGE=void 0;se.isStylePatchPayload=As;se.STYLE_PATCH_MESSAGE="FIVORA_PREVIEW_STYLE_PATCH";se.DENEB_STYLE_PATCH_MESSAGE="DENEB_PREVIEW_STYLE_PATCH";function As(e){if(!e||typeof e!="object")return!1;let t=e,n=t.type;return n!==se.STYLE_PATCH_MESSAGE&&n!==se.DENEB_STYLE_PATCH_MESSAGE?!1:typeof t.targetPath=="string"&&typeof t.styleType=="string"&&typeof t.properties=="object"&&t.properties!==null}});var on=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=ei;O.buildStyleFallbackSelectors=ks;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 ae(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function ei(e){return`[${O.STYLE_TARGET_ATTRIBUTE}="${ae(e)}"]`}function ks(e,t){let n=[ei(e),`[${O.PREVIEW_FIELD_ATTRIBUTE}="${ae(e)}"]`,`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(e)}"]`];if(t==="card"&&e.endsWith(".card")){let r=e.slice(0,-5);n.push(`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(r)}"]`)}if(e.includes(":")){let[r,i]=e.split(":");i==="card"?n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_ITEM_ATTRIBUTE}]`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] .card`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] article`):i&&n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_FIELD_ATTRIBUTE}$=".${ae(i)}"]`)}return n}});var bt=F(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.resolveFontFamily=void 0;Ae.resolveShadowPreset=Rs;Ae.resolveThemeToken=Ds;var vs=_e();Object.defineProperty(Ae,"resolveFontFamily",{enumerable:!0,get:function(){return vs.resolveFontFamily}});var Fs={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 Rs(e){if(e)return Fs[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 an=F(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.formatUnit=L;le.textStyleToCssVariables=ti;le.cardStyleToCssVariables=ni;le.buttonStyleToCssVariables=ri;le.gridStyleToCssVariables=ii;le.sectionStyleToCssVariables=oi;le.styleToCssVariables=Os;var Ns=nn(),Ls=_e(),ke=bt();function L(e){if(!(e===void 0||e===""||e===null))return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}function sn(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`]=L(r)),i!==void 0&&(n[`${t}-margin-bottom`]=L(i)),s!==void 0&&(n[`${t}-margin-left`]=L(s)),o!==void 0&&(n[`${t}-margin-right`]=L(o)),n}function ti(e){let t={...sn(e,"--deneb")};return e.fontFamily&&(t["--deneb-font-family"]=(0,Ls.resolveFontFamily)(e.fontFamily)),e.fontSize!==void 0&&(t["--deneb-font-size"]=(0,Ns.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,ke.resolveThemeToken)(e.color)),e.textAlign&&(t["--deneb-text-align"]=e.textAlign),e.textTransform&&(t["--deneb-text-transform"]=e.textTransform),t}function ni(e){let t={...sn(e,"--deneb-card")};return e.width!==void 0&&(t["--deneb-card-width"]=L(e.width)),e.minWidth!==void 0&&(t["--deneb-card-min-width"]=L(e.minWidth)),e.maxWidth!==void 0&&(t["--deneb-card-max-width"]=L(e.maxWidth)),e.height!==void 0&&(t["--deneb-card-height"]=L(e.height)),e.aspectRatio&&(t["--deneb-card-aspect-ratio"]=e.aspectRatio),e.paddingTop!==void 0&&(t["--deneb-card-pt"]=L(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-card-pb"]=L(e.paddingBottom)),e.paddingLeft!==void 0&&(t["--deneb-card-pl"]=L(e.paddingLeft)),e.paddingRight!==void 0&&(t["--deneb-card-pr"]=L(e.paddingRight)),e.borderRadius!==void 0&&(t["--deneb-card-radius"]=L(e.borderRadius)),e.borderWidth!==void 0&&(t["--deneb-card-border-w"]=L(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,ke.resolveThemeToken)(e.backgroundColor)),e.backgroundGradient&&(t["--deneb-card-bg-gradient"]=e.backgroundGradient),e.boxShadow&&(t["--deneb-card-shadow"]=(0,ke.resolveShadowPreset)(e.boxShadow)),e.backdropBlur!==void 0&&(t["--deneb-card-blur"]=L(e.backdropBlur)),e.gap!==void 0&&(t["--deneb-card-gap"]=L(e.gap)),t}function ri(e){let t={...sn(e,"--deneb-btn")};return e.borderRadius!==void 0&&(t["--deneb-btn-radius"]=L(e.borderRadius)),e.paddingX!==void 0&&(t["--deneb-btn-px"]=L(e.paddingX)),e.paddingY!==void 0&&(t["--deneb-btn-py"]=L(e.paddingY)),e.backgroundColor&&(t["--deneb-btn-bg"]=(0,ke.resolveThemeToken)(e.backgroundColor)),e.textColor&&(t["--deneb-btn-color"]=(0,ke.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 ii(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"]=L(e.gapX)),e.gapY!==void 0&&(t["--deneb-grid-gap-y"]=L(e.gapY)),e.equalHeight!==void 0&&(t["--deneb-grid-equal-height"]=e.equalHeight?"stretch":"start"),t}function oi(e){let t={};return e.paddingTop!==void 0&&(t["--deneb-section-pt"]=L(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-section-pb"]=L(e.paddingBottom)),e.paddingX!==void 0&&(t["--deneb-section-px"]=L(e.paddingX)),e.maxWidth&&(t["--deneb-section-max-w"]=e.maxWidth),e.backgroundColor&&(t["--deneb-section-bg"]=(0,ke.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)),e.textAlign&&(t["--deneb-section-align"]=e.textAlign),e.display&&(t["--deneb-section-display"]=e.display),e.order!==void 0&&e.order!==""&&(t["--deneb-section-order"]=String(e.order)),t}function Os(e,t){switch(e){case"text":return ti(t);case"card":return ni(t);case"button":return ri(t);case"grid":return ii(t);case"section":return oi(t);default:return{}}}});var cn=F(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.isPlainObject=ln;St.deepMerge=si;function ln(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function si(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))ln(o)&&ln(i[s])?i[s]=si(i[s],o,n+1,r):i[s]=o;return i}});var di=F(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getLiveStyleCache=Bs;we.applyCssVariablesToElement=li;we.findStyleTargetElement=js;we.patchElementStyle=ci;we.patchStyleByPath=Vs;var je=on(),$s=cn(),ce=an(),Ms=_e(),ai=bt(),dn=new Map;function Bs(){return dn}function li(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}function js(e,t){if(typeof document>"u"||!e)return null;for(let n of(0,je.buildStyleFallbackSelectors)(e,t)){let r=document.querySelector(n);if(r)return r}return null}function ci(e,t,n){let i=(e.getAttribute(je.STYLE_TARGET_ATTRIBUTE)??"")||e.getAttribute("data-preview-field-path")||"",s=i?dn.get(i)??{}:{},o=(0,$s.deepMerge)(s,n);i&&dn.set(i,o);let l=(0,ce.styleToCssVariables)(t,o);if(li(e,l),t==="text"){if(o.color){let c=(0,ai.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,ce.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,Ms.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,ce.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,ce.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,ce.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,ce.formatUnit)(o.marginRight??o.spacingRight);c&&e.style.setProperty("margin-right",c,"important")}}else if(t==="card"){if(o.backgroundColor){let c=(0,ai.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,ce.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,ce.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,ce.formatUnit)(o.borderWidth)||String(o.borderWidth);e.style.setProperty("border-width",c,"important"),e.style.setProperty("border-style","solid","important")}}e.getAttribute(je.STYLE_TYPE_ATTRIBUTE)||e.setAttribute(je.STYLE_TYPE_ATTRIBUTE,t)}function Vs(e,t,n){if(typeof document>"u"||!e)return!1;let r=!1;for(let i of(0,je.buildStyleFallbackSelectors)(e,t)){let s=document.querySelectorAll(i);s.length>0&&(s.forEach(o=>ci(o,t,n)),r=!0)}return r}});var ui=F(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.isValidStyleKind=zs;Ve.validateStyleTree=Hs;Ve.collectStyleTargetsFromHtml=qs;var Us=new Set(["text","card","button","grid","section"]);function zs(e){return typeof e=="string"&&Us.has(e)}function Hs(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 qs(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 pi=F(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0})});var un=F(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.isDarkColor=mi;ve.getAutoContrastTextColor=Ws;ve.toHexColor=Gs;ve.normalizeHexColor=Zs;function mi(e){if(typeof e!="string"||!e)return!1;let t=e.trim().toLowerCase();if(!/^#[0-9a-f]{3,6}$/i.test(t))return!1;let n=t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t,r=Number.parseInt(n.slice(1,3),16),i=Number.parseInt(n.slice(3,5),16),s=Number.parseInt(n.slice(5,7),16);return(r*299+i*587+s*114)/1e3<130}function Ws(e,t="#ffffff",n="#0f172a"){return mi(e)?t:n}function Gs(e,t){if(!e)return t;let n=e.trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():/^#[0-9a-f]{3}$/i.test(n)?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`.toLowerCase():t}function Zs(e){if(!e)return null;let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t.toLowerCase():/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toLowerCase():null}});var gi=F(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.THEME_PALETTES=void 0;Tt.THEME_PALETTES=[{id:"classic-luxe",name:"Classic Luxe",badge:"Light \u2022 Warm Luxe",mode:"light",primary:"#1e293b",secondary:"#d97706",accent:"#f59e0b",background:"#fdfbf7",card:"#ffffff",text:"#1e293b",muted:"#64748b",buttonBg:"#1e293b",buttonText:"#ffffff"},{id:"ocean-modern",name:"Ocean Modern",badge:"Light \u2022 Crisp Ocean",mode:"light",primary:"#0284c7",secondary:"#0369a1",accent:"#38bdf8",background:"#f8fafc",card:"#ffffff",text:"#0f172a",muted:"#64748b",buttonBg:"#0284c7",buttonText:"#ffffff"},{id:"forest-emerald",name:"Forest Emerald",badge:"Light \u2022 Organic Green",mode:"light",primary:"#065f46",secondary:"#047857",accent:"#10b981",background:"#f0fdf4",card:"#ffffff",text:"#064e3b",muted:"#475569",buttonBg:"#065f46",buttonText:"#ffffff"},{id:"warm-terracotta",name:"Warm Terracotta",badge:"Light \u2022 Artisanal",mode:"light",primary:"#c2410c",secondary:"#ea580c",accent:"#f97316",background:"#fffaf5",card:"#ffffff",text:"#431407",muted:"#78350f",buttonBg:"#c2410c",buttonText:"#ffffff"},{id:"velvet-berry",name:"Velvet Berry",badge:"Light \u2022 Vibrant Chic",mode:"light",primary:"#9f1239",secondary:"#be123c",accent:"#f43f5e",background:"#fff5f7",card:"#ffffff",text:"#4c0519",muted:"#881337",buttonBg:"#9f1239",buttonText:"#ffffff"},{id:"sleek-obsidian",name:"Sleek Obsidian",badge:"Dark \u2022 Obsidian",mode:"dark",primary:"#60a5fa",secondary:"#38bdf8",accent:"#93c5fd",background:"#090d16",card:"#131b2e",text:"#f8fafc",muted:"#94a3b8",buttonBg:"#60a5fa",buttonText:"#090d16"},{id:"midnight-cyber",name:"Midnight Cyber",badge:"Dark \u2022 Neon Cyber",mode:"dark",primary:"#818cf8",secondary:"#6366f1",accent:"#22d3ee",background:"#09090b",card:"#18181b",text:"#f4f4f5",muted:"#a1a1aa",buttonBg:"#818cf8",buttonText:"#09090b"},{id:"royal-gold-dark",name:"Royal Gold & Dark",badge:"Dark \u2022 Imperial Gold",mode:"dark",primary:"#f59e0b",secondary:"#d97706",accent:"#fbbf24",background:"#0c0a09",card:"#1c1917",text:"#f5f5f4",muted:"#a8a29e",buttonBg:"#f59e0b",buttonText:"#0c0a09"},{id:"emerald-nocturne",name:"Emerald Nocturne",badge:"Dark \u2022 Deep Emerald",mode:"dark",primary:"#34d399",secondary:"#10b981",accent:"#6ee7b7",background:"#022c22",card:"#064e3b",text:"#ecfdf5",muted:"#a7f3d0",buttonBg:"#34d399",buttonText:"#022c22"}]});var hi=F(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.FONT_PAIRINGS=Fe.GLOBAL_FONT_OPTIONS=void 0;Fe.GLOBAL_FONT_OPTIONS=["Inter","Playfair Display","DM Sans","Poppins","Montserrat","Plus Jakarta Sans","Georgia","Editorial Serif"];Fe.FONT_PAIRINGS=[{id:"modern-clean",name:"Modern & Clean",headingFont:"Plus Jakarta Sans",bodyFont:"Inter",description:"Crisp, contemporary tech and SaaS feel with high readability"},{id:"editorial-luxury",name:"Editorial Luxury",headingFont:"Playfair Display",bodyFont:"Inter",description:"Elegant serif headline paired with neutral modern body text"},{id:"tech-forward",name:"Tech Forward",headingFont:"Inter",bodyFont:"Inter",description:"Minimalist, uniform sans-serif design system"},{id:"vibrant-lifestyle",name:"Vibrant Lifestyle",headingFont:"Poppins",bodyFont:"DM Sans",description:"Warm, geometric sans pairing suited for retail and wellness"},{id:"classic-prestige",name:"Classic Prestige",headingFont:"Montserrat",bodyFont:"Inter",description:"Authoritative, balanced typography for premium brands"}]});var bi=F(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.parseVisualCustomization=yi;Ue.customizationToTheme=Ei;Ue.mergeVisualCustomizationIntoTheme=Ks;function de(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function yi(e){return de(e)?{version:1,colors:de(e.colors)?e.colors:void 0,colorReplacements:de(e.colorReplacements)?e.colorReplacements:void 0,typography:de(e.typography)?e.typography:void 0,spacing:de(e.spacing)?e.spacing:void 0,layout:de(e.layout)?e.layout:void 0,components:de(e.components)?e.components:void 0,sections:de(e.sections)?e.sections:void 0,elementStyles:de(e.elementStyles)?e.elementStyles:void 0}:{version:1}}function Ei(e){let t=e.colors??{};return{designCustomizationVersion:1,colorReplacements:e.colorReplacements,primaryColor:t.primary,secondaryColor:t.secondary,accentColor:t.accent,backgroundColor:t.background,textColor:t.text,surfaceColor:t.surface??t.cardBackground,surfaceAltColor:t.surfaceAlt,headingColor:t.heading??t.text,mutedTextColor:t.mutedText,borderColor:t.border,headerBackgroundColor:t.headerBackground,footerBackgroundColor:t.footerBackground,cardBackgroundColor:t.cardBackground??t.surface,buttonBackgroundColor:t.buttonBackground,buttonTextColor:t.buttonText,...e.typography,...e.spacing,...e.layout,...e.components,sections:e.sections,elementStyles:e.elementStyles}}function Ks(e,t){let n=yi(t);return[n.colors,n.colorReplacements,n.typography,n.spacing,n.layout,n.components,n.sections,n.elementStyles].some(i=>!!(i&&Object.values(i).some(s=>s!==void 0&&s!=="")))?Object.fromEntries(Object.entries({...e??{},...Ei(n)}).filter(([,i])=>i!==void 0)):e??null}});var Si=F(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.generateThemeVariables=Ys;var fn=un();function Ys(e){let t={};if(e){for(let[h,b]of Object.entries(e))if(typeof b=="string"||typeof b=="number"){let a=`--${h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`;t[a]=String(b)}}let n=(0,fn.isDarkColor)(e?.backgroundColor),r=e?.backgroundColor||(n?"#0f172a":"#ffffff"),i=e?.textColor||(n?"#f8fafc":"#0f172a"),s=e?.mutedTextColor||(n?"rgba(248, 250, 252, 0.7)":"#64748b"),o=e?.borderColor||(n?"rgba(255, 255, 255, 0.1)":"#e2e8f0"),l=e?.cardBackgroundColor||e?.surfaceColor||(n?"#111a2e":"#ffffff"),c=n?"rgba(255, 255, 255, 0.09)":o,u=e?.primaryColor||"#2563eb",f=e?.secondaryColor||(n?"#1e293b":"#0f172a"),g=e?.accentColor||"#14b8a6",E=e?.buttonBackgroundColor||u,S=(0,fn.getAutoContrastTextColor)(E),m=e?.buttonTextColor||S,d=n?"rgba(255, 255, 255, 0.08)":f&&!(0,fn.isDarkColor)(f)?f:"#f1f5f9",p=n?"#f8fafc":"#0f172a";return{"--brand-color":u,"--brand-primary":u,"--primary-color":u,"--color-primary":u,"--brand-secondary":f,"--secondary-color":f,"--brand-accent":g,"--accent-color":g,"--page-background":r,"--page-bg":r,"--background":r,"--page-text":i,"--heading-color":e?.headingColor||(n?"#ffffff":f),"--color-heading":e?.headingColor||(n?"#ffffff":f),"--muted-text":s,"--text-muted":s,"--color-text":i,"--color-text-muted":s,"--link-color":e?.linkColor||u,"--border-primary":o,"--border":o,"--color-border":o,"--color-surface":n?"rgba(255,255,255,0.05)":"#ffffff","--card-bg":l,"--card-border":c,"--product-card-bg":l,"--product-card-border":c,"--tag-bg":n?"rgba(255, 255, 255, 0.08)":"rgba(241, 245, 249, 0.9)","--tag-color":s,"--card-shadow":n?"0 10px 25px -5px rgba(0, 0, 0, 0.4)":"0 10px 25px -5px rgba(0, 0, 0, 0.05)","--header-bg":e?.headerBackgroundColor||(n?"rgba(15, 23, 42, 0.85)":"rgba(255, 255, 255, 0.82)"),"--input-bg":n?"#1e293b":"#ffffff","--input-border":n?"rgba(255, 255, 255, 0.15)":"#cbd5e1","--input-color":i,"--button-bg":E,"--button-text":m,"--button-primary-bg":E,"--button-primary-text":m,"--button-secondary-bg":d,"--button-secondary-text":p,"--button-outline-border":n?"rgba(255, 255, 255, 0.22)":"currentColor","--button-outline-text":n?"#f8fafc":i,"--button-ghost-text":n?"#f8fafc":i,"--hero-min-height":e?.heroMinHeight||"72vh","--section-padding":e?.sectionPadding||"5rem","--base-size":e?.baseSize||"16px","--heading-font":e?.headingFont||"Inter, sans-serif","--body-font":e?.bodyFont||"Inter, sans-serif","--border-radius":e?.borderRadius||"8px","--content-align":e?.align||"left",...t}}});var Ti=F(te=>{"use strict";var Js=te&&te.__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]})),Re=te&&te.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Js(t,e,n)};Object.defineProperty(te,"__esModule",{value:!0});Re(pi(),te);Re(un(),te);Re(gi(),te);Re(hi(),te);Re(bi(),te);Re(Si(),te)});var wi=F(H=>{"use strict";var Xs=H&&H.__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]})),oe=H&&H.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Xs(t,e,n)};Object.defineProperty(H,"__esModule",{value:!0});oe(Yr(),H);oe(Xr(),H);oe(Qr(),H);oe(on(),H);oe(an(),H);oe(di(),H);oe(bt(),H);oe(cn(),H);oe(ui(),H);oe(Ti(),H)});var ma={};zi(ma,{runTemplatePreflight:()=>Ni});module.exports=Hi(ma);var vi=require("node:child_process"),_=require("node:fs/promises"),Fi=require("node:os"),k=require("node:path"),yn=Ct(Rt());var Xn=[{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 uo={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 Qn(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:fo(),seo:null}}function fo(){let e={};for(let t of Xn){e[t.key]=[];for(let n of uo[t.key]??[])e[n]||(e[n]=[])}return e}var er=Ct(Rt()),xe={maxEntries:2e3,maxEntryUncompressedBytes:25*1024*1024,maxTotalUncompressedBytes:200*1024*1024,maxCompressionRatio:100},po=new Set([".cache",".git",".next",".npm",".pnpm-store",".turbo","__macosx","node_modules"]),mo=new Set(["build","coverage","dist","out"]);function tr(e){let t;try{t=new er.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>xe.maxEntries)throw new Error(`Template ZIP contains too many entries (${t.length}; maximum ${xe.maxEntries}).`);for(let s of t){let o=rr(s.entryName);if(r.push(o),go(o))throw new Error(`Template ZIP contains an unsafe entry: ${s.entryName||"(empty path)"}.`);if(!s.isDirectory){let l=Number(s.header.size??0),c=Number(s.header.compressedSize??0);if(!Number.isSafeInteger(l)||l<0||l>xe.maxEntryUncompressedBytes)throw new Error(`Template ZIP entry is too large after extraction: ${o}.`);if(i+=l,i>xe.maxTotalUncompressedBytes)throw new Error(`Template ZIP expands beyond the ${xe.maxTotalUncompressedBytes/(1024*1024)} MB limit.`);if(l>1024*1024&&l/Math.max(1,c)>xe.maxCompressionRatio)throw new Error(`Template ZIP entry has an unsafe compression ratio: ${o}.`)}(!s.isDirectory&&Je(o)||s.isDirectory&&Je(o))&&n.add(o)}return{entries:r,forbiddenEntries:[...n]}}function nr(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 rr(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function go(e){let t=ir(e);return!e||e.includes("\0")||e.startsWith("/")||/^[a-z]:\//i.test(e)||t.includes("..")}function Je(e){let t=rr(e),n=ir(t),r=n.at(-1)??"",i=n.some(S=>po.has(S)),s=n[0]===".yarn"&&n[1]==="cache",o=n.some(S=>mo.has(S)),l=n.some(S=>S===".deneb"||S.startsWith(".deneb-backup")),c=r===".env"||r.startsWith(".env."),u=r.endsWith(".zip"),f=r.endsWith(".log"),g=r.endsWith(".tsbuildinfo");return i||s||o||l||c||u||f||g||(r===".ds_store"||r==="thumbs.db")}function ir(e){return e.split("/").map(t=>t.trim().toLowerCase()).filter(Boolean)}var ho={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"}},yo=new Set(["text","textarea","email","tel","url","image","number","boolean","select"]),Eo={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 sr(e){if(!e||typeof e!="object")return null;let t=e,r=(Array.isArray(t.sections)?t.sections:[]).map(i=>bo(i)).filter(i=>!!i);return r.length===0?null:{version:typeof t.version=="number"&&Number.isFinite(t.version)?t.version:1,sections:r}}function ar(e,t=[]){let n=new Map(t.map(i=>[i.id,i.label]));return{version:1,sections:Object.entries(e).map(([i,s])=>To(i,s,n)).filter(i=>!!i)}}function Oe(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?Nt(o,s):s)}let n=[...t.values()],r=n.map(s=>s.path),i=n.map(s=>{let l=n.filter(u=>nt(s.path,u.path)).sort((u,f)=>or(f.path)-or(u.path)).map(u=>pr({...e,sections:[u]},s.path)).filter(u=>!!u).reduce((u,f)=>Nt(u,f),s),c=new Set(r.filter(u=>u!==s.path&&nt(u,s.path)));return Dt(l,c)}).filter(s=>!!s);return{...e,sections:i}}function rt(e){if(!e)return[];let t=new Map,n=[],r=new Set,i=(o,l,c)=>{let u=ne(o),f=t.get(u);if(!f){t.set(u,{kind:l,sectionId:c});return}r.has(u)||(r.add(u),n.push({path:u,firstKind:f.kind,duplicateKind:l,firstSectionId:f.sectionId,duplicateSectionId:c}))},s=(o,l,c)=>{if(l.type==="object"){for(let u of l.fields??[])s(ye(o,u.key),u,c);return}if(l.type==="list"){let u=ne(o);i(u,"list",c);let f=`${u}[*]`;l.itemField&&i(f,"field",c);for(let g of l.fields??[])s(ye(f,g.key),g,c);return}i(o,"field",c)};for(let o of e.sections)s(o.path,o,o.id);return n}function Lt(e,t){if(!e)return Oe(t);if(!t)return Oe(e);let n=Oe(e)??e,r=Oe(t)??t,i=n.sections.map(c=>c.path),s=n.sections.map(c=>{let u=pr(r,c.path);if(!u)return c;let f=new Set(i.filter(E=>E!==c.path&&nt(E,c.path))),g=Dt(u,f);return g?Nt(c,g):c}),o=new Set(n.sections.map(({path:c})=>c)),l=r.sections.filter(c=>!o.has(c.path)).map(c=>Dt(c,new Set(i.filter(u=>nt(u,c.path))))).filter(c=>!!c);return Oe({...t,...e,sections:[...s,...l]})}function lr(e){return e?Lt(e,Eo):null}function bo(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.id),r=z(t.path),i=z(t.label),s=dr(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:Mt(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),pageKey:z(t.pageKey)||void 0,...Ot(t.sharedFieldKey)};if(s==="object"){let l=Qe(t.fields);return{...o,type:s,fields:l}}if(s==="list"){let l=Qe(t.fields),c=cr(t.itemField);return l.length===0&&!c?null:{...o,type:s,fields:l.length>0?l:void 0,itemField:c??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:et(t.minItems),maxItems:et(t.maxItems)}}return{...o,type:s,options:s==="select"?$t(t.options):void 0}}function Dt(e,t){if(t.has(e.path))return null;if(e.type==="object"){let n=(e.fields??[]).map(r=>Xe(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=>Xe(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 Xe(e,t,n){let r=ye(t,e.key);if(n.has(r))return null;if(e.type==="object"){let i=e.fields.map(s=>Xe(s,r,n)).filter(s=>!!s);return i.length===0?null:{...e,fields:i}}if(e.type==="list"){let i=(e.fields??[]).map(s=>Xe(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=>So(t)).filter(t=>!!t):[]}function So(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.key),r=z(t.label),i=dr(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:Mt(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),...Ot(t.sharedFieldKey)};if(i==="object")return{...s,type:i,fields:Qe(t.fields)};if(i==="list"){let o=Qe(t.fields),l=cr(t.itemField);return o.length===0&&!l?null:{...s,type:i,fields:o.length>0?o:void 0,itemField:l??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:et(t.minItems),maxItems:et(t.maxItems)}}return{...s,type:i,options:i==="select"?$t(t.options):void 0}}function cr(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.label),r=ur(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:Mt(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),...Ot(t.sharedFieldKey),options:r==="select"?$t(t.options):void 0}}function Ot(e){return typeof e=="string"&&e.trim()?{sharedFieldKey:e.trim()}:{}}function $t(e){if(!Array.isArray(e))return;let t=e.map(n=>z(n)).filter(n=>!!n);return t.length>0?t:void 0}function Mt(e){return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<=1e4?e:void 0}function fe(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function et(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:void 0}function dr(e){return e==="object"?e:e==="list"||e==="array"?"list":ur(e)}function ur(e){return typeof e=="string"&&yo.has(e)?e:null}function To(e,t,n){let r=ho[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,l=(o?n.get(o):void 0)||r?.label||hr(e);return Array.isArray(t)?wo(e,l,o,t):Ee(t)?{id:e,path:e,label:l,pageKey:o,type:"object",fields:Object.entries(t).map(([c,u])=>it(c,u))}:{id:e,path:e,label:l,pageKey:o,...ot(e,t)}}function it(e,t){let n=hr(e);return Array.isArray(t)?Po(e,n,t):Ee(t)?{key:e,label:n,type:"object",fields:Object.entries(t).map(([r,i])=>it(r,i))}:{key:e,label:n,...ot(e,t)}}function wo(e,t,n,r){let i=mr(r),s=yr(t);return Ee(i)?{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,fields:Object.entries(i).map(([o,l])=>it(o,l))}:{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,itemField:{label:s,...ot(e,i)}}}function Po(e,t,n){let r=mr(n),i=yr(t);return Ee(r)?{key:e,label:t,type:"list",itemLabel:i,fields:Object.entries(r).map(([s,o])=>it(s,o))}:{key:e,label:t,type:"list",itemLabel:i,itemField:{label:i,...ot(e,r)}}}function Nt(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:tt(e.fields??[],t.fields??[])};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:fr(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 tt(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?Io(i,s):i}),...n.values()]}function Io(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:tt(e.fields,t.fields)};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:fr(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 fr(e,t){return e?!t||e.type!==t.type?e:{...t,...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}:t}function pr(e,t){let n=(i,s,o)=>{let{key:l,...c}=i;return{...c,id:o.id,path:s,pageKey:o.pageKey}},r=(i,s,o)=>{if(ne(s)===ne(t))return n(i,s,o);if(i.type==="object")for(let l of i.fields){let c=r(l,ye(s,l.key),o);if(c)return c}if(i.type==="list"){let l=`${ne(s)}[*]`;for(let c of i.fields??[]){let u=r(c,ye(l,c.key),o);if(u)return u}}return null};for(let i of e.sections){if(ne(i.path)===ne(t))return i;if(i.type==="object")for(let s of i.fields??[]){let o=r(s,ye(i.path,s.key),i);if(o)return o}if(i.type==="list"){let s=`${ne(i.path)}[*]`;for(let o of i.fields??[]){let l=r(o,ye(s,o.key),i);if(l)return l}}}return null}function nt(e,t){let n=ne(e),r=ne(t);return n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function ne(e){return e.replace(/\[\d+\]/g,"[*]").trim()}function or(e){return ne(e).split(/\.|\[/).filter(Boolean).length}function mr(e){let t=e.filter(Ee);return t.length===0?e.find(n=>n!=null):t.reduce((n,r)=>gr(n,r),{})}function gr(e,t){let n={...e};for(let[r,i]of Object.entries(t)){let s=n[r];if(Ee(s)&&Ee(i)){n[r]=gr(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 ot(e,t){let n=xo(e,t);if(n!=="image"||typeof t!="string"||!t.trim())return{type:n};try{let r=new URL(t,"https://fivora-template.invalid"),i=fe(Number(r.searchParams.get("w")??r.searchParams.get("width"))),s=fe(Number(r.searchParams.get("h")??r.searchParams.get("height")));return{type:n,...i?{recommendedWidth:i}:{},...s?{recommendedHeight:s}:{}}}catch{return{type:n}}}function xo(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 ye(e,t){return e?`${e}.${t}`:t}function z(e){return typeof e=="string"?e.trim():""}function Ee(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function hr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function yr(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 Co=["primary","secondary","accent","background","text","surface","surfaceAlt","heading","mutedText","border","headerBackground","footerBackground","cardBackground","buttonBackground","buttonText"],_o=["headingFont","bodyFont","baseSize","headingScale","bodyLineHeight","headingLineHeight","headingWeight","bodyWeight","letterSpacing"],Ao=["heroMinHeight","sectionPadding","contentMaxWidth","containerPadding","sectionGap","elementGap","gridGap"],ko=["textAlign","contentAlign","heroTextAlign","cardTextAlign","gridColumns"],vo=["cardWidth","cardMinHeight","cardPadding","cardRadius","cardBorderWidth","cardShadow","buttonPadding","buttonRadius","buttonShadow","imageRadius","headerHeight"],Fo=["backgroundColor","textColor","headingColor","minHeight","padding","contentMaxWidth","gap","textAlign","contentAlign","cardBackgroundColor","cardWidth","cardMinHeight","cardRadius","gridColumns"],Ro=["fontFamily","fontSize","lineHeight","fontWeight","letterSpacing","color","backgroundColor","textAlign","width","height","minWidth","minHeight","maxWidth","maxHeight","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius"];function ie(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Do(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 Er(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 No(e){if(!ie(e))return;let t={};for(let[n,r]of Object.entries(e).slice(0,64)){if(typeof r!="string")continue;let i=Er(n),s=Er(r);!i||!s||(t[i]=s)}return Object.keys(t).length>0?t:void 0}function be(e,t){if(!ie(e))return;let n={};for(let r of t){if(typeof e[r]!="string")continue;let i=Do(e[r]);i!==void 0&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function Lo(e){return/^[a-zA-Z0-9_-]{1,64}$/.test(e)}function Oo(e){return/^[a-zA-Z0-9_.:\[\]-]{1,180}$/.test(e)}function $o(){return{version:1}}function Mo(e){if(!ie(e))return $o();let t=be(e.colors,Co),n=No(e.colorReplacements),r=be(e.typography,_o),i=be(e.spacing,Ao),s=be(e.layout,ko),o=be(e.components,vo),l={};if(ie(e.sections))for(let[u,f]of Object.entries(e.sections)){if(!Lo(u)||!ie(f))continue;let E={...be(f,Fo)??{}};typeof f.visible=="boolean"&&(E.visible=f.visible),Object.keys(E).length>0&&(l[u]=E)}let c={};if(ie(e.elementStyles))for(let[u,f]of Object.entries(e.elementStyles).slice(0,256)){if(!Oo(u)||!ie(f))continue;let g=be(f,Ro);g&&Object.keys(g).length>0&&(c[u]=g)}return{version:1,...t?{colors:t}:{},...n?{colorReplacements:n}:{},...r?{typography:r}:{},...i?{spacing:i}:{},...s?{layout:s}:{},...o?{components:o}:{},...Object.keys(l).length>0?{sections:l}:{},...Object.keys(c).length>0?{elementStyles:c}:{}}}function br(e){if(!ie(e))return null;let t=e.themeSchema;if(!ie(t))return null;let n=Mo(ie(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 Bo=e=>new Error(e),jo=new Set(["npm install","npm ci","pnpm install","pnpm install --frozen-lockfile","yarn install","yarn install --frozen-lockfile"]),Vo=new Set(["npm run build","pnpm run build","yarn build","yarn run build"]);function Tr(e,t=Bo){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=Uo(r.visualEditing,i,t),o=sr(r.editorSchema),l=br(r),c=Array.isArray(r.colorPalette)?r.colorPalette.filter(E=>!!E&&typeof E=="object").flatMap(E=>{let S=typeof E.color=="string"?E.color.trim().toLowerCase():"";if(!/^#[0-9a-f]{6}$/.test(S))return[];let m=typeof E.usageCount=="number"&&Number.isFinite(E.usageCount)?Math.max(1,Math.floor(E.usageCount)):1;return[{color:S,usageCount:m}]}).slice(0,40):[],u=rt(o);if(u.length>0){let E=u.slice(0,5).map(S=>`"${S.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 f=Sr(r.installCommand,jo,"installCommand",n),g=Sr(r.buildCommand,Vo,"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 S=typeof E.id=="string"&&E.id.trim()?E.id.trim():null,m=typeof E.label=="string"&&E.label.trim()?E.label.trim():null;return!S||!m?n("Each template manifest page must include id and label."):{id:S,label:m,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,...l?{themeSchema:l}:{},...c.length>0?{colorPalette:c}:{},outputDirectory:typeof r.outputDirectory=="string"?r.outputDirectory.trim():void 0,installCommand:f,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 Sr(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 Uo(e,t,n){let r=l=>{throw n(l)};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(l=>typeof l=="string").map(l=>l.trim()).filter(Boolean):[];return{contractVersion:1,mode:s,controlOnlyPaths:o.length>0?o:void 0}}var zo={"data-preview-field-path":"field","data-preview-list-path":"list","data-preview-item-path":"item","data-preview-page-key":"page"},wr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*`([\s\S]*?)`\s*\}|\{\s*"([^"]*)"\s*\}|\{\s*'([^']*)'\s*\})/g,Pr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=/g,Ir=String.raw`[^.[\]\s]+`,Ho=new RegExp(String.raw`^${Ir}(?:\[(?:\d+|\*)\])*(?:\.${Ir}(?:\[(?:\d+|\*)\])*)*$`),qo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Wo=new Set(["head","script","style","noscript","svg","template"]),xr=new Set(["html","body","main","header","footer","nav","section","article","aside","form","div","ul","ol","table","thead","tbody","tfoot","tr"]),st="FIVORA_PREVIEW_SITE_DATA",kr=`${["MARKET","PLACE"].join("")}_PREVIEW_`,at=`${kr}SITE_DATA`;var lt="FIVORA_PREVIEW_READY",Bt=`${kr}READY`,Go=lt;function Ht(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))Gt(i,r,n);for(let r of t?.sections??[])Zt(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 Yt(e,t){let n=Dr(e??{});for(let r of t?.sections??[])Yo(n,r.path,r);return n}function vr(e,t){let n=structuredClone(e??{});for(let r of t?.sections??[])Zo(n,r.path,r);return Wt(n,"")}function mt(e){let t=[],n=[];for(let r of e){let i=new Set;wr.lastIndex=0;for(let s of r.content.matchAll(wr)){let o=s[1],l=s[2]??s[3]??s[4]??s[5]??s[6]??"",c=s.index??0;i.add(c),t.push({kind:zo[o],value:Te(l).trim(),filePath:r.filePath,artifactKind:r.kind,offset:c,line:U(r.content,c)})}Pr.lastIndex=0;for(let s of r.content.matchAll(Pr)){let o=s.index??0;i.has(o)||n.push(`${r.filePath}:${U(r.content,o)} ${s[1]} must use a literal string or a JSX template literal.`)}}return{markers:t,unparseableAttributes:n}}function Fr(e){let t=e.manifestVersion>=2||e.visualEditing?.mode==="strict"?"strict":"legacy",n=[],r=[],i=Ht(e.contentDefaults,e.editorSchema),s=mt(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."),ms(e.editorSchema,n),gs(e.editorSchema,n),es(e.editorSchema,n,e.pages),ts(e.editorSchema,e.contentDefaults,n),rs(e.artifacts,n),is(e.artifacts,n),os(e.artifacts,e.contentDefaults,e.editorSchema,n),r.push(...s.unparseableAttributes.map(T=>`${T} Exported exact markers may still satisfy strict coverage.`));let l=J(o,"field",n),c=J(o,"list",n),u=J(o,"item",n),f=o.filter(T=>T.artifactKind==="html"),g=J(f,"field",n),E=J(f,"list",n),S=J(f,"item",n),m=o.filter(T=>T.artifactKind==="source"),d=J(m,"field",n),p=J(m,"list",n),h=J(m,"item",n),b=Nr(e.visualEditing?.controlOnlyPaths??[],i,n);Vt({label:"editable field",expectedPatterns:i.fieldPatterns,concretePaths:i.concreteFields,htmlMarkerPaths:g,sourceMarkerPaths:d,controlOnlyPaths:b,findings:n}),Vt({label:"editable list",expectedPatterns:i.listPatterns,concretePaths:i.concreteLists,htmlMarkerPaths:E,sourceMarkerPaths:p,controlOnlyPaths:[],findings:n}),Vt({label:"editable list item",expectedPatterns:i.itemPatterns,concretePaths:i.concreteItems,htmlMarkerPaths:S,sourceMarkerPaths:h,controlOnlyPaths:[],findings:n}),Ut("field",l,i.fieldPatterns,i.concreteFields,n),Ut("list",c,i.listPatterns,i.concreteLists,n),Ut("item",u,i.itemPatterns,i.concreteItems,n),Lr(e.manifestVersion,e.pages??[],o,e.artifacts,n),Or({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:b,findings:n});let a=ss(e.artifacts,e.pages??[]);t==="strict"?n.push(...a):r.push(...a);let y=G(n),w=G(r);return t==="legacy"?{mode:t,errors:[],warnings:G([...y.map(T=>`[legacy] ${T}`),...w]),inventory:i,markers:o}:{mode:t,errors:y,warnings:w,inventory:i,markers:o}}function Rr(e){let t=[],n=[],r=Ht(e.contentDefaults,e.editorSchema),i=Yt(e.contentDefaults,e.editorSchema),s=Ht(i,e.editorSchema),o=G([...r.fieldPatterns.filter(d=>!d.includes("[*]")),...s.concreteFields]),l=G([...r.listPatterns.filter(d=>!d.includes("[*]")),...s.concreteLists]),c=s.concreteItems,u=e.artifacts.filter(d=>d.kind==="html"),f=mt(u),g=J(f.markers,"field",t),E=J(f.markers,"list",t),S=J(f.markers,"item",t),m=Nr(e.visualEditing?.controlOnlyPaths??[],r,t);jt({markerPaths:g,expectedPaths:s.concreteFields,knownPatterns:r.fieldPatterns,attribute:"field",findings:t}),jt({markerPaths:E,expectedPaths:s.concreteLists,knownPatterns:r.listPatterns,attribute:"list",findings:t}),jt({markerPaths:S,expectedPaths:s.concreteItems,knownPatterns:r.itemPatterns,attribute:"item",findings:t});for(let d of o)ft(d,m)||g.includes(d)||t.push(`Empty-state export removed data-preview-field-path="${d}". Keep the editable target mounted when its value is empty, false, or zero.`);for(let d of l)E.includes(d)||t.push(`Empty-state export removed data-preview-list-path="${d}". Keep the list container mounted when the list has no items.`);for(let d of c)S.includes(d)||t.push(`Empty-state export removed data-preview-item-path="${d}" required by minItems/required list validation.`);return Lr(e.manifestVersion,e.pages??[],f.markers,u,t),Or({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:f.markers,fieldPaths:o,listPaths:l,itemPaths:c,controlOnlyPaths:m,findings:t}),n.push(...f.unparseableAttributes),{errors:G(t),warnings:G(n),requiredFieldPaths:o,requiredListPaths:l,requiredItemPaths:c}}function jt(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(Z(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 Zo(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 l=i[o];Q(l)||(i[o]={}),i=i[o]}let s=r.at(-1);qt(i,s,n,t)}function qt(e,t,n,r){if(n.type==="list"){let i=Array.isArray(e[t])?[...e[t]]:[],s=Se(n.maxItems),o=Math.min(s??Number.MAX_SAFE_INTEGER,s===0?0:Math.max(1,Se(n.minItems)??(n.required?1:0)));for(;i.length<o;)i.push(void 0);e[t]=i.map((l,c)=>{let u=`${r}[${c}]`;if(n.itemField)return Cr(l,n.itemField.type,u,n.itemField.options);let f=Q(l)?l:{};for(let g of n.fields??[])qt(f,g.key,g,X(u,g.key));return f});return}if(n.type==="object"){let i=Q(e[t])?e[t]:{};e[t]=i;for(let s of n.fields??[])qt(i,s.key,s,X(r,s.key));return}e[t]=Cr(e[t],n.type,r,n.options)}function Cr(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]??ct(n):t==="url"?`https://template-validation.example.invalid/${dt(n)}`:t==="image"?`/template-validation-${dt(n)}.svg`:t==="email"?"validation@example.invalid":t==="tel"?"+12025550142":ct(n)}function Wt(e,t){return Array.isArray(e)?e.map((n,r)=>Wt(n,`${t}[${r}]`)):Q(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let i=X(t,n);return[n,Wt(r,i)]})):typeof e=="string"?e.trim()?e:Ko(t):typeof e=="number"?Number.isFinite(e)&&e!==0?e:1:typeof e=="boolean"?!0:e??ct(t)}function Ko(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-${dt(e)}.svg`:t.includes("url")||t.includes("link")?`https://template-validation.example.invalid/${dt(e)}`:ct(e)}function ct(e){return`Validation ${e||"content"}`}function dt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"content"}function Dr(e){return Array.isArray(e)?[]:Q(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Dr(n)])):typeof e=="string"?"":typeof e=="number"?0:typeof e=="boolean"?!1:e}function Yo(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 l=i[o];Q(l)||(i[o]={}),i=i[o]}let s=r.at(-1);Jt(i,s,n)}function Jt(e,t,n){if(n.type==="list"){let r=Math.min(Se(n.maxItems)??Number.MAX_SAFE_INTEGER,Se(n.minItems)??(n.required?1:0));e[t]=Array.from({length:r},()=>Jo(n));return}if(n.type==="object"){let r=Q(e[t])?e[t]:{};e[t]=r;for(let i of n.fields??[])Jt(r,i.key,i);return}e[t]=n.type==="number"?0:n.type==="boolean"?!1:""}function Jo(e){if(e.itemField)return e.itemField.type==="number"?0:e.itemField.type==="boolean"?!1:"";let t={};for(let n of e.fields??[])Jt(t,n.key,n);return t}function Gt(e,t,n){if(Array.isArray(e)){let r=Z(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)?Gt(i,o,n):(n.fieldPatterns.add(Z(o)),n.concreteFields.add(o))});return}if(Q(e)){for(let[r,i]of Object.entries(e))Gt(i,X(t,r),n);return}n.fieldPatterns.add(Z(t)),n.concreteFields.add(t)}function Zt(e,t,n){if(t.type==="object"){for(let r of t.fields??[])Zt(X(e,r.key),r,n);return}if(t.type==="list"){let r=Z(e),i=`${r}[*]`;n.listPatterns.add(r),n.itemPatterns.add(i),t.itemField&&n.fieldPatterns.add(i);for(let s of t.fields??[])Zt(X(i,s.key),s,n);return}n.fieldPatterns.add(Z(e))}function J(e,t,n){let r=[];for(let i of e.filter(s=>s.kind===t)){let s=$e(i.value);if(!s){n.push(`${i.filePath}:${Br(i)} has invalid data-preview-${t}-path "${i.value}".`);continue}r.push(s)}return G(r)}function Nr(e,t,n){let r=[];for(let i of e){let s=$e(i);if(!s){n.push(`controlOnlyPaths contains invalid path "${i}".`);continue}if(![...t.fieldPatterns,...t.concreteFields].some(l=>Kt(s,l))){n.push(`controlOnlyPaths contains unknown editable field path "${s}".`);continue}r.push(s)}return G(r)}function Vt(e){for(let t of e.expectedPatterns){if(ft(t,e.controlOnlyPaths))continue;let n=e.concretePaths.filter(r=>Z(r)===t);if(!t.includes("[*]")){e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${zt(e.label)}="${t}" for ${e.label}.`);continue}e.sourceMarkerPaths.some(r=>hs(r,t))||e.findings.push(`Source is missing dynamic data-preview-${zt(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)||ft(t,e.controlOnlyPaths)||e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${zt(e.label)}="${t}" for concrete ${e.label}.`)}function Ut(e,t,n,r,i){for(let s of t)n.some(l=>Kt(s,l))||r.some(l=>Kt(s,l))||i.push(`data-preview-${e}-path references unknown path "${s}".`)}function Lr(e,t,n,r,i){let s=r.filter(f=>f.kind==="html"),o=n.filter(f=>f.kind==="page"&&f.artifactKind==="html"),l=new Set(t.map(f=>f.id)),c=new Set,u=new Map;t.length===0&&i.push("Strict visual editing requires at least one manifest pages[] entry.");for(let f of t){c.has(f.id)&&i.push(`Manifest pages[] contains duplicate id "${f.id}".`),c.add(f.id);let g=Qt(f.route)??(e<2?Mr(f.id):null);if(!g){i.push(`Manifest page "${f.id}" must declare a canonical route for strict visual editing.`);continue}let E=u.get(g);E?i.push(`Manifest pages "${E}" and "${f.id}" use duplicate route "${g}".`):u.set(g,f.id);let S=s.filter(p=>en(p.filePath,g));if(S.length===0){i.push(`Manifest page "${f.id}" route "${g}" has no exported HTML file.`);continue}let m=new Set(S.map(p=>p.filePath));o.some(p=>p.value===f.id&&m.has(p.filePath))||i.push(`Exported route "${g}" is missing data-preview-page-key="${f.id}".`)}for(let f of n.filter(g=>g.kind==="page"))l.has(f.value)||i.push(`${f.filePath}:${Br(f)} data-preview-page-key references unknown manifest page "${f.value}".`)}function Or(e){let t=(e.schema?.sections??[]).map(i=>({section:i,canonicalPath:$e(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"&&ft(o,e.controlOnlyPaths))continue;let l=t.filter(E=>Xo(o,E.canonicalPath)).sort((E,S)=>S.canonicalPath.length-E.canonicalPath.length)[0];if(!l?.section.pageKey)continue;let c=n.get(l.section.pageKey);if(!c){e.findings.push(`editorSchema section "${l.section.path}" assigns ${_r(i)} "${o}" to unknown manifest page "${l.section.pageKey}".`);continue}let u=Qt(c.route)??(e.manifestVersion<2?Mr(c.id):null);!u||!e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&$e(E.value)===o)||e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&$e(E.value)===o&&en(E.filePath,u))||e.findings.push(`Page-owned ${_r(i)} "${o}" from editorSchema section "${l.section.path}" must render data-preview-${Qo(i)}="${o}" on manifest page "${c.id}" route "${u}". Shared sections without pageKey may render globally.`)}};r("field",G(e.fieldPaths)),r("list",G(e.listPaths)),r("item",G(e.itemPaths))}function Xo(e,t){let n=Z(e),r=Z(t);return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function _r(e){return e==="field"?"editable field":e==="list"?"editable list":"editable list item"}function Qo(e){return e==="field"?"field-path":e==="list"?"list-path":"item-path"}function es(e,t,n=[]){let r=new Set(n.map(o=>o.id?.trim()).filter(o=>!!o)),i=(o,l)=>{if(!l?.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 u of l){let f=typeof u=="string"?u.trim():"";f&&f!=="none"&&f!=="external"&&!r.has(f)&&t.push(`editorSchema select field "${o}" declares destination option "${f}" which is not in fivora-template.json pages[]. Declared pages: ${[...r].join(", ")}.`)}},s=(o,l)=>{if(l.type==="select"){i(o,l.options);return}if(l.type==="object"){for(let u of l.fields??[])s(X(o,u.key),u);return}if(l.type!=="list")return;let c=`${Z(o)}[*]`;l.itemField?.type==="select"&&i(c,l.itemField.options);for(let u of l.fields??[])s(X(c,u.key),u)};for(let o of e?.sections??[])s(o.path,o)}function ts(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 l=Se(o.minItems),c=Se(o.maxItems);o.minItems!==void 0&&l===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 u=l??(o.required?1:0);c!==null&&u>c&&n.push(`editorSchema list "${s}" requires at least ${u} item${u===1?"":"s"} but maxItems is ${c}. Increase maxItems or lower minItems/required.`);let f=`${Z(s)}[*]`;for(let g of o.fields??[])r(X(f,g.key),g)},i=(s,o,l)=>{if(o.type==="object"){let f=Q(l)?l:{};for(let g of o.fields??[])i(X(s,g.key),g,f[g.key]);return}if(o.type!=="list")return;let c=Array.isArray(l)?l:[],u=Se(o.maxItems);u!==null&&c.length>u&&n.push(`site-data.json content list "${s}" contains ${c.length} items, exceeding editorSchema maxItems ${u}.`);for(let[f,g]of c.entries()){let E=Q(g)?g:{};for(let S of o.fields??[])i(X(`${s}[${f}]`,S.key),S,E[S.key])}};for(let s of e?.sections??[])r(s.path,s),i(s.path,s,ns(t??{},s.path))}function Se(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:null}function ns(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 rs(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(f=>f.exec(r.content)).find(f=>!!f),s=r.content.search(/data-preview-static/),o=/\b(?:writeFile|writeFileSync|appendFile|appendFileSync)\s*\(/m.exec(r.content),l=/\.[cm]?[jt]s$/i.test(r.filePath),c=s>=0&&l&&o;if(!i&&!c)continue;let u=i?.index??s;t.push(`${r.filePath}:${U(r.content,u)} 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 is(e,t){let n=e.filter(S=>S.kind==="source"),r=n.map(S=>S.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(st)||r.includes(at),o=r.includes(lt)||r.includes(Bt),l=/(?: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),u=n.some(S=>{let m=S.content,d=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(m)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(m),p=/\bset[A-Z_$][\w$]*\s*\(/m.test(m)||/\bdispatch\s*\(/m.test(m)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(m);return(m.includes(st)||m.includes(at))&&d&&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(S=>(S.content.includes(lt)||S.content.includes(Bt))&&/\bpostMessage\s*\(/m.test(S.content));s||t.push(`Preview runtime source must implement the "${st}" (or legacy "${at}") 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 "${lt}" (or legacy "${Bt}") protocol so the editor can wait for a live preview before sending data.`),(!l||!c||!u)&&t.push(`Preview runtime source must handle "${st}" (or legacy "${at}") 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 "${Go}" after its live-data listener is ready.`)}function os(e,t,n,r){let i=e.filter(S=>S.kind==="source"),s=[/\/products\/\$\{/m,/['"`]\/products\/['"`]\s*\+\s*(?:encodeURIComponent\s*\()?/m];for(let S of i){let m=s.map(d=>d.exec(S.content)).find(d=>!!d);m&&r.push(`${S.filePath}:${U(S.content,m.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(S=>S.path==="products"||S.path.startsWith("products["))||i.some(S=>/data-preview-(?:list|item|field)-path\s*=\s*(?:["']products|\{\s*`products)/m.test(S.content)),l=i.some(S=>/\bplatformProductDetailHref\s*\(/m.test(S.content)||/\/products\/detail\/?\?[^'"`\s}]*\bid=/m.test(S.content)),c=i.some(S=>/(?:^|\/)src\/(?:app\/products\/detail\/page|pages\/products\/detail)\.[cm]?[jt]sx?$/i.test(S.filePath.replace(/\\/g,"/"))||/\b(?:PlatformProductDetail|usePlatformProductDetail)\b/m.test(S.content)),u=i.some(S=>/(?:^|\/)src\/(?:app\/products\/\[[^/]+\]\/page|pages\/products\/\[[^/]+\])\.[cm]?[jt]sx?$/i.test(S.filePath.replace(/\\/g,"/"))),f=i.some(S=>/\brenderProduct\s*=/m.test(S.content)||/\busePlatformProductDetail\s*\(/m.test(S.content)),g=l||c||o&&u;if(g&&!l&&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&&u&&c&&!f&&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(S=>S.kind==="html"&&/(?:^|\/)products\/detail\/(?:index\.)?html$/i.test(S.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 ss(e,t){let n=[];for(let r of e.filter(i=>i.kind==="html"&&!as(i.filePath,t)))n.push(...ls(r));return n}function as(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");return/^(?:404|500|_error|_not-found)(?:\/index)?\.html$/i.test(n)?!t.some(i=>{let s=Qt(i.route);return s?en(n,s):!1}):!1}function ls(e){let t=[],n=[],r=e.content.matchAll(/<!--[\s\S]*?-->|<![^>]*>|<\/?[^>]+>|[^<]+/g);for(let i of r){let s=i[0],o=i.index??0,l=n.at(-1);if(s.startsWith("<!--")||s.startsWith("<!"))continue;if(s.startsWith("</")){let u=s.slice(2,-1).trim().split(/\s+/)[0]?.toLowerCase(),f=n.map(g=>g.tag).lastIndexOf(u);f>=0&&(t.push(...cs(e,n[f])),n.splice(f));continue}if(s.startsWith("<")){let u=s.match(/^<\s*([a-zA-Z0-9:-]+)/);if(!u)continue;let f=u[1].toLowerCase(),g=/\bdata-preview-field-path\s*=/.test(s),E=/\bdata-preview-list-path\s*=/.test(s),S=/\bdata-preview-item-path\s*=/.test(s),m=g||E||S;if(g)for(let T of n)T.ownsFieldMarker&&(T.hasNestedFieldMarker=!0);let d=s.match(/\bdata-preview-static\s*=\s*(?:"([^"]*)"|'([^']*)')/),p=!!d;p&&!(d?.[1]??d?.[2]??"").trim()&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static requires a reason.`),m&&(p||l?.staticCovered)&&t.push(`${e.filePath}:${U(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&&xr.has(f)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-field-path cannot be placed on broad <${f}> content containers. Put the marker on the exact visible text, media, link, or control that the field edits.`),p&&xr.has(f)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static cannot cover a broad <${f}> content container. Mark only the smallest genuinely non-editable element.`);let h=!!l?.hidden||ps(s,f);m&&h&&t.push(`${e.filePath}:${U(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 b=s.match(/\bdata-preview-field-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null,a=s.match(/\bdata-preview-item-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null;a&&l?.itemPath&&!Ar(a,l.itemPath)&&t.push(`${e.filePath}:${U(e.content,o)} repeated item "${a}" is nested inside unrelated item "${l.itemPath}". One visual card must be one object-list item; do not couple parallel arrays by index.`);let y=a??l?.itemPath??null;b&&y&&/\[\d+\]/.test(b)&&!Ar(b,y)&&t.push(`${e.filePath}:${U(e.content,o)} repeated field "${b}" is rendered inside item "${y}" 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:f,ignored:!!l?.ignored||Wo.has(f),hidden:h,fieldCovered:!!l?.fieldCovered||g,staticCovered:!!l?.staticCovered||p,ownsFieldMarker:g,hasNestedFieldMarker:!1,fieldPath:b,itemPath:y,shopAttributeValues:ds(s,f),visibleTextParts:[],offset:o};if(!w.ignored&&!w.fieldCovered&&!w.staticCovered){let T=fs(e,s,f,o);t.push(...T),f==="img"&&!w.hidden&&T.length===0&&t.push(`${e.filePath}:${U(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.`)}!qo.has(f)&&!/\/\s*>$/.test(s)&&n.push(w);continue}let c=Xt(s);if(ut(c))for(let u of n)u.ownsFieldMarker&&u.visibleTextParts.push(c);l?.ignored||l?.fieldCovered||l?.staticCovered||ut(c)&&t.push(`${e.filePath}:${U(e.content,o)} visible text "${pt(c,72)}" is not covered by data-preview-field-path or data-preview-static.`)}return t}function Ar(e,t){let n=Te(e).trim(),r=Te(t).trim();return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function cs(e,t){if(!t.ownsFieldMarker||t.hasNestedFieldMarker||t.shopAttributeValues.length===0)return[];let n=Xt(t.visibleTextParts.join(" "));return!ut(n)||t.shopAttributeValues.some(r=>us(r,n))?[]:[`${e.filePath}:${U(e.content,t.offset)} data-preview-field-path="${t.fieldPath??""}" cannot cover both <${t.tag}> action/media attributes and different visible text "${pt(n,72)}". Put the action/media marker on the element and the label marker on an exact nested text element.`]}function ds(e,t){return[...e.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)].map(n=>({name:n[1].toLowerCase(),value:Te(n[2]??n[3]??"").trim()})).filter(({name:n,value:r})=>$r(t,n,r)).map(({value:n})=>n)}function us(e,t){let n=r=>Te(r).replace(/^(?:mailto:|tel:|sms:|https?:\/\/)/i,"").replace(/^www\./i,"").replace(/\/+$/g,"").replace(/\s+/g,"").toLowerCase();return n(e)===n(t)}function fs(e,t,n,r){let i=[],s=[...t.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)];for(let f of s){let g=f[1].toLowerCase(),E=Te(f[2]??f[3]??"").trim();$r(n,g,E)&&i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(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)],l=t.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i),c=(l?.[1]??l?.[2]??"").toLowerCase();for(let f of o){let g=f[1].toLowerCase(),E=Xt(f[2]??f[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))||!ut(E)||i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let u=t.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i);return u&&/(?:background|background-image)\s*:[^;]*url\(/i.test(u[1]??u[2]??"")&&i.push(`${e.filePath}:${U(e.content,r)} background image is not covered by data-preview-field-path or data-preview-static.`),i}function ps(e,t){let n=e.replace(/="[^"]*"|='[^']*'/g,'=""');if(/(?<![\w-])hidden(?:[\s=]|\/?>)/i.test(n)||/\baria-hidden\s*=\s*(?:"true"|'true')/i.test(e))return!0;if(t==="input"){let s=e.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i);if((s?.[1]??s?.[2]??"").trim().toLowerCase()==="hidden")return!0}let r=e.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i),i=r?.[1]??r?.[2]??"";return/\bdisplay\s*:\s*none\b/i.test(i)||/\bvisibility\s*:\s*hidden\b/i.test(i)}function ms(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 gs(e,t){for(let n of rt(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 $r(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 Xt(e){return Te(e).replace(/\s+/g," ").trim()}function ut(e){return e.length<=2||!new RegExp("\\p{L}","u").test(e)?!1:!/^(?:true|false|null|undefined)$/i.test(e)}function zt(e){return e==="editable field"?"field-path":e==="editable list"?"list-path":"item-path"}function hs(e,t){return t.includes("[*]")?e.includes("[*]")&&e===t:e===t}function Kt(e,t){return Z(e)===Z(t)}function ft(e,t){return t.some(n=>n.includes("[*]")?Z(e)===n:e===n)}function $e(e){let t=e.trim().replace(/\[\s*\$\{[^}]+\}\s*\]/g,"[*]").replace(/\[\s+/g,"[").replace(/\s+\]/g,"]");return Ho.test(t)?t:null}function Z(e){return e.replace(/\[\d+\]/g,"[*]")}function X(e,t){return e?`${e}.${t}`:t}function Qt(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 Mr(e){return e==="home"?"/":`/${e}`}function en(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 Te(e){return e.replace(/&quot;/gi,'"').replace(/&#39;|&#x27;/gi,"'").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&nbsp;/gi," ")}function Br(e){return e.line}function U(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 pt(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}\u2026`}function Vr(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 jr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ys(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 Ur(e,t=[]){let r=(jr(e)&&Array.isArray(e.pages)?e.pages:[]).flatMap((s,o)=>{if(!jr(s)||typeof s.id!="string"||!s.id.trim())return[];let l=s.id.trim(),c=typeof s.label=="string"&&s.label.trim()?s.label.trim():l.replace(/_/g," ");return[{id:l,label:c,route:ys(typeof s.route=="string"?s.route:"",l,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 zr(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],l=e.basePath?.replace(/\/+$/g,"")||"",u=`/${(l&&(o===l||o.startsWith(`${l}/`))?o.slice(l.length)||"/":o).replace(/\/index\.html$/i,"/").replace(/\.html$/i,"").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"")}`,f=u==="/"?"/":u,g=n.find(E=>{let S=E.route==="/"?"/":`/${E.route.replace(/^\/+|\/+$/g,"")}`;return S==="/"?f==="/":f===S||f.startsWith(`${S}/`)});g&&r.push({pageId:g.id,route:g.route,href:o})}return r}function Hr(e){let t=[],n=new Set(["router","navigation"]),r=new Set(["useRouter"]),i=new Set(["Link"]),s=d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=d=>{let p=d.replace(/\s+/g," ").trim();return p.length>180?`${p.slice(0,177)}...`:p},l=(d,p,h)=>{let b=1,a=null,y=!1,w=!1,T=!1;for(let P=d;P<e.length;P+=1){let x=e[P],v=e[P+1];if(w){x===`
4
- `&&(w=!1);continue}if(T){x==="*"&&v==="/"&&(T=!1,P+=1);continue}if(a){y?y=!1:x==="\\"?y=!0:x===a&&(a=null);continue}if(x==="/"&&v==="/"){w=!0,P+=1;continue}if(x==="/"&&v==="*"){T=!0,P+=1;continue}if(x==="'"||x==='"'||x==="`"){a=x;continue}if(x===p)b+=1;else if(x===h&&(b-=1,b===0))return e.slice(d,P)}return e.slice(d,Math.min(e.length,d+4e3))},c=d=>{let p=a=>a.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g," ").replace(/`(?:\\.|[^`\\])*`/g," ").replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/[^\r\n]*/g," "),h=[...d.matchAll(/\$\{([\s\S]*?)\}/g)].map(a=>p(a[1])).join(" "),b=p(d);return/\b(?:[A-Za-z_$][\w$]*\s*\.\s*)*[A-Za-z_$][\w$]*(?:base_?path|path_?base)[\w$]*\b/i.test(`${b} ${h}`)},u=(d,p)=>{t.push({line:e.slice(0,d).split(/\r?\n/).length,expression:o(p),offset:d})};for(let d of e.matchAll(/\bimport\s*\{([^}]*)\}\s*from\s*['"]next\/(?:navigation|router)['"]/g))for(let p of d[1].split(",")){let h=p.trim().match(/^useRouter(?:\s+as\s+([A-Za-z_$][\w$]*))?$/)?.[1];h&&r.add(h)}let f=[...r].map(s).join("|"),g=new RegExp(`\\b(?:const|let|var)\\s+([A-Za-z_$][\\w$]*)\\s*(?::[^=;]+)?=\\s*(?:${f})\\s*\\(`,"g");for(let d of e.matchAll(g))n.add(d[1]);for(let d of e.matchAll(/\bimport\s+([^;]{0,300}?)\s+from\s*['"]next\/link['"]/g)){let p=d[1].trim(),h=p.match(/^([A-Za-z_$][\w$]*)/i)?.[1];h&&h!=="type"&&i.add(h);for(let b of p.matchAll(/\bdefault\s+as\s+([A-Za-z_$][\w$]*)/g))i.add(b[1])}for(let d of e.matchAll(/\b([A-Za-z_$][\w$]*)\s*\.\s*(push|replace|prefetch)\s*\(/g)){let p=d[1];if(!n.has(p)&&!/(?:router|navigation)/i.test(p))continue;let h=l((d.index??0)+d[0].length,"(",")");c(h)&&u(d.index??0,`${p}.${d[2]}(${h})`)}let E=new RegExp(`\\b(?:${f})\\s*\\(\\s*\\)\\s*\\.\\s*(push|replace|prefetch)\\s*\\(`,"g");for(let d of e.matchAll(E)){let p=l((d.index??0)+d[0].length,"(",")");c(p)&&u(d.index??0,`${d[0]}${p})`)}let S=[...i].map(s).join("|"),m=new RegExp(`<(${S})\\b[^>]{0,2000}?\\bhref\\s*=\\s*\\{`,"g");for(let d of e.matchAll(m)){let p=l((d.index??0)+d[0].length,"{","}");c(p)&&u(d.index??0,`<${d[1]} href={${p}}>`)}return t.sort((d,p)=>d.offset-p.offset).filter((d,p,h)=>p===0||d.offset!==h[p-1].offset).map(({line:d,expression:p})=>({line:d,expression:p}))}var wt=Ct(wi());function Pi(e){let t=[],n=new Set;for(let s of e.artifacts)if(s.kind==="html")for(let o of(0,wt.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,wt.validateStyleTree)(i,n.size>0?n:void 0)),t}var De="deneb-template-validator",xt="1.0.0",Pt="fivora-template.json",Ri=2500,Di=12*1024*1024,En="/uploads/generated-sites/template-preview/simulation",Qs=`https://fivora.example.invalid${En}/`,ea={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",NPM_CONFIG_PREFER_OFFLINE:"true",npm_config_prefer_offline:"true",NPM_CONFIG_AUDIT:"false",npm_config_audit:"false",NPM_CONFIG_FUND:"false",npm_config_fund:"false",NPM_CONFIG_UPDATE_NOTIFIER:"false",npm_config_update_notifier:"false",NPM_CONFIG_PROGRESS:"false",npm_config_progress:"false",PNPM_CONFIG_IGNORE_SCRIPTS:"true",YARN_IGNORE_SCRIPTS:"true",YARN_PRODUCTION:"false"},gn=class{constructor(t,n){this.options=t;this.report={validator:De,version:xt,command:t.command,input:(0,k.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}
5
- `);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} (${ki(Date.now()-i)})
2
+ var Mi=Object.create;var We=Object.defineProperty;var Bi=Object.getOwnPropertyDescriptor;var ji=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var F=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},zi=(e,t)=>{for(var n in t)We(e,n,{get:t[n],enumerable:!0})},bn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ji(t))!Ui.call(e,i)&&i!==n&&We(e,i,{get:()=>t[i],enumerable:!(r=Bi(t,i))||r.enumerable});return e};var Ct=(e,t,n)=>(n=e!=null?Mi(Vi(e)):{},bn(t||!e||!e.__esModule?We(n,"default",{value:e,enumerable:!0}):n,e)),Hi=e=>bn(We({},"__esModule",{value:!0}),e);var kt=F((ya,Sn)=>{Sn.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 Ge=F(wn=>{var Tn={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 qi(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(Tn))wn[e]=qi(Tn[e])});var kn=F((ba,Cn)=>{var Wi=require("fs"),j=require("path"),Pn=kt(),Gi=Ge(),Zi=typeof process=="object"&&process.platform==="win32",In=e=>typeof e=="object"&&e!==null,xn=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 $(e){this.sep=j.sep,this.fs=Wi,In(e)&&In(e.fs)&&typeof e.fs.statSync=="function"&&(this.fs=e.fs)}Cn.exports=$;$.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 Gi.FILE_IN_THE_WAY(`"${i}"`)}})}n(e)};$.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=j.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};$.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,l){if(o&&l&&l.isDirectory())return i(!1);var u=j.dirname(e);s.fs.exists(u,function(f){if(!f)try{s.makeDir(u)}catch{return i(!1)}let g=function(E){s.fs.write(E,t,0,t.length,0,function(S){s.fs.close(E,function(){if(S)return i(!1);s.fs.chmod(e,r||438,function(){i(!0)})})})};s.fs.open(e,"w",438,function(E,S){E?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(m,d){if(m||!d)return i(!1);g(d)})}):S?g(S):i(!1)})})})})};$.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(l){let u=j.join(r,l),f=t.fs.statSync(u);if((!i||i.test(u))&&a.push(j.normalize(u)+(f.isDirectory()?t.sep:"")),f.isDirectory()&&s){let g=t.fs.realpathSync(u);o.has(g)||(o.add(g),a=a.concat(n(u,i,s,o)))}}),a}return n(e,void 0,!0,new Set([t.fs.realpathSync(e)]))};$.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,l,u){n.fs.readdir(a,function(f,g){if(f)return u(f);let E=g.length;if(!E)return u();g.forEach(function(S){let m=j.join(a,S);n.fs.stat(m,function(d,p){if(d)return u(d);if(!p){--E||u();return}if(r.push(j.normalize(m)+(p.isDirectory()?n.sep:"")),!p.isDirectory()){--E||u();return}n.fs.realpath(m,function(h,b){if(h)return u(h);if(l.has(b)){--E||u();return}l.add(b),o(m,l,function(c){if(c)return u(c);--E||u()})})})})})};n.fs.realpath(e,function(a,l){if(a)return s(a);o(e,new Set([l]),s)})};$.prototype.getAttributes=function(){};$.prototype.setAttributes=function(){};$.crc32update=function(e,t){return xn[(e^t)&255]^e>>>8};$.crc32=function(e){typeof e=="string"&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=$.crc32update(n,e[r++]);return~n>>>0};$.methodToString=function(e){switch(e){case Pn.STORED:return"STORED ("+e+")";case Pn.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}};$.canonical=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.join(".",t)};$.zipnamefix=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.posix.join(".",t)};$.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]};$.sanitize=function(e,t){e=j.resolve(j.normalize(e));for(var n=t.split("/"),r=0,i=n.length;r<i;r++){var s=j.normalize(j.join(e,n.slice(r,i).join(j.sep)));if(s===e||s.startsWith(e+j.sep))return s}return j.normalize(j.join(e,j.basename(t)))};$.toBuffer=function(t,n){return Buffer.isBuffer(t)?t:t instanceof Uint8Array?Buffer.from(t):typeof t=="string"?n(t):Buffer.alloc(0)};$.readBigUInt64LE=function(e,t){let n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n};$.writeBigUInt64LE=function(e,t,n){let r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)};$.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)};$.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};$.isWin=Zi;$.crcTable=xn});var _n=F((Sa,An)=>{var Ki=require("path");An.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=Ki.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 Fn=F((Ta,vn)=>{vn.exports={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")}});var Ie=F((wa,Pe)=>{Pe.exports=kn();Pe.exports.Constants=kt();Pe.exports.Errors=Ge();Pe.exports.FileAttr=_n();Pe.exports.decoder=Fn()});var Ln=F((Pa,Rn)=>{var ue=Ie(),I=ue.Constants;Rn.exports=function(){var e=20,t=10,n=0,r=0,i=0,s=0,o=0,a=0,l=0,u=0,f=0,g=0,E=0,S=0,m=0;e|=ue.isWin?2560:768,n|=I.FLG_EFS;let d={extraLen:0},p=c=>Math.max(0,c)>>>0,h=c=>Math.max(0,c)&65535,b=c=>Math.max(0,c)&255;return i=ue.fromDate2DOS(new Date),{get made(){return e},set made(c){e=c},get version(){return t},set version(c){t=c},get flags(){return n},set flags(c){n=c},get flags_efs(){return(n&I.FLG_EFS)>0},set flags_efs(c){c?n|=I.FLG_EFS:n&=~I.FLG_EFS},get flags_desc(){return(n&I.FLG_DESC)>0},set flags_desc(c){c?n|=I.FLG_DESC:n&=~I.FLG_DESC},get method(){return r},set method(c){switch(c){case I.STORED:this.version=10;break;case I.DEFLATED:default:this.version=20}r=c},get time(){return ue.fromDOS2Date(this.timeval)},set time(c){c=new Date(c),this.timeval=ue.fromDate2DOS(c)},get timeval(){return i},set timeval(c){i=p(c)},get timeHighByte(){return b(i>>>8)},get crc(){return s},set crc(c){s=p(c)},get compressedSize(){return o},set compressedSize(c){o=p(c)},get size(){return a},set size(c){a=p(c)},get fileNameLength(){return l},set fileNameLength(c){l=c},get extraLength(){return u},set extraLength(c){u=c},get extraLocalLength(){return d.extraLen},set extraLocalLength(c){d.extraLen=c},get commentLength(){return f},set commentLength(c){f=c},get diskNumStart(){return g},set diskNumStart(c){g=p(c)},get inAttr(){return E},set inAttr(c){E=p(c)},get attr(){return S},set attr(c){S=p(c)},get fileAttr(){return(S||0)>>16&4095},get offset(){return m},set offset(c){m=p(c)},get encrypted(){return(n&I.FLG_ENC)===I.FLG_ENC},get centralHeaderSize(){return I.CENHDR+l+u+f},get realDataOffset(){return m+I.LOCHDR+d.fnameLen+d.extraLen},get localHeader(){return d},loadLocalHeaderFromBinary:function(c){var y=c.slice(m,m+I.LOCHDR);if(y.readUInt32LE(0)!==I.LOCSIG)throw ue.Errors.INVALID_LOC();d.version=y.readUInt16LE(I.LOCVER),d.flags=y.readUInt16LE(I.LOCFLG),d.flags_desc=(d.flags&I.FLG_DESC)>0,d.method=y.readUInt16LE(I.LOCHOW),d.time=y.readUInt32LE(I.LOCTIM),d.crc=y.readUInt32LE(I.LOCCRC),d.compressedSize=y.readUInt32LE(I.LOCSIZ),d.size=y.readUInt32LE(I.LOCLEN),d.fnameLen=y.readUInt16LE(I.LOCNAM),d.extraLen=y.readUInt16LE(I.LOCEXT);let w=m+I.LOCHDR+d.fnameLen,T=w+d.extraLen;return c.slice(w,T)},loadFromBinary:function(c){if(c.length!==I.CENHDR||c.readUInt32LE(0)!==I.CENSIG)throw ue.Errors.INVALID_CEN();e=c.readUInt16LE(I.CENVEM),t=c.readUInt16LE(I.CENVER),n=c.readUInt16LE(I.CENFLG),r=c.readUInt16LE(I.CENHOW),i=c.readUInt32LE(I.CENTIM),s=c.readUInt32LE(I.CENCRC),o=c.readUInt32LE(I.CENSIZ),a=c.readUInt32LE(I.CENLEN),l=c.readUInt16LE(I.CENNAM),u=c.readUInt16LE(I.CENEXT),f=c.readUInt16LE(I.CENCOM),g=c.readUInt16LE(I.CENDSK),E=c.readUInt16LE(I.CENATT),S=c.readUInt32LE(I.CENATX),m=c.readUInt32LE(I.CENOFF)},localHeaderToBinary:function(){var c=Buffer.alloc(I.LOCHDR);return c.writeUInt32LE(I.LOCSIG,0),c.writeUInt16LE(t,I.LOCVER),c.writeUInt16LE(n&~I.FLG_DESC,I.LOCFLG),c.writeUInt16LE(r,I.LOCHOW),c.writeUInt32LE(i,I.LOCTIM),c.writeUInt32LE(s,I.LOCCRC),c.writeUInt32LE(o,I.LOCSIZ),c.writeUInt32LE(a,I.LOCLEN),c.writeUInt16LE(l,I.LOCNAM),c.writeUInt16LE(d.extraLen,I.LOCEXT),c},centralHeaderToBinary:function(){var c=Buffer.alloc(I.CENHDR+l+u+f);return c.writeUInt32LE(I.CENSIG,0),c.writeUInt16LE(e,I.CENVEM),c.writeUInt16LE(t,I.CENVER),c.writeUInt16LE(n&~I.FLG_DESC,I.CENFLG),c.writeUInt16LE(r,I.CENHOW),c.writeUInt32LE(i,I.CENTIM),c.writeUInt32LE(s,I.CENCRC),c.writeUInt32LE(o,I.CENSIZ),c.writeUInt32LE(a,I.CENLEN),c.writeUInt16LE(l,I.CENNAM),c.writeUInt16LE(u,I.CENEXT),c.writeUInt16LE(f,I.CENCOM),c.writeUInt16LE(g,I.CENDSK),c.writeUInt16LE(E,I.CENATT),c.writeUInt32LE(S,I.CENATX),c.writeUInt32LE(m,I.CENOFF),c},toJSON:function(){let c=function(y){return y+" bytes"};return{made:e,version:t,flags:n,method:ue.methodToString(r),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:c(o),size:c(a),fileNameLength:c(l),extraLength:c(u),commentLength:c(f),diskNumStart:g,inAttr:E,attr:S,offset:m,centralHeaderSize:c(I.CENHDR+l+u+f)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Nn=F((Ia,Dn)=>{var Y=Ie(),C=Y.Constants;Dn.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 l=r+n;return a+=C.ZIP64HDR,o.writeUInt32LE(C.END64SIG,a),o.writeUInt32LE(0,a+C.END64START),Y.writeBigUInt64LE(o,l,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,l){let u=a.toString(16).toUpperCase();for(;u.length<l;)u="0"+u;return"0x"+u};return{diskEntries:e,totalEntries:t,size:n+" bytes",offset:o(r,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var _t=F(At=>{At.EntryHeader=Ln();At.MainHeader=Nn()});var $n=F((Ca,On)=>{On.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),l=0;a.fill(0);for(var u=0;u<s.length;u++){var f=s[u];f.copy(a,l),l+=f.length}r&&r(a)}),i.end(e)}}}});var Bn=F((ka,Mn)=>{var Yi=+(process?.versions?.node??"").split(".")[0]||0;Mn.exports=function(e,t){var n=require("zlib");let r=Yi>=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(l){o.push(l),a+=l.length}),s.on("end",function(){var l=Buffer.alloc(a),u=0;l.fill(0);for(var f=0;f<o.length;f++){var g=o[f];g.copy(l,u),u+=g.length}i&&i(l)}),s.end(e)}}}});var Hn=F((Aa,zn)=>{"use strict";var{randomFillSync:jn}=require("crypto"),Ji=Ge(),Xi=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}),Un=(e,t)=>Math.imul(e,t)>>>0,Vn=(e,t)=>Xi[(e^t)&255]^e>>>8,Ne=()=>typeof jn=="function"?jn(Buffer.alloc(12)):Ne.node();Ne.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 Ze={genSalt:Ne};function Ke(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])}Ke.prototype.updateKeys=function(e){let t=this.keys;return t[0]=Vn(t[0],e),t[1]+=t[0]&255,t[1]=Un(t[1],134775813)+1,t[2]=Vn(t[2],t[1]>>>24),e};Ke.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return Un(e,e^1)>>8&255};function Qi(e){let t=new Ke(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 eo(e){let t=new Ke(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 to(e,t,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let r=Qi(n),i=r(e.slice(0,12)),s=(t.flags&8)===8?t.timeHighByte:t.crc>>>24;if(i[11]!==s)throw Ji.WRONG_PASSWORD();return r(e.slice(12))}function no(e){Buffer.isBuffer(e)&&e.length>=12?Ze.genSalt=function(){return e.slice(0,12)}:e==="node"?Ze.genSalt=Ne.node:Ze.genSalt=Ne}function ro(e,t,n,r=!1){e==null&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));let i=eo(n),s=Ze.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)}zn.exports={decrypt:to,encrypt:ro,_salter:no}});var qn=F(Ye=>{Ye.Deflater=$n();Ye.Inflater=Bn();Ye.ZipCrypto=Hn()});var Ft=F((va,Wn)=>{var D=Ie(),io=_t(),K=D.Constants,vt=qn();Wn.exports=function(e,t){var n=new io.EntryHeader,r=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),l=Buffer.alloc(0),u=!0;let f=e,g=typeof f.decoder=="object"?f.decoder:D.decoder;u=g.hasOwnProperty("efs")?g.efs:!1;function E(){return!t||!(t instanceof Uint8Array)?Buffer.alloc(0):(l=n.loadLocalHeaderFromBinary(t),t.slice(n.realDataOffset,n.realDataOffset+n.compressedSize))}function S(c){let y=n.flags_desc||n.localHeader.flags_desc?n.crc:n.localHeader.crc;return D.crc32(c)===y}function m(c,y,w){if(typeof y>"u"&&typeof c=="string"&&(w=c,c=void 0),s)return c&&y&&y(Buffer.alloc(0),D.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var T=E();if(T.length===0)return c&&y&&y(T),T;if(n.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw D.Errors.INVALID_PASS_PARAM();T=vt.ZipCrypto.decrypt(T,n,w)}var P;switch(n.method){case D.Constants.STORED:if(P=Buffer.alloc(T.length),T.copy(P),S(P))return c&&y&&y(P),P;throw c&&y&&y(P,D.Errors.BAD_CRC()),D.Errors.BAD_CRC();case D.Constants.DEFLATED:var x=new vt.Inflater(T,n.size);if(c)x.inflateAsync(function(v){y&&(S(v)?y(v):y(v,D.Errors.BAD_CRC()))});else{if(P=x.inflate(),!S(P))throw D.Errors.BAD_CRC(`"${g.decode(r)}"`);return P}break;default:throw c&&y&&y(Buffer.alloc(0),D.Errors.UNKNOWN_METHOD()),D.Errors.UNKNOWN_METHOD()}}function d(c,y){if((!o||!o.length)&&Buffer.isBuffer(t))return c&&y&&y(E()),E();if(o.length&&!s){var w;switch(n.method){case D.Constants.STORED:return n.compressedSize=n.size,w=Buffer.alloc(o.length),o.copy(w),c&&y&&y(w),w;default:case D.Constants.DEFLATED:var T=new vt.Deflater(o);if(c)T.deflateAsync(function(x){w=Buffer.alloc(x.length),n.compressedSize=x.length,x.copy(w),y&&y(w)});else{var P=T.deflate();return n.compressedSize=P.length,P}T=null;break}}else if(c&&y)y(Buffer.alloc(0));else return Buffer.alloc(0)}function p(c,y){return D.readBigUInt64LE(c,y)}function h(c){try{for(var y=0,w,T,P;y+4<c.length;)w=c.readUInt16LE(y),y+=2,T=c.readUInt16LE(y),y+=2,P=c.slice(y,y+T),y+=T,K.ID_ZIP64===w&&b(P)}catch{throw D.Errors.EXTRA_FIELD_PARSE_ERROR()}}function b(c){var y,w,T,P;c.length>=K.EF_ZIP64_SCOMP&&(y=p(c,K.EF_ZIP64_SUNCOMP),n.size===K.EF_ZIP64_OR_32&&(n.size=y)),c.length>=K.EF_ZIP64_RHO&&(w=p(c,K.EF_ZIP64_SCOMP),n.compressedSize===K.EF_ZIP64_OR_32&&(n.compressedSize=w)),c.length>=K.EF_ZIP64_DSN&&(T=p(c,K.EF_ZIP64_RHO),n.offset===K.EF_ZIP64_OR_32&&(n.offset=T)),c.length>=K.EF_ZIP64_DSN+4&&(P=c.readUInt32LE(K.EF_ZIP64_DSN),n.diskNumStart===K.EF_ZIP64_OR_16&&(n.diskNumStart=P))}return{get entryName(){return g.decode(r)},get rawEntryName(){return r},set entryName(c){r=D.toBuffer(c,g.encode);var y=r[r.length-1];s=y===47||y===92,n.fileNameLength=r.length},get efs(){return typeof u=="function"?u(this.entryName):u},get extra(){return a},set extra(c){a=c,n.extraLength=c.length,h(c)},get comment(){return g.decode(i)},set comment(c){if(i=D.toBuffer(c,g.encode),n.commentLength=i.length,i.length>65535)throw D.Errors.COMMENT_TOO_LONG()},get name(){let c=g.decode(r);return s?c.replace(/[/\\]$/,"").split("/").pop():c.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return d(!1,null)},getCompressedDataAsync:function(c){d(!0,c)},setData:function(c){o=D.toBuffer(c,D.decoder.encode),!s&&o.length?(n.size=o.length,n.method=D.Constants.DEFLATED,n.crc=D.crc32(c),n.changed=!0):n.method=D.Constants.STORED},getData:function(c){return n.changed?o:m(!1,null,c)},getDataAsync:function(c,y){n.changed?c(o):m(!0,c,y)},set attr(c){n.attr=c},get attr(){return n.attr},set header(c){n.loadFromBinary(c)},get header(){return n},packCentralHeader:function(){n.flags_efs=this.efs,n.extraLength=a.length;var c=n.centralHeaderToBinary(),y=D.Constants.CENHDR;return r.copy(c,y),y+=r.length,a.copy(c,y),y+=n.extraLength,i.copy(c,y),c},packLocalHeader:function(){let c=0;n.flags_efs=this.efs,n.extraLocalLength=l.length;let y=n.localHeaderToBinary(),w=Buffer.alloc(y.length+r.length+n.extraLocalLength);return y.copy(w,c),c+=y.length,r.copy(w,c),c+=r.length,l.copy(w,c),c+=l.length,w},toJSON:function(){let c=function(y){return"<"+(y&&y.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:n.toJSON(),compressedData:c(t),data:c(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Kn=F((Fa,Zn)=>{var Gn=Ft(),oo=_t(),W=Ie();Zn.exports=function(e,t){var n=[],r=Object.create(null),i=Buffer.alloc(0),s=new oo.MainHeader,o=!1,a=null;let l=new Set,u=t,{noSort:f,decoder:g}=u;e?m(u.readEntries):o=!0;function E(){let p=new Set;for(let h of Object.keys(r)){let b=h.split("/");if(b.pop(),!!b.length)for(let c=0;c<b.length;c++){let y=b.slice(0,c+1).join("/")+"/";p.add(y)}}for(let h of p)if(!(h in r)){let b=new Gn(u);b.entryName=h,b.attr=16,b.temporary=!0,n.push(b),r[b.entryName]=b,l.add(b)}}function S(){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,h=0;h<n.length;h++){var b=p,c=new Gn(u,e);c.header=e.slice(b,b+=W.Constants.CENHDR),c.entryName=e.slice(b,b+=c.header.fileNameLength),c.header.extraLength&&(c.extra=e.slice(b,b+=c.header.extraLength)),c.header.commentLength&&(c.comment=e.slice(b,b+c.header.commentLength)),p+=c.header.centralHeaderSize,n[h]=c,r[c.entryName]=c}l.clear(),E()}function m(p){var h=e.length-W.Constants.ENDHDR,b=Math.max(0,h-65535),c=b,y=e.length,w=-1,T=0;for(typeof u.trailingSpace=="boolean"&&u.trailingSpace&&(b=0),h;h>=c;h--)if(e[h]===80){if(e.readUInt32LE(h)===W.Constants.ENDSIG){w=h,T=h,y=h+W.Constants.ENDHDR,c=h-W.Constants.END64HDR;continue}if(e.readUInt32LE(h)===W.Constants.END64SIG){c=b;continue}if(e.readUInt32LE(h)===W.Constants.ZIP64SIG){w=h,y=h+W.readBigUInt64LE(e,h+W.Constants.ZIP64SIZE)+W.Constants.ZIP64LEAD;break}}if(w==-1)throw W.Errors.INVALID_FORMAT();s.loadFromBinary(e.slice(w,y)),s.commentLength&&(i=e.slice(T+W.Constants.ENDHDR)),p&&S()}function d(){n.length>1&&!f&&(n=n.map(p=>({entry:p,key:p.entryName.toLowerCase()})).sort((p,h)=>p.key.localeCompare(h.key)).map(p=>p.entry))}return{get entries(){return o||S(),n.filter(p=>!l.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||S(),r[p]||null},setEntry:function(p){o||S(),n.push(p),r[p.entryName]=p,s.totalEntries=n.length},deleteFile:function(p,h=!0){o||S();let b=r[p];this.getEntryChildren(b,h).map(y=>y.entryName).forEach(this.deleteEntry)},deleteEntry:function(p){o||S();let h=r[p],b=n.indexOf(h);b>=0&&(n.splice(b,1),delete r[p],s.totalEntries=n.length)},getEntryChildren:function(p,h=!0){if(o||S(),typeof p=="object")if(p.isDirectory&&h){let b=[],c=p.entryName;for(let y of n)y.entryName.startsWith(c)&&b.push(y);return b}else return[p];return[]},getChildCount:function(p){if(p&&p.isDirectory){let h=this.getEntryChildren(p);return h.includes(p)?h.length-1:h.length}return 0},compressToBuffer:function(){o||S(),d();let p=[],h=[],b=0,c=0;s.size=0,s.offset=0;let y=0;for(let P of this.entries){let x=P.getCompressedData();P.header.offset=c;let v=P.packLocalHeader(),R=v.length+x.length;c+=R,p.push(v),p.push(x);let L=P.packCentralHeader();h.push(L),s.size+=L.length,b+=R+L.length,y++}b+=s.mainHeaderSize,s.offset=c,s.totalEntries=y,c=0;let w=Buffer.alloc(b);for(let P of p)P.copy(w,c),c+=P.length;for(let P of h)P.copy(w,c),c+=P.length;let T=s.toBinary();return i&&i.copy(T,T.length-i.length),T.copy(w,c),e=w,o=!1,w},toAsyncBuffer:function(p,h,b,c){try{o||S(),d();let y=[],w=[],T=0,P=0,x=0;s.size=0,s.offset=0;let v=function(R){if(R.length>0){let L=R.shift(),V=L.entryName+L.extra.toString();b&&b(V),L.getCompressedDataAsync(function(q){c&&c(V),L.header.offset=P;let he=L.packLocalHeader(),qe=he.length+q.length;P+=qe,y.push(he),y.push(q);let De=L.packCentralHeader();w.push(De),s.size+=De.length,T+=qe+De.length,x++,v(R)})}else{T+=s.mainHeaderSize,s.offset=P,s.totalEntries=x,P=0;let L=Buffer.alloc(T);y.forEach(function(q){q.copy(L,P),P+=q.length}),w.forEach(function(q){q.copy(L,P),P+=q.length});let V=s.toBinary();i&&i.copy(V,V.length-i.length),V.copy(L,P),e=L,o=!1,p(L)}};v(Array.from(this.entries))}catch(y){h(y)}}}}});var Rt=F((Ra,Jn)=>{var B=Ie(),M=require("path"),so=Ft(),ao=Kn(),ye=(...e)=>B.findLast(e,t=>typeof t=="boolean"),Yn=(...e)=>B.findLast(e,t=>typeof t=="string"),co=(...e)=>B.findLast(e,t=>typeof t=="function"),lo={noSort:!1,readEntries:!1,method:B.Constants.NONE,fs:null};Jn.exports=function(e,t){let n=null,r=Object.assign(Object.create(null),lo);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=m=>{m.filter(d=>d.attr).sort((d,p)=>p.path.length-d.path.length).forEach(d=>i.fs.chmodSync(d.path,d.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 ao(n,r),{canonical:a,sanitize:l,zipnamefix:u}=B;function f(m){if(m&&o){var d;if(typeof m=="string"&&(d=o.getEntry(M.posix.normalize(m))),typeof m=="object"&&typeof m.entryName<"u"&&typeof m.header<"u"&&(d=o.getEntry(m.entryName)),d)return d}return null}function g(m){let{join:d,normalize:p,sep:h}=M.posix;return d(M.isAbsolute(m)?"/":".",p(h+m.split("\\").join(h)+h))}function E(m){return m instanceof RegExp?(function(d){return function(p){return d.test(p)}})(m):typeof m!="function"?()=>!0:m}let S=(m,d)=>{let p=d.slice(-1);return p=p===i.sep?i.sep:"",M.relative(m,d)+p};return{readFile:function(m,d){var p=f(m);return p&&p.getData(d)||null},childCount:function(m){let d=f(m);if(d)return o.getChildCount(d)},readFileAsync:function(m,d){var p=f(m);p?p.getDataAsync(d):d(null,"getEntry failed for:"+m)},readAsText:function(m,d){var p=f(m);if(p){var h=p.getData();if(h&&h.length)return h.toString(d||"utf8")}return""},readAsTextAsync:function(m,d,p){var h=f(m);h?h.getDataAsync(function(b,c){if(c){d(b,c);return}b&&b.length?d(b.toString(p||"utf8")):d("")}):d("")},deleteFile:function(m,d=!0){var p=f(m);p&&o.deleteFile(p.entryName,d)},deleteEntry:function(m){var d=f(m);d&&o.deleteEntry(d.entryName)},addZipComment:function(m){o.comment=m},getZipComment:function(){return o.comment||""},addZipEntryComment:function(m,d){var p=f(m);p&&(p.comment=d)},getZipEntryComment:function(m){var d=f(m);return d&&d.comment||""},updateFile:function(m,d){var p=f(m);p&&p.setData(d)},addLocalFile:function(m,d,p,h){if(i.fs.existsSync(m)){d=d?g(d):"";let b=M.win32.basename(M.win32.normalize(m));d+=p||b;let c=i.fs.statSync(m),y=c.isFile()?i.fs.readFileSync(m):Buffer.alloc(0);c.isDirectory()&&(d+=i.sep),this.addFile(d,y,h,c)}else throw B.Errors.FILE_NOT_FOUND(m)},addLocalFileAsync:function(m,d){m=typeof m=="object"?m:{localPath:m};let p=M.resolve(m.localPath),{comment:h}=m,{zipPath:b,zipName:c}=m,y=this;i.fs.stat(p,function(w,T){if(w)return d(w,!1);b=b?g(b):"";let P=M.win32.basename(M.win32.normalize(p));if(b+=c||P,T.isFile())i.fs.readFile(p,function(x,v){return x?d(x,!1):(y.addFile(b,v,h,T),setImmediate(d,void 0,!0))});else if(T.isDirectory())return b+=i.sep,y.addFile(b,Buffer.alloc(0),h,T),setImmediate(d,void 0,!0)})},addLocalFolder:function(m,d,p){if(p=E(p),d=d?g(d):"",m=M.normalize(m),i.fs.existsSync(m)){let h=i.findFiles(m),b=this;if(h.length)for(let c of h){let y=M.join(d,S(m,c));p(y)&&b.addLocalFile(c,M.dirname(y))}}else throw B.Errors.FILE_NOT_FOUND(m)},addLocalFolderAsync:function(m,d,p,h){h=E(h),p=p?g(p):"",m=M.normalize(m);var b=this;i.fs.open(m,"r",function(c){if(c&&c.code==="ENOENT")d(void 0,B.Errors.FILE_NOT_FOUND(m));else if(c)d(void 0,c);else{var y=i.findFiles(m),w=-1,T=function(){if(w+=1,w<y.length){var P=y[w],x=S(m,P).split("\\").join("/");x=x.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),h(x)?i.fs.stat(P,function(v,R){v&&d(void 0,v),R.isFile()?i.fs.readFile(P,function(L,V){L?d(void 0,L):(b.addFile(p+x,V,"",R),T())}):(b.addFile(p+x+"/",Buffer.alloc(0),"",R),T())}):process.nextTick(()=>{T()})}else d(!0,void 0)};T()}})},addLocalFolderAsync2:function(m,d){let p=this;m=typeof m=="object"?m:{localPath:m};let h=M.resolve(g(m.localPath)),{zipPath:b,filter:c,namefix:y}=m;c instanceof RegExp?c=(function(P){return function(x){return P.test(x)}})(c):typeof c!="function"&&(c=function(){return!0}),b=b?g(b):"",y==="latin1"&&(y=P=>P.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof y!="function"&&(y=P=>P);let w=P=>M.join(b,y(S(h,P))),T=P=>M.win32.basename(M.win32.normalize(y(P)));i.fs.open(h,"r",function(P){P&&P.code==="ENOENT"?d(void 0,B.Errors.FILE_NOT_FOUND(h)):P?d(void 0,P):i.findFilesAsync(h,function(x,v){if(x)return d(x);v=v.filter(R=>c(w(R))),v.length||d(void 0,!1),setImmediate(v.reverse().reduce(function(R,L){return function(V,q){if(V||q===!1)return setImmediate(R,V,!1);p.addLocalFileAsync({localPath:L,zipPath:M.dirname(w(L)),zipName:T(L)},R)}},d))})})},addLocalFolderPromise:function(m,d){return new Promise((p,h)=>{this.addLocalFolderAsync2(Object.assign({localPath:m},d),(b,c)=>{b&&h(b),c&&p(this)})})},addFile:function(m,d,p,h){m=u(m);let b=f(m),c=b!=null;c||(b=new so(r),b.entryName=m),b.comment=p||"";let y=typeof h=="object"&&h instanceof i.fs.Stats;y&&(b.header.time=h.mtime);var w=b.isDirectory?16:0;let T=b.isDirectory?16384:32768;return y?T|=4095&h.mode:typeof h=="number"?T|=4095&h:T|=b.isDirectory?493:420,w=(w|T<<16)>>>0,b.attr=w,b.setData(d),c||o.setEntry(b),b},getEntries:function(m){return o.password=m,o?o.entries:[]},getEntry:function(m){return f(m)},getEntryCount:function(){return o.getEntryCount()},forEach:function(m){return o.forEach(m)},extractEntryTo:function(m,d,p,h,b,c){h=ye(!1,h),b=ye(!1,b),p=ye(!0,p),c=Yn(b,c);var y=f(m);if(!y)throw B.Errors.NO_ENTRY();var w=a(y.entryName),T=l(d,c&&!y.isDirectory?a(c):p?w:M.basename(w));if(y.isDirectory){var P=o.getEntryChildren(y);return P.forEach(function(R){if(R.isDirectory)return;var L=R.getData();if(!L)throw B.Errors.CANT_EXTRACT_FILE();var V=a(p?R.entryName:R.entryName.substring(y.entryName.length)),q=l(d,V);let he=b?R.header.fileAttr:void 0;i.writeFileTo(q,L,h,he)}),!0}var x=y.getData(o.password);if(!x)throw B.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(T)&&!h)throw B.Errors.CANT_OVERRIDE();let v=b?m.header.fileAttr:void 0;return i.writeFileTo(T,x,h,v),!0},test:function(m){if(!o)return!1;for(var d of o.entries)try{if(d.isDirectory)continue;var p=d.getData(m);if(!p)return!1}catch{return!1}return!0},extractAllTo:function(m,d,p,h){if(p=ye(!1,p),h=Yn(p,h),d=ye(!1,d),!o)throw B.Errors.NO_ZIP();let b=[];o.entries.forEach(function(c){var y=l(m,a(c.entryName));if(c.isDirectory){i.makeDir(y),p&&b.push({path:y,attr:c.header.fileAttr});return}var w=c.getData(h);if(!w)throw B.Errors.CANT_EXTRACT_FILE();let T=p?c.header.fileAttr:void 0;i.writeFileTo(y,w,d,T);try{i.fs.utimesSync(y,c.header.time,c.header.time)}catch{}}),s(b)},extractAllToAsync:function(m,d,p,h){if(h=co(d,p,h),p=ye(!1,p),d=ye(!1,d),!h)return new Promise((x,v)=>{this.extractAllToAsync(m,d,p,function(R){R?v(R):x(this)})});if(!o){h(B.Errors.NO_ZIP());return}m=M.resolve(m);let b=x=>l(m,M.normalize(a(x.entryName))),c=(x,v)=>new Error(x+': "'+v+'"'),y=[],w=[];o.entries.forEach(x=>{x.isDirectory?y.push(x):w.push(x)});let T=[];for(let x of y){let v=b(x),R=p?x.header.fileAttr:void 0;try{i.makeDir(v)}catch{h(c("Unable to create folder",v));continue}R&&T.push({path:v,attr:R});try{i.fs.utimesSync(v,x.header.time,x.header.time)}catch{}}let P=x=>{if(!x)try{s(T)}catch(v){return h(c("Unable to set folder permissions",v.path||""))}h(x)};w.reverse().reduce(function(x,v){return function(R){if(R)x(R);else{let L=M.normalize(a(v.entryName)),V=l(m,L);v.getDataAsync(function(q,he){if(he)x(he);else if(!q)x(B.Errors.CANT_EXTRACT_FILE());else{let qe=p?v.header.fileAttr:void 0;i.writeFileToAsync(V,q,d,qe,function(De){if(!De)return x(c("Unable to write file",V));i.fs.utimes(V,v.header.time,v.header.time,function(){x()})})}})}}},P)()},writeZip:function(m,d){if(arguments.length===1&&typeof m=="function"&&(d=m,m=""),!m&&r.filename&&(m=r.filename),!!m){var p=o.compressToBuffer();if(p){var h=i.writeFileTo(m,p,!0);typeof d=="function"&&d(h?null:new Error("failed"),"")}}},writeZipPromise:function(m,d){let{overwrite:p,perm:h}=Object.assign({overwrite:!0},d);return new Promise((b,c)=>{!m&&r.filename&&(m=r.filename),m||c("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(y=>{let w=T=>T?b(T):c("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(m,y,p,h,w)},c)})},toBufferPromise:function(){return new Promise((m,d)=>{o.toAsyncBuffer(m,d)})},toBuffer:function(m,d,p,h){return typeof m=="function"?(o.toAsyncBuffer(m,d,p,h),null):o.compressToBuffer()}}}});var Wr=F(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0})});var ht=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 gt=[400,500,600,700],bs=[400,700],tn=[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??gt,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:gt,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:gt,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:tn,variable:!0}),A("roboto-mono","Roboto Mono","monospace","roboto-mono","Roboto+Mono",{weights:tn,variable:!0}),A("jetbrains-mono","JetBrains Mono","monospace","jetbrains-mono","JetBrains+Mono",{weights:tn,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:bs}),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:gt,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 ke=F(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.normalizeFontId=Ce;me.lookupFontDefinition=Me;me.resolveInstallableFont=Ss;me.resolveFontFamily=Ts;me.listFontsByCategory=ws;me.collectFontIdsFromSiteData=Ps;var yt=ht();function Ce(e){return e.trim().toLowerCase().replace(/['"]/g,"").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function Me(e){if(!e||!e.trim())return null;let t=Ce(e),n=yt.DENEB_FONT_BY_ID.get(t);if(n)return n;for(let i of yt.DENEB_FONT_REGISTRY)if(Ce(i.label)===t||Ce(i.family)===t)return i;let r=e.split(",")[0]?.trim().replace(/^['"]|['"]$/g,"");if(r){let i=Ce(r);if(i&&i!==t)return Me(r)}return null}function Ss(e){let t=Me(e);return t?t.fontsourcePackage?t:t.substituteId?yt.DENEB_FONT_BY_ID.get(t.substituteId)??null:null:null}function Ts(e){if(!e||!e.trim())return;let t=Me(e);return t?t.cssStack:e.includes(",")?e:`'${e.trim()}', system-ui, sans-serif`}function ws(){var e;let t={};for(let n of yt.DENEB_FONT_REGISTRY)t[e=n.category]??(t[e]=[]),t[n.category].push(n);return t}function Ps(e){let t=new Set,n=l=>{if(typeof l!="string"||!l.trim())return;let u=Me(l);if(u){t.add(u.id),u.substituteId&&t.add(u.substituteId);return}let f=Ce(l);f&&t.add(f)};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 l of Object.values(s))l&&typeof l=="object"&&!Array.isArray(l)&&n(l.fontFamily);let o=new WeakSet,a=l=>{if(!(!l||typeof l!="object")&&!o.has(l)){if(o.add(l),Array.isArray(l)){l.forEach(a);return}for(let[u,f]of Object.entries(l))u.endsWith("Style")&&f&&typeof f=="object"&&n(f.fontFamily),a(f)}};return a(r.content),t.delete("system-sans"),Array.from(t)}});var nn=F(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.formatResponsiveFontSize=Gr;Et.formatFontSize=Is;function Gr(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 Is(e,t){if(!(e==null||e==="")){if(t?.responsive){let n=Gr(e);if(n)return n}return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}}});var Kr=F(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.buildGoogleFontsStylesheetUrl=ks;var Zr=ht(),xs=ke();function Cs(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 ks(e){let t=[],n=new Set;for(let r of e){let i=Zr.DENEB_FONT_BY_ID.get(r)??(0,xs.lookupFontDefinition)(r);if(!i||!i.googleFonts||!i.googleQuery)continue;let s=i.substituteId&&!i.fontsourcePackage?i.substituteId:i.id,o=Zr.DENEB_FONT_BY_ID.get(s)??i;if(n.has(o.id))continue;n.add(o.id);let a=Cs(o);a&&t.push(a)}return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`}});var Yr=F(re=>{"use strict";var As=re&&re.__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]})),Be=re&&re.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&As(t,e,n)};Object.defineProperty(re,"__esModule",{value:!0});Be(Wr(),re);Be(ht(),re);Be(ke(),re);Be(nn(),re);Be(Kr(),re)});var Xr=F(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0})});var Qr=F(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.DENEB_STYLE_PATCH_MESSAGE=se.STYLE_PATCH_MESSAGE=void 0;se.isStylePatchPayload=_s;se.STYLE_PATCH_MESSAGE="FIVORA_PREVIEW_STYLE_PATCH";se.DENEB_STYLE_PATCH_MESSAGE="DENEB_PREVIEW_STYLE_PATCH";function _s(e){if(!e||typeof e!="object")return!1;let t=e,n=t.type;return n!==se.STYLE_PATCH_MESSAGE&&n!==se.DENEB_STYLE_PATCH_MESSAGE?!1:typeof t.targetPath=="string"&&typeof t.styleType=="string"&&typeof t.properties=="object"&&t.properties!==null}});var on=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=ei;O.buildStyleFallbackSelectors=vs;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 ae(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function ei(e){return`[${O.STYLE_TARGET_ATTRIBUTE}="${ae(e)}"]`}function vs(e,t){let n=[ei(e),`[${O.PREVIEW_FIELD_ATTRIBUTE}="${ae(e)}"]`,`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(e)}"]`];if(t==="card"&&e.endsWith(".card")){let r=e.slice(0,-5);n.push(`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(r)}"]`)}if(e.includes(":")){let[r,i]=e.split(":");i==="card"?n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_ITEM_ATTRIBUTE}]`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] .card`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] article`):i&&n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_FIELD_ATTRIBUTE}$=".${ae(i)}"]`)}return n}});var bt=F(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.resolveFontFamily=void 0;Ae.resolveShadowPreset=Ls;Ae.resolveThemeToken=Ds;var Fs=ke();Object.defineProperty(Ae,"resolveFontFamily",{enumerable:!0,get:function(){return Fs.resolveFontFamily}});var Rs={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 Ls(e){if(e)return Rs[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 an=F(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.formatUnit=N;ce.textStyleToCssVariables=ti;ce.cardStyleToCssVariables=ni;ce.buttonStyleToCssVariables=ri;ce.gridStyleToCssVariables=ii;ce.sectionStyleToCssVariables=oi;ce.styleToCssVariables=$s;var Ns=nn(),Os=ke(),_e=bt();function N(e){if(!(e===void 0||e===""||e===null))return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}function sn(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 ti(e){let t={...sn(e,"--deneb")};return e.fontFamily&&(t["--deneb-font-family"]=(0,Os.resolveFontFamily)(e.fontFamily)),e.fontSize!==void 0&&(t["--deneb-font-size"]=(0,Ns.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,_e.resolveThemeToken)(e.color)),e.textAlign&&(t["--deneb-text-align"]=e.textAlign),e.textTransform&&(t["--deneb-text-transform"]=e.textTransform),t}function ni(e){let t={...sn(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,_e.resolveThemeToken)(e.backgroundColor)),e.backgroundGradient&&(t["--deneb-card-bg-gradient"]=e.backgroundGradient),e.boxShadow&&(t["--deneb-card-shadow"]=(0,_e.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 ri(e){let t={...sn(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,_e.resolveThemeToken)(e.backgroundColor)),e.textColor&&(t["--deneb-btn-color"]=(0,_e.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 ii(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 oi(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,_e.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)),e.textAlign&&(t["--deneb-section-align"]=e.textAlign),e.display&&(t["--deneb-section-display"]=e.display),e.order!==void 0&&e.order!==""&&(t["--deneb-section-order"]=String(e.order)),t}function $s(e,t){switch(e){case"text":return ti(t);case"card":return ni(t);case"button":return ri(t);case"grid":return ii(t);case"section":return oi(t);default:return{}}}});var ln=F(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.isPlainObject=cn;St.deepMerge=si;function cn(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function si(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))cn(o)&&cn(i[s])?i[s]=si(i[s],o,n+1,r):i[s]=o;return i}});var di=F(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getLiveStyleCache=js;we.applyCssVariablesToElement=ci;we.findStyleTargetElement=Vs;we.patchElementStyle=li;we.patchStyleByPath=Us;var je=on(),Ms=ln(),le=an(),Bs=ke(),ai=bt(),dn=new Map;function js(){return dn}function ci(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}function Vs(e,t){if(typeof document>"u"||!e)return null;for(let n of(0,je.buildStyleFallbackSelectors)(e,t)){let r=document.querySelector(n);if(r)return r}return null}function li(e,t,n){let i=(e.getAttribute(je.STYLE_TARGET_ATTRIBUTE)??"")||e.getAttribute("data-preview-field-path")||"",s=i?dn.get(i)??{}:{},o=(0,Ms.deepMerge)(s,n);i&&dn.set(i,o);let a=(0,le.styleToCssVariables)(t,o);if(ci(e,a),t==="text"){if(o.color){let l=(0,ai.resolveThemeToken)(String(o.color))||String(o.color);e.style.setProperty("color",l,"important")}if(o.textAlign&&e.style.setProperty("text-align",String(o.textAlign),"important"),o.fontSize!==void 0){let l=(0,le.formatUnit)(o.fontSize)||String(o.fontSize);e.style.setProperty("font-size",l,"important")}if(o.lineHeight!==void 0&&e.style.setProperty("line-height",String(o.lineHeight),"important"),o.fontFamily){let l=(0,Bs.resolveFontFamily)(String(o.fontFamily))||String(o.fontFamily);e.style.setProperty("font-family",l,"important")}if(o.fontWeight!==void 0&&e.style.setProperty("font-weight",String(o.fontWeight),"important"),o.marginTop!==void 0||o.spacingTop!==void 0){let l=(0,le.formatUnit)(o.marginTop??o.spacingTop);l&&e.style.setProperty("margin-top",l,"important")}if(o.marginBottom!==void 0||o.spacingBottom!==void 0){let l=(0,le.formatUnit)(o.marginBottom??o.spacingBottom);l&&e.style.setProperty("margin-bottom",l,"important")}if(o.marginLeft!==void 0||o.spacingLeft!==void 0){let l=(0,le.formatUnit)(o.marginLeft??o.spacingLeft);l&&e.style.setProperty("margin-left",l,"important")}if(o.marginRight!==void 0||o.spacingRight!==void 0){let l=(0,le.formatUnit)(o.marginRight??o.spacingRight);l&&e.style.setProperty("margin-right",l,"important")}}else if(t==="card"){if(o.backgroundColor){let l=(0,ai.resolveThemeToken)(String(o.backgroundColor))||String(o.backgroundColor);e.style.setProperty("background-color",l,"important"),e.style.setProperty("background",l,"important")}if(o.borderRadius!==void 0){let l=(0,le.formatUnit)(o.borderRadius)||String(o.borderRadius);e.style.setProperty("border-radius",l,"important")}if(o.padding!==void 0||o.paddingTop!==void 0){let l=(0,le.formatUnit)(o.padding??o.paddingTop);l&&e.style.setProperty("padding",l,"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 l=(0,le.formatUnit)(o.borderWidth)||String(o.borderWidth);e.style.setProperty("border-width",l,"important"),e.style.setProperty("border-style","solid","important")}}e.getAttribute(je.STYLE_TYPE_ATTRIBUTE)||e.setAttribute(je.STYLE_TYPE_ATTRIBUTE,t)}function Us(e,t,n){if(typeof document>"u"||!e)return!1;let r=!1;for(let i of(0,je.buildStyleFallbackSelectors)(e,t)){let s=document.querySelectorAll(i);s.length>0&&(s.forEach(o=>li(o,t,n)),r=!0)}return r}});var ui=F(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.isValidStyleKind=Hs;Ve.validateStyleTree=qs;Ve.collectStyleTargetsFromHtml=Ws;var zs=new Set(["text","card","button","grid","section"]);function Hs(e){return typeof e=="string"&&zs.has(e)}function qs(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 pi=F(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0})});var un=F(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.isDarkColor=mi;ve.getAutoContrastTextColor=Gs;ve.toHexColor=Zs;ve.normalizeHexColor=Ks;function mi(e){if(typeof e!="string"||!e)return!1;let t=e.trim().toLowerCase();if(!/^#[0-9a-f]{3,6}$/i.test(t))return!1;let n=t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t,r=Number.parseInt(n.slice(1,3),16),i=Number.parseInt(n.slice(3,5),16),s=Number.parseInt(n.slice(5,7),16);return(r*299+i*587+s*114)/1e3<130}function Gs(e,t="#ffffff",n="#0f172a"){return mi(e)?t:n}function Zs(e,t){if(!e)return t;let n=e.trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():/^#[0-9a-f]{3}$/i.test(n)?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`.toLowerCase():t}function Ks(e){if(!e)return null;let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t.toLowerCase():/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toLowerCase():null}});var gi=F(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.THEME_PALETTES=void 0;Tt.THEME_PALETTES=[{id:"classic-luxe",name:"Classic Luxe",badge:"Light \u2022 Warm Luxe",mode:"light",primary:"#1e293b",secondary:"#d97706",accent:"#f59e0b",background:"#fdfbf7",card:"#ffffff",text:"#1e293b",muted:"#64748b",buttonBg:"#1e293b",buttonText:"#ffffff"},{id:"ocean-modern",name:"Ocean Modern",badge:"Light \u2022 Crisp Ocean",mode:"light",primary:"#0284c7",secondary:"#0369a1",accent:"#38bdf8",background:"#f8fafc",card:"#ffffff",text:"#0f172a",muted:"#64748b",buttonBg:"#0284c7",buttonText:"#ffffff"},{id:"forest-emerald",name:"Forest Emerald",badge:"Light \u2022 Organic Green",mode:"light",primary:"#065f46",secondary:"#047857",accent:"#10b981",background:"#f0fdf4",card:"#ffffff",text:"#064e3b",muted:"#475569",buttonBg:"#065f46",buttonText:"#ffffff"},{id:"warm-terracotta",name:"Warm Terracotta",badge:"Light \u2022 Artisanal",mode:"light",primary:"#c2410c",secondary:"#ea580c",accent:"#f97316",background:"#fffaf5",card:"#ffffff",text:"#431407",muted:"#78350f",buttonBg:"#c2410c",buttonText:"#ffffff"},{id:"velvet-berry",name:"Velvet Berry",badge:"Light \u2022 Vibrant Chic",mode:"light",primary:"#9f1239",secondary:"#be123c",accent:"#f43f5e",background:"#fff5f7",card:"#ffffff",text:"#4c0519",muted:"#881337",buttonBg:"#9f1239",buttonText:"#ffffff"},{id:"sleek-obsidian",name:"Sleek Obsidian",badge:"Dark \u2022 Obsidian",mode:"dark",primary:"#60a5fa",secondary:"#38bdf8",accent:"#93c5fd",background:"#090d16",card:"#131b2e",text:"#f8fafc",muted:"#94a3b8",buttonBg:"#60a5fa",buttonText:"#090d16"},{id:"midnight-cyber",name:"Midnight Cyber",badge:"Dark \u2022 Neon Cyber",mode:"dark",primary:"#818cf8",secondary:"#6366f1",accent:"#22d3ee",background:"#09090b",card:"#18181b",text:"#f4f4f5",muted:"#a1a1aa",buttonBg:"#818cf8",buttonText:"#09090b"},{id:"royal-gold-dark",name:"Royal Gold & Dark",badge:"Dark \u2022 Imperial Gold",mode:"dark",primary:"#f59e0b",secondary:"#d97706",accent:"#fbbf24",background:"#0c0a09",card:"#1c1917",text:"#f5f5f4",muted:"#a8a29e",buttonBg:"#f59e0b",buttonText:"#0c0a09"},{id:"emerald-nocturne",name:"Emerald Nocturne",badge:"Dark \u2022 Deep Emerald",mode:"dark",primary:"#34d399",secondary:"#10b981",accent:"#6ee7b7",background:"#022c22",card:"#064e3b",text:"#ecfdf5",muted:"#a7f3d0",buttonBg:"#34d399",buttonText:"#022c22"}]});var hi=F(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.FONT_PAIRINGS=Fe.GLOBAL_FONT_OPTIONS=void 0;Fe.GLOBAL_FONT_OPTIONS=["Inter","Playfair Display","DM Sans","Poppins","Montserrat","Plus Jakarta Sans","Georgia","Editorial Serif"];Fe.FONT_PAIRINGS=[{id:"modern-clean",name:"Modern & Clean",headingFont:"Plus Jakarta Sans",bodyFont:"Inter",description:"Crisp, contemporary tech and SaaS feel with high readability"},{id:"editorial-luxury",name:"Editorial Luxury",headingFont:"Playfair Display",bodyFont:"Inter",description:"Elegant serif headline paired with neutral modern body text"},{id:"tech-forward",name:"Tech Forward",headingFont:"Inter",bodyFont:"Inter",description:"Minimalist, uniform sans-serif design system"},{id:"vibrant-lifestyle",name:"Vibrant Lifestyle",headingFont:"Poppins",bodyFont:"DM Sans",description:"Warm, geometric sans pairing suited for retail and wellness"},{id:"classic-prestige",name:"Classic Prestige",headingFont:"Montserrat",bodyFont:"Inter",description:"Authoritative, balanced typography for premium brands"}]});var bi=F(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.parseVisualCustomization=yi;Ue.customizationToTheme=Ei;Ue.mergeVisualCustomizationIntoTheme=Ys;function de(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function yi(e){return de(e)?{version:1,colors:de(e.colors)?e.colors:void 0,colorReplacements:de(e.colorReplacements)?e.colorReplacements:void 0,typography:de(e.typography)?e.typography:void 0,spacing:de(e.spacing)?e.spacing:void 0,layout:de(e.layout)?e.layout:void 0,components:de(e.components)?e.components:void 0,sections:de(e.sections)?e.sections:void 0,elementStyles:de(e.elementStyles)?e.elementStyles:void 0}:{version:1}}function Ei(e){let t=e.colors??{};return{designCustomizationVersion:1,colorReplacements:e.colorReplacements,primaryColor:t.primary,secondaryColor:t.secondary,accentColor:t.accent,backgroundColor:t.background,textColor:t.text,surfaceColor:t.surface??t.cardBackground,surfaceAltColor:t.surfaceAlt,headingColor:t.heading??t.text,mutedTextColor:t.mutedText,borderColor:t.border,headerBackgroundColor:t.headerBackground,footerBackgroundColor:t.footerBackground,cardBackgroundColor:t.cardBackground??t.surface,buttonBackgroundColor:t.buttonBackground,buttonTextColor:t.buttonText,...e.typography,...e.spacing,...e.layout,...e.components,sections:e.sections,elementStyles:e.elementStyles}}function Ys(e,t){let n=yi(t);return[n.colors,n.colorReplacements,n.typography,n.spacing,n.layout,n.components,n.sections,n.elementStyles].some(i=>!!(i&&Object.values(i).some(s=>s!==void 0&&s!=="")))?Object.fromEntries(Object.entries({...e??{},...Ei(n)}).filter(([,i])=>i!==void 0)):e??null}});var Si=F(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.generateThemeVariables=Js;var fn=un();function Js(e){let t={};if(e){for(let[h,b]of Object.entries(e))if(typeof b=="string"||typeof b=="number"){let c=`--${h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`;t[c]=String(b)}}let n=(0,fn.isDarkColor)(e?.backgroundColor),r=e?.backgroundColor||(n?"#0f172a":"#ffffff"),i=e?.textColor||(n?"#f8fafc":"#0f172a"),s=e?.mutedTextColor||(n?"rgba(248, 250, 252, 0.7)":"#64748b"),o=e?.borderColor||(n?"rgba(255, 255, 255, 0.1)":"#e2e8f0"),a=e?.cardBackgroundColor||e?.surfaceColor||(n?"#111a2e":"#ffffff"),l=n?"rgba(255, 255, 255, 0.09)":o,u=e?.primaryColor||"#2563eb",f=e?.secondaryColor||(n?"#1e293b":"#0f172a"),g=e?.accentColor||"#14b8a6",E=e?.buttonBackgroundColor||u,S=(0,fn.getAutoContrastTextColor)(E),m=e?.buttonTextColor||S,d=n?"rgba(255, 255, 255, 0.08)":f&&!(0,fn.isDarkColor)(f)?f:"#f1f5f9",p=n?"#f8fafc":"#0f172a";return{"--brand-color":u,"--brand-primary":u,"--primary-color":u,"--color-primary":u,"--brand-secondary":f,"--secondary-color":f,"--brand-accent":g,"--accent-color":g,"--page-background":r,"--page-bg":r,"--background":r,"--page-text":i,"--heading-color":e?.headingColor||(n?"#ffffff":f),"--color-heading":e?.headingColor||(n?"#ffffff":f),"--muted-text":s,"--text-muted":s,"--color-text":i,"--color-text-muted":s,"--link-color":e?.linkColor||u,"--border-primary":o,"--border":o,"--color-border":o,"--color-surface":n?"rgba(255,255,255,0.05)":"#ffffff","--card-bg":a,"--card-border":l,"--product-card-bg":a,"--product-card-border":l,"--tag-bg":n?"rgba(255, 255, 255, 0.08)":"rgba(241, 245, 249, 0.9)","--tag-color":s,"--card-shadow":n?"0 10px 25px -5px rgba(0, 0, 0, 0.4)":"0 10px 25px -5px rgba(0, 0, 0, 0.05)","--header-bg":e?.headerBackgroundColor||(n?"rgba(15, 23, 42, 0.85)":"rgba(255, 255, 255, 0.82)"),"--input-bg":n?"#1e293b":"#ffffff","--input-border":n?"rgba(255, 255, 255, 0.15)":"#cbd5e1","--input-color":i,"--button-bg":E,"--button-text":m,"--button-primary-bg":E,"--button-primary-text":m,"--button-secondary-bg":d,"--button-secondary-text":p,"--button-outline-border":n?"rgba(255, 255, 255, 0.22)":"currentColor","--button-outline-text":n?"#f8fafc":i,"--button-ghost-text":n?"#f8fafc":i,"--hero-min-height":e?.heroMinHeight||"72vh","--section-padding":e?.sectionPadding||"5rem","--base-size":e?.baseSize||"16px","--heading-font":e?.headingFont||"Inter, sans-serif","--body-font":e?.bodyFont||"Inter, sans-serif","--border-radius":e?.borderRadius||"8px","--content-align":e?.align||"left",...t}}});var Ti=F(te=>{"use strict";var Xs=te&&te.__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]})),Re=te&&te.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Xs(t,e,n)};Object.defineProperty(te,"__esModule",{value:!0});Re(pi(),te);Re(un(),te);Re(gi(),te);Re(hi(),te);Re(bi(),te);Re(Si(),te)});var wi=F(H=>{"use strict";var Qs=H&&H.__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]})),oe=H&&H.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Qs(t,e,n)};Object.defineProperty(H,"__esModule",{value:!0});oe(Yr(),H);oe(Xr(),H);oe(Qr(),H);oe(on(),H);oe(an(),H);oe(di(),H);oe(bt(),H);oe(ln(),H);oe(ui(),H);oe(Ti(),H)});var ga={};zi(ga,{runTemplatePreflight:()=>Di});module.exports=Hi(ga);var vi=require("node:child_process"),k=require("node:fs/promises"),Fi=require("node:os"),_=require("node:path"),yn=Ct(Rt());var Xn=[{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 uo={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 Qn(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:{mainPurpose:"",targetCustomers:"",preferredLanguage:"",preferredColorTheme:"",preferredStyle:"",requiredPages:t,requiredFeatures:[],customerSpecialRequirements:""},content:e??{},media:fo(),seo:null}}function fo(){let e={};for(let t of Xn){e[t.key]=[];for(let n of uo[t.key]??[])e[n]||(e[n]=[])}return e}var er=Ct(Rt()),xe={maxEntries:2e3,maxEntryUncompressedBytes:25*1024*1024,maxTotalUncompressedBytes:200*1024*1024,maxCompressionRatio:100},po=new Set([".cache",".git",".next",".npm",".pnpm-store",".turbo","__macosx","node_modules"]),mo=new Set(["build","coverage","dist","out"]);function tr(e){let t;try{t=new er.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>xe.maxEntries)throw new Error(`Template ZIP contains too many entries (${t.length}; maximum ${xe.maxEntries}).`);for(let s of t){let o=rr(s.entryName);if(r.push(o),go(o))throw new Error(`Template ZIP contains an unsafe entry: ${s.entryName||"(empty path)"}.`);if(!s.isDirectory){let a=Number(s.header.size??0),l=Number(s.header.compressedSize??0);if(!Number.isSafeInteger(a)||a<0||a>xe.maxEntryUncompressedBytes)throw new Error(`Template ZIP entry is too large after extraction: ${o}.`);if(i+=a,i>xe.maxTotalUncompressedBytes)throw new Error(`Template ZIP expands beyond the ${xe.maxTotalUncompressedBytes/(1024*1024)} MB limit.`);if(a>1024*1024&&a/Math.max(1,l)>xe.maxCompressionRatio)throw new Error(`Template ZIP entry has an unsafe compression ratio: ${o}.`)}(!s.isDirectory&&Je(o)||s.isDirectory&&Je(o))&&n.add(o)}return{entries:r,forbiddenEntries:[...n]}}function nr(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 rr(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function go(e){let t=ir(e);return!e||e.includes("\0")||e.startsWith("/")||/^[a-z]:\//i.test(e)||t.includes("..")}function Je(e){let t=rr(e),n=ir(t),r=n.at(-1)??"",i=n.some(S=>po.has(S)),s=n[0]===".yarn"&&n[1]==="cache",o=n.some(S=>mo.has(S)),a=n.some(S=>S===".deneb"||S.startsWith(".deneb-backup")),l=r===".env"||r.startsWith(".env."),u=r.endsWith(".zip"),f=r.endsWith(".log"),g=r.endsWith(".tsbuildinfo");return i||s||o||a||l||u||f||g||(r===".ds_store"||r==="thumbs.db")}function ir(e){return e.split("/").map(t=>t.trim().toLowerCase()).filter(Boolean)}var ho={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"}},yo=new Set(["text","textarea","email","tel","url","image","number","boolean","select"]),Eo={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 sr(e){if(!e||typeof e!="object")return null;let t=e,r=(Array.isArray(t.sections)?t.sections:[]).map(i=>So(i)).filter(i=>!!i);return r.length===0?null:bo({version:typeof t.version=="number"&&Number.isFinite(t.version)?t.version:1,sections:r})}function bo(e){let t=r=>/(^|\.)(products?|items?|catalog|menu|dishes?|goods|featuredproducts?|store|foods?|drinks?)$/i.test(r.trim()),n=(r,i)=>{let s=fe(i,r.key);if(r.type==="object")return{...r,fields:r.fields.map(o=>n(o,s))};if(r.type==="list"){let o=r.fields?.map(a=>n(a,`${s}[*]`));if(t(s)){let{maxItems:a,...l}=r;return{...l,fields:o}}return{...r,fields:o}}return r};return{...e,sections:e.sections.map(r=>{let i=r.fields?.map(s=>n(s,r.path));if(r.type==="list"&&t(r.path)){let{maxItems:s,...o}=r;return{...o,fields:i}}return{...r,fields:i}})}}function ar(e,t=[]){let n=new Map(t.map(i=>[i.id,i.label]));return{version:1,sections:Object.entries(e).map(([i,s])=>wo(i,s,n)).filter(i=>!!i)}}function Oe(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?Dt(o,s):s)}let n=[...t.values()],r=n.map(s=>s.path),i=n.map(s=>{let a=n.filter(u=>nt(s.path,u.path)).sort((u,f)=>or(f.path)-or(u.path)).map(u=>pr({...e,sections:[u]},s.path)).filter(u=>!!u).reduce((u,f)=>Dt(u,f),s),l=new Set(r.filter(u=>u!==s.path&&nt(u,s.path)));return Lt(a,l)}).filter(s=>!!s);return{...e,sections:i}}function rt(e){if(!e)return[];let t=new Map,n=[],r=new Set,i=(o,a,l)=>{let u=ne(o),f=t.get(u);if(!f){t.set(u,{kind:a,sectionId:l});return}r.has(u)||(r.add(u),n.push({path:u,firstKind:f.kind,duplicateKind:a,firstSectionId:f.sectionId,duplicateSectionId:l}))},s=(o,a,l)=>{if(a.type==="object"){for(let u of a.fields??[])s(fe(o,u.key),u,l);return}if(a.type==="list"){let u=ne(o);i(u,"list",l);let f=`${u}[*]`;a.itemField&&i(f,"field",l);for(let g of a.fields??[])s(fe(f,g.key),g,l);return}i(o,"field",l)};for(let o of e.sections)s(o.path,o,o.id);return n}function Nt(e,t){if(!e)return Oe(t);if(!t)return Oe(e);let n=Oe(e)??e,r=Oe(t)??t,i=n.sections.map(l=>l.path),s=n.sections.map(l=>{let u=pr(r,l.path);if(!u)return l;let f=new Set(i.filter(E=>E!==l.path&&nt(E,l.path))),g=Lt(u,f);return g?Dt(l,g):l}),o=new Set(n.sections.map(({path:l})=>l)),a=r.sections.filter(l=>!o.has(l.path)).map(l=>Lt(l,new Set(i.filter(u=>nt(u,l.path))))).filter(l=>!!l);return Oe({...t,...e,sections:[...s,...a]})}function cr(e){return e?Nt(e,Eo):null}function So(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.id),r=z(t.path),i=z(t.label),s=dr(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:Mt(t.maxLength),recommendedWidth:pe(t.recommendedWidth),recommendedHeight:pe(t.recommendedHeight),pageKey:z(t.pageKey)||void 0,...Ot(t.sharedFieldKey)};if(s==="object"){let a=Qe(t.fields);return{...o,type:s,fields:a}}if(s==="list"){let a=Qe(t.fields),l=lr(t.itemField);return a.length===0&&!l?null:{...o,type:s,fields:a.length>0?a:void 0,itemField:l??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:et(t.minItems),maxItems:et(t.maxItems)}}return{...o,type:s,options:s==="select"?$t(t.options):void 0}}function Lt(e,t){if(t.has(e.path))return null;if(e.type==="object"){let n=(e.fields??[]).map(r=>Xe(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=>Xe(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 Xe(e,t,n){let r=fe(t,e.key);if(n.has(r))return null;if(e.type==="object"){let i=e.fields.map(s=>Xe(s,r,n)).filter(s=>!!s);return i.length===0?null:{...e,fields:i}}if(e.type==="list"){let i=(e.fields??[]).map(s=>Xe(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=>To(t)).filter(t=>!!t):[]}function To(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.key),r=z(t.label),i=dr(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:Mt(t.maxLength),recommendedWidth:pe(t.recommendedWidth),recommendedHeight:pe(t.recommendedHeight),...Ot(t.sharedFieldKey)};if(i==="object")return{...s,type:i,fields:Qe(t.fields)};if(i==="list"){let o=Qe(t.fields),a=lr(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:et(t.minItems),maxItems:et(t.maxItems)}}return{...s,type:i,options:i==="select"?$t(t.options):void 0}}function lr(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.label),r=ur(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:Mt(t.maxLength),recommendedWidth:pe(t.recommendedWidth),recommendedHeight:pe(t.recommendedHeight),...Ot(t.sharedFieldKey),options:r==="select"?$t(t.options):void 0}}function Ot(e){return typeof e=="string"&&e.trim()?{sharedFieldKey:e.trim()}:{}}function $t(e){if(!Array.isArray(e))return;let t=e.map(n=>z(n)).filter(n=>!!n);return t.length>0?t:void 0}function Mt(e){return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<=1e4?e:void 0}function pe(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function et(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:void 0}function dr(e){return e==="object"?e:e==="list"||e==="array"?"list":ur(e)}function ur(e){return typeof e=="string"&&yo.has(e)?e:null}function wo(e,t,n){let r=ho[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||hr(e);return Array.isArray(t)?Po(e,a,o,t):Ee(t)?{id:e,path:e,label:a,pageKey:o,type:"object",fields:Object.entries(t).map(([l,u])=>it(l,u))}:{id:e,path:e,label:a,pageKey:o,...ot(e,t)}}function it(e,t){let n=hr(e);return Array.isArray(t)?Io(e,n,t):Ee(t)?{key:e,label:n,type:"object",fields:Object.entries(t).map(([r,i])=>it(r,i))}:{key:e,label:n,...ot(e,t)}}function Po(e,t,n,r){let i=mr(r),s=yr(t);return Ee(i)?{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,fields:Object.entries(i).map(([o,a])=>it(o,a))}:{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,itemField:{label:s,...ot(e,i)}}}function Io(e,t,n){let r=mr(n),i=yr(t);return Ee(r)?{key:e,label:t,type:"list",itemLabel:i,fields:Object.entries(r).map(([s,o])=>it(s,o))}:{key:e,label:t,type:"list",itemLabel:i,itemField:{label:i,...ot(e,r)}}}function Dt(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:tt(e.fields??[],t.fields??[])};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:fr(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 tt(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?xo(i,s):i}),...n.values()]}function xo(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:tt(e.fields,t.fields)};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:fr(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 fr(e,t){return e?!t||e.type!==t.type?e:{...t,...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}:t}function pr(e,t){let n=(i,s,o)=>{let{key:a,...l}=i;return{...l,id:o.id,path:s,pageKey:o.pageKey}},r=(i,s,o)=>{if(ne(s)===ne(t))return n(i,s,o);if(i.type==="object")for(let a of i.fields){let l=r(a,fe(s,a.key),o);if(l)return l}if(i.type==="list"){let a=`${ne(s)}[*]`;for(let l of i.fields??[]){let u=r(l,fe(a,l.key),o);if(u)return u}}return null};for(let i of e.sections){if(ne(i.path)===ne(t))return i;if(i.type==="object")for(let s of i.fields??[]){let o=r(s,fe(i.path,s.key),i);if(o)return o}if(i.type==="list"){let s=`${ne(i.path)}[*]`;for(let o of i.fields??[]){let a=r(o,fe(s,o.key),i);if(a)return a}}}return null}function nt(e,t){let n=ne(e),r=ne(t);return n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function ne(e){return e.replace(/\[\d+\]/g,"[*]").trim()}function or(e){return ne(e).split(/\.|\[/).filter(Boolean).length}function mr(e){let t=e.filter(Ee);return t.length===0?e.find(n=>n!=null):t.reduce((n,r)=>gr(n,r),{})}function gr(e,t){let n={...e};for(let[r,i]of Object.entries(t)){let s=n[r];if(Ee(s)&&Ee(i)){n[r]=gr(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 ot(e,t){let n=Co(e,t);if(n!=="image"||typeof t!="string"||!t.trim())return{type:n};try{let r=new URL(t,"https://fivora-template.invalid"),i=pe(Number(r.searchParams.get("w")??r.searchParams.get("width"))),s=pe(Number(r.searchParams.get("h")??r.searchParams.get("height")));return{type:n,...i?{recommendedWidth:i}:{},...s?{recommendedHeight:s}:{}}}catch{return{type:n}}}function Co(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 fe(e,t){return e?`${e}.${t}`:t}function z(e){return typeof e=="string"?e.trim():""}function Ee(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function hr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function yr(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 ko=["primary","secondary","accent","background","text","surface","surfaceAlt","heading","mutedText","border","headerBackground","footerBackground","cardBackground","buttonBackground","buttonText"],Ao=["headingFont","bodyFont","baseSize","headingScale","bodyLineHeight","headingLineHeight","headingWeight","bodyWeight","letterSpacing"],_o=["heroMinHeight","sectionPadding","contentMaxWidth","containerPadding","sectionGap","elementGap","gridGap"],vo=["textAlign","contentAlign","heroTextAlign","cardTextAlign","gridColumns"],Fo=["cardWidth","cardMinHeight","cardPadding","cardRadius","cardBorderWidth","cardShadow","buttonPadding","buttonRadius","buttonShadow","imageRadius","headerHeight"],Ro=["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 ie(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Do(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 Er(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 No(e){if(!ie(e))return;let t={};for(let[n,r]of Object.entries(e).slice(0,64)){if(typeof r!="string")continue;let i=Er(n),s=Er(r);!i||!s||(t[i]=s)}return Object.keys(t).length>0?t:void 0}function be(e,t){if(!ie(e))return;let n={};for(let r of t){if(typeof e[r]!="string")continue;let i=Do(e[r]);i!==void 0&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function Oo(e){return/^[a-zA-Z0-9_-]{1,64}$/.test(e)}function $o(e){return/^[a-zA-Z0-9_.:\[\]-]{1,180}$/.test(e)}function Mo(){return{version:1}}function Bo(e){if(!ie(e))return Mo();let t=be(e.colors,ko),n=No(e.colorReplacements),r=be(e.typography,Ao),i=be(e.spacing,_o),s=be(e.layout,vo),o=be(e.components,Fo),a={};if(ie(e.sections))for(let[u,f]of Object.entries(e.sections)){if(!Oo(u)||!ie(f))continue;let E={...be(f,Ro)??{}};typeof f.visible=="boolean"&&(E.visible=f.visible),Object.keys(E).length>0&&(a[u]=E)}let l={};if(ie(e.elementStyles))for(let[u,f]of Object.entries(e.elementStyles).slice(0,256)){if(!$o(u)||!ie(f))continue;let g=be(f,Lo);g&&Object.keys(g).length>0&&(l[u]=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(l).length>0?{elementStyles:l}:{}}}function br(e){if(!ie(e))return null;let t=e.themeSchema;if(!ie(t))return null;let n=Bo(ie(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 jo=e=>new Error(e),Vo=new Set(["npm install","npm ci","pnpm install","pnpm install --frozen-lockfile","yarn install","yarn install --frozen-lockfile"]),Uo=new Set(["npm run build","pnpm run build","yarn build","yarn run build"]);function Tr(e,t=jo){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=zo(r.visualEditing,i,t),o=sr(r.editorSchema),a=br(r),l=Array.isArray(r.colorPalette)?r.colorPalette.filter(E=>!!E&&typeof E=="object").flatMap(E=>{let S=typeof E.color=="string"?E.color.trim().toLowerCase():"";if(!/^#[0-9a-f]{6}$/.test(S))return[];let m=typeof E.usageCount=="number"&&Number.isFinite(E.usageCount)?Math.max(1,Math.floor(E.usageCount)):1;return[{color:S,usageCount:m}]}).slice(0,40):[],u=rt(o);if(u.length>0){let E=u.slice(0,5).map(S=>`"${S.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 f=Sr(r.installCommand,Vo,"installCommand",n),g=Sr(r.buildCommand,Uo,"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 S=typeof E.id=="string"&&E.id.trim()?E.id.trim():null,m=typeof E.label=="string"&&E.label.trim()?E.label.trim():null;return!S||!m?n("Each template manifest page must include id and label."):{id:S,label:m,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}:{},...l.length>0?{colorPalette:l}:{},outputDirectory:typeof r.outputDirectory=="string"?r.outputDirectory.trim():void 0,installCommand:f,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 Sr(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 zo(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 Ho={"data-preview-field-path":"field","data-preview-list-path":"list","data-preview-item-path":"item","data-preview-page-key":"page"},wr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*`([\s\S]*?)`\s*\}|\{\s*"([^"]*)"\s*\}|\{\s*'([^']*)'\s*\})/g,Pr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=/g,Ir=String.raw`[^.[\]\s]+`,qo=new RegExp(String.raw`^${Ir}(?:\[(?:\d+|\*)\])*(?:\.${Ir}(?:\[(?:\d+|\*)\])*)*$`),Wo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Go=new Set(["head","script","style","noscript","svg","template"]),xr=new Set(["html","body","main","header","footer","nav","section","article","aside","form","div","ul","ol","table","thead","tbody","tfoot","tr"]),st="FIVORA_PREVIEW_SITE_DATA",_r=`${["MARKET","PLACE"].join("")}_PREVIEW_`,at=`${_r}SITE_DATA`;var ct="FIVORA_PREVIEW_READY",Bt=`${_r}READY`,Zo=ct;function Ht(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))Gt(i,r,n);for(let r of t?.sections??[])Zt(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 Yt(e,t){let n=Lr(e??{});for(let r of t?.sections??[])Jo(n,r.path,r);return n}function vr(e,t){let n=structuredClone(e??{});for(let r of t?.sections??[])Ko(n,r.path,r);return Wt(n,"")}function mt(e){let t=[],n=[];for(let r of e){let i=new Set;wr.lastIndex=0;for(let s of r.content.matchAll(wr)){let o=s[1],a=s[2]??s[3]??s[4]??s[5]??s[6]??"",l=s.index??0;i.add(l),t.push({kind:Ho[o],value:Te(a).trim(),filePath:r.filePath,artifactKind:r.kind,offset:l,line:U(r.content,l)})}Pr.lastIndex=0;for(let s of r.content.matchAll(Pr)){let o=s.index??0;i.has(o)||n.push(`${r.filePath}:${U(r.content,o)} ${s[1]} must use a literal string or a JSX template literal.`)}}return{markers:t,unparseableAttributes:n}}function Fr(e){let t=e.manifestVersion>=2||e.visualEditing?.mode==="strict"?"strict":"legacy",n=[],r=[],i=Ht(e.contentDefaults,e.editorSchema),s=mt(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."),gs(e.editorSchema,n),hs(e.editorSchema,n),ts(e.editorSchema,n,e.pages),ns(e.editorSchema,e.contentDefaults,n),is(e.artifacts,n),os(e.artifacts,n),ss(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),l=J(o,"list",n),u=J(o,"item",n),f=o.filter(T=>T.artifactKind==="html"),g=J(f,"field",n),E=J(f,"list",n),S=J(f,"item",n),m=o.filter(T=>T.artifactKind==="source"),d=J(m,"field",n),p=J(m,"list",n),h=J(m,"item",n),b=Dr(e.visualEditing?.controlOnlyPaths??[],i,n);Vt({label:"editable field",expectedPatterns:i.fieldPatterns,concretePaths:i.concreteFields,htmlMarkerPaths:g,sourceMarkerPaths:d,controlOnlyPaths:b,findings:n}),Vt({label:"editable list",expectedPatterns:i.listPatterns,concretePaths:i.concreteLists,htmlMarkerPaths:E,sourceMarkerPaths:p,controlOnlyPaths:[],findings:n}),Vt({label:"editable list item",expectedPatterns:i.itemPatterns,concretePaths:i.concreteItems,htmlMarkerPaths:S,sourceMarkerPaths:h,controlOnlyPaths:[],findings:n}),Ut("field",a,i.fieldPatterns,i.concreteFields,n),Ut("list",l,i.listPatterns,i.concreteLists,n),Ut("item",u,i.itemPatterns,i.concreteItems,n),Nr(e.manifestVersion,e.pages??[],o,e.artifacts,n),Or({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:b,findings:n});let c=as(e.artifacts,e.pages??[]);t==="strict"?n.push(...c):r.push(...c);let y=G(n),w=G(r);return t==="legacy"?{mode:t,errors:[],warnings:G([...y.map(T=>`[legacy] ${T}`),...w]),inventory:i,markers:o}:{mode:t,errors:y,warnings:w,inventory:i,markers:o}}function Rr(e){let t=[],n=[],r=Ht(e.contentDefaults,e.editorSchema),i=Yt(e.contentDefaults,e.editorSchema),s=Ht(i,e.editorSchema),o=G([...r.fieldPatterns.filter(d=>!d.includes("[*]")),...s.concreteFields]),a=G([...r.listPatterns.filter(d=>!d.includes("[*]")),...s.concreteLists]),l=s.concreteItems,u=e.artifacts.filter(d=>d.kind==="html"),f=mt(u),g=J(f.markers,"field",t),E=J(f.markers,"list",t),S=J(f.markers,"item",t),m=Dr(e.visualEditing?.controlOnlyPaths??[],r,t);jt({markerPaths:g,expectedPaths:s.concreteFields,knownPatterns:r.fieldPatterns,attribute:"field",findings:t}),jt({markerPaths:E,expectedPaths:s.concreteLists,knownPatterns:r.listPatterns,attribute:"list",findings:t}),jt({markerPaths:S,expectedPaths:s.concreteItems,knownPatterns:r.itemPatterns,attribute:"item",findings:t});for(let d of o)ft(d,m)||g.includes(d)||t.push(`Empty-state export removed data-preview-field-path="${d}". Keep the editable target mounted when its value is empty, false, or zero.`);for(let d of a)E.includes(d)||t.push(`Empty-state export removed data-preview-list-path="${d}". Keep the list container mounted when the list has no items.`);for(let d of l)S.includes(d)||t.push(`Empty-state export removed data-preview-item-path="${d}" required by minItems/required list validation.`);return Nr(e.manifestVersion,e.pages??[],f.markers,u,t),Or({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:f.markers,fieldPaths:o,listPaths:a,itemPaths:l,controlOnlyPaths:m,findings:t}),n.push(...f.unparseableAttributes),{errors:G(t),warnings:G(n),requiredFieldPaths:o,requiredListPaths:a,requiredItemPaths:l}}function jt(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(Z(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 Ko(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);qt(i,s,n,t)}function qt(e,t,n,r){if(n.type==="list"){let i=Array.isArray(e[t])?[...e[t]]:[],s=Se(n.maxItems),o=Math.min(s??Number.MAX_SAFE_INTEGER,s===0?0:Math.max(1,Se(n.minItems)??(n.required?1:0)));for(;i.length<o;)i.push(void 0);e[t]=i.map((a,l)=>{let u=`${r}[${l}]`;if(n.itemField)return Cr(a,n.itemField.type,u,n.itemField.options);let f=Q(a)?a:{};for(let g of n.fields??[])qt(f,g.key,g,X(u,g.key));return f});return}if(n.type==="object"){let i=Q(e[t])?e[t]:{};e[t]=i;for(let s of n.fields??[])qt(i,s.key,s,X(r,s.key));return}e[t]=Cr(e[t],n.type,r,n.options)}function Cr(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]??lt(n):t==="url"?`https://template-validation.example.invalid/${dt(n)}`:t==="image"?`/template-validation-${dt(n)}.svg`:t==="email"?"validation@example.invalid":t==="tel"?"+12025550142":lt(n)}function Wt(e,t){return Array.isArray(e)?e.map((n,r)=>Wt(n,`${t}[${r}]`)):Q(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let i=X(t,n);return[n,Wt(r,i)]})):typeof e=="string"?e.trim()?e:Yo(t):typeof e=="number"?Number.isFinite(e)&&e!==0?e:1:typeof e=="boolean"?!0:e??lt(t)}function Yo(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-${dt(e)}.svg`:t.includes("url")||t.includes("link")?`https://template-validation.example.invalid/${dt(e)}`:lt(e)}function lt(e){return`Validation ${e||"content"}`}function dt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"content"}function Lr(e){return Array.isArray(e)?[]:Q(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Lr(n)])):typeof e=="string"?"":typeof e=="number"?0:typeof e=="boolean"?!1:e}function Jo(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);Jt(i,s,n)}function Jt(e,t,n){if(n.type==="list"){let r=Math.min(Se(n.maxItems)??Number.MAX_SAFE_INTEGER,Se(n.minItems)??(n.required?1:0));e[t]=Array.from({length:r},()=>Xo(n));return}if(n.type==="object"){let r=Q(e[t])?e[t]:{};e[t]=r;for(let i of n.fields??[])Jt(r,i.key,i);return}e[t]=n.type==="number"?0:n.type==="boolean"?!1:""}function Xo(e){if(e.itemField)return e.itemField.type==="number"?0:e.itemField.type==="boolean"?!1:"";let t={};for(let n of e.fields??[])Jt(t,n.key,n);return t}function Gt(e,t,n){if(Array.isArray(e)){let r=Z(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)?Gt(i,o,n):(n.fieldPatterns.add(Z(o)),n.concreteFields.add(o))});return}if(Q(e)){for(let[r,i]of Object.entries(e))Gt(i,X(t,r),n);return}n.fieldPatterns.add(Z(t)),n.concreteFields.add(t)}function Zt(e,t,n){if(t.type==="object"){for(let r of t.fields??[])Zt(X(e,r.key),r,n);return}if(t.type==="list"){let r=Z(e),i=`${r}[*]`;n.listPatterns.add(r),n.itemPatterns.add(i),t.itemField&&n.fieldPatterns.add(i);for(let s of t.fields??[])Zt(X(i,s.key),s,n);return}n.fieldPatterns.add(Z(e))}function J(e,t,n){let r=[];for(let i of e.filter(s=>s.kind===t)){let s=$e(i.value);if(!s){n.push(`${i.filePath}:${Br(i)} has invalid data-preview-${t}-path "${i.value}".`);continue}r.push(s)}return G(r)}function Dr(e,t,n){let r=[];for(let i of e){let s=$e(i);if(!s){n.push(`controlOnlyPaths contains invalid path "${i}".`);continue}if(![...t.fieldPatterns,...t.concreteFields].some(a=>Kt(s,a))){n.push(`controlOnlyPaths contains unknown editable field path "${s}".`);continue}r.push(s)}return G(r)}function Vt(e){for(let t of e.expectedPatterns){if(ft(t,e.controlOnlyPaths))continue;let n=e.concretePaths.filter(r=>Z(r)===t);if(!t.includes("[*]")){e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${zt(e.label)}="${t}" for ${e.label}.`);continue}e.sourceMarkerPaths.some(r=>ys(r,t))||e.findings.push(`Source is missing dynamic data-preview-${zt(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)||ft(t,e.controlOnlyPaths)||e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${zt(e.label)}="${t}" for concrete ${e.label}.`)}function Ut(e,t,n,r,i){for(let s of t)n.some(a=>Kt(s,a))||r.some(a=>Kt(s,a))||i.push(`data-preview-${e}-path references unknown path "${s}".`)}function Nr(e,t,n,r,i){let s=r.filter(f=>f.kind==="html"),o=n.filter(f=>f.kind==="page"&&f.artifactKind==="html"),a=new Set(t.map(f=>f.id)),l=new Set,u=new Map;t.length===0&&i.push("Strict visual editing requires at least one manifest pages[] entry.");for(let f of t){l.has(f.id)&&i.push(`Manifest pages[] contains duplicate id "${f.id}".`),l.add(f.id);let g=Qt(f.route)??(e<2?Mr(f.id):null);if(!g){i.push(`Manifest page "${f.id}" must declare a canonical route for strict visual editing.`);continue}let E=u.get(g);E?i.push(`Manifest pages "${E}" and "${f.id}" use duplicate route "${g}".`):u.set(g,f.id);let S=s.filter(p=>en(p.filePath,g));if(S.length===0){i.push(`Manifest page "${f.id}" route "${g}" has no exported HTML file.`);continue}let m=new Set(S.map(p=>p.filePath));o.some(p=>p.value===f.id&&m.has(p.filePath))||i.push(`Exported route "${g}" is missing data-preview-page-key="${f.id}".`)}for(let f of n.filter(g=>g.kind==="page"))a.has(f.value)||i.push(`${f.filePath}:${Br(f)} data-preview-page-key references unknown manifest page "${f.value}".`)}function Or(e){let t=(e.schema?.sections??[]).map(i=>({section:i,canonicalPath:$e(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"&&ft(o,e.controlOnlyPaths))continue;let a=t.filter(E=>Qo(o,E.canonicalPath)).sort((E,S)=>S.canonicalPath.length-E.canonicalPath.length)[0];if(!a?.section.pageKey)continue;let l=n.get(a.section.pageKey);if(!l){e.findings.push(`editorSchema section "${a.section.path}" assigns ${kr(i)} "${o}" to unknown manifest page "${a.section.pageKey}".`);continue}let u=Qt(l.route)??(e.manifestVersion<2?Mr(l.id):null);!u||!e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&$e(E.value)===o)||e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&$e(E.value)===o&&en(E.filePath,u))||e.findings.push(`Page-owned ${kr(i)} "${o}" from editorSchema section "${a.section.path}" must render data-preview-${es(i)}="${o}" on manifest page "${l.id}" route "${u}". Shared sections without pageKey may render globally.`)}};r("field",G(e.fieldPaths)),r("list",G(e.listPaths)),r("item",G(e.itemPaths))}function Qo(e,t){let n=Z(e),r=Z(t);return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function kr(e){return e==="field"?"editable field":e==="list"?"editable list":"editable list item"}function es(e){return e==="field"?"field-path":e==="list"?"list-path":"item-path"}function ts(e,t,n=[]){let r=new Set(n.map(o=>o.id?.trim()).filter(o=>!!o)),i=(o,a)=>{if(!a?.some(l=>typeof l=="string"&&l.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 u of a){let f=typeof u=="string"?u.trim():"";f&&f!=="none"&&f!=="external"&&!r.has(f)&&t.push(`editorSchema select field "${o}" declares destination option "${f}" 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 u of a.fields??[])s(X(o,u.key),u);return}if(a.type!=="list")return;let l=`${Z(o)}[*]`;a.itemField?.type==="select"&&i(l,a.itemField.options);for(let u of a.fields??[])s(X(l,u.key),u)};for(let o of e?.sections??[])s(o.path,o)}function ns(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=Se(o.minItems),l=Se(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&&l===null&&n.push(`editorSchema list "${s}" maxItems must be a non-negative safe integer.`);let u=a??(o.required?1:0);l!==null&&u>l&&n.push(`editorSchema list "${s}" requires at least ${u} item${u===1?"":"s"} but maxItems is ${l}. Increase maxItems or lower minItems/required.`);let f=`${Z(s)}[*]`;for(let g of o.fields??[])r(X(f,g.key),g)},i=(s,o,a)=>{if(o.type==="object"){let f=Q(a)?a:{};for(let g of o.fields??[])i(X(s,g.key),g,f[g.key]);return}if(o.type!=="list")return;let l=Array.isArray(a)?a:[],u=Se(o.maxItems);u!==null&&l.length>u&&n.push(`site-data.json content list "${s}" contains ${l.length} items, exceeding editorSchema maxItems ${u}.`);for(let[f,g]of l.entries()){let E=Q(g)?g:{};for(let S of o.fields??[])i(X(`${s}[${f}]`,S.key),S,E[S.key])}};for(let s of e?.sections??[])r(s.path,s),i(s.path,s,rs(t??{},s.path))}function Se(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:null}function rs(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 is(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(f=>f.exec(r.content)).find(f=>!!f),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),l=s>=0&&a&&o;if(!i&&!l)continue;let u=i?.index??s;t.push(`${r.filePath}:${U(r.content,u)} 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 os(e,t){let n=e.filter(S=>S.kind==="source"),r=n.map(S=>S.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(st)||r.includes(at),o=r.includes(ct)||r.includes(Bt),a=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(r)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(r),l=/\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),u=n.some(S=>{let m=S.content,d=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(m)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(m),p=/\bset[A-Z_$][\w$]*\s*\(/m.test(m)||/\bdispatch\s*\(/m.test(m)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(m);return(m.includes(st)||m.includes(at))&&d&&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(S=>(S.content.includes(ct)||S.content.includes(Bt))&&/\bpostMessage\s*\(/m.test(S.content));s||t.push(`Preview runtime source must implement the "${st}" (or legacy "${at}") 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 "${ct}" (or legacy "${Bt}") protocol so the editor can wait for a live preview before sending data.`),(!a||!l||!u)&&t.push(`Preview runtime source must handle "${st}" (or legacy "${at}") 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 "${Zo}" after its live-data listener is ready.`)}function ss(e,t,n,r){let i=e.filter(S=>S.kind==="source"),s=[/\/products\/\$\{/m,/['"`]\/products\/['"`]\s*\+\s*(?:encodeURIComponent\s*\()?/m];for(let S of i){let m=s.map(d=>d.exec(S.content)).find(d=>!!d);m&&r.push(`${S.filePath}:${U(S.content,m.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(S=>S.path==="products"||S.path.startsWith("products["))||i.some(S=>/data-preview-(?:list|item|field)-path\s*=\s*(?:["']products|\{\s*`products)/m.test(S.content)),a=i.some(S=>/\bplatformProductDetailHref\s*\(/m.test(S.content)||/\/products\/detail\/?\?[^'"`\s}]*\bid=/m.test(S.content)),l=i.some(S=>/(?:^|\/)src\/(?:app\/products\/detail\/page|pages\/products\/detail)\.[cm]?[jt]sx?$/i.test(S.filePath.replace(/\\/g,"/"))||/\b(?:PlatformProductDetail|usePlatformProductDetail)\b/m.test(S.content)),u=i.some(S=>/(?:^|\/)src\/(?:app\/products\/\[[^/]+\]\/page|pages\/products\/\[[^/]+\])\.[cm]?[jt]sx?$/i.test(S.filePath.replace(/\\/g,"/"))),f=i.some(S=>/\brenderProduct\s*=/m.test(S.content)||/\busePlatformProductDetail\s*\(/m.test(S.content)),g=a||l||o&&u;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&&!l&&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&&u&&l&&!f&&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(S=>S.kind==="html"&&/(?:^|\/)products\/detail\/(?:index\.)?html$/i.test(S.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 as(e,t){let n=[];for(let r of e.filter(i=>i.kind==="html"&&!cs(i.filePath,t)))n.push(...ls(r));return n}function cs(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");return/^(?:404|500|_error|_not-found)(?:\/index)?\.html$/i.test(n)?!t.some(i=>{let s=Qt(i.route);return s?en(n,s):!1}):!1}function ls(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 u=s.slice(2,-1).trim().split(/\s+/)[0]?.toLowerCase(),f=n.map(g=>g.tag).lastIndexOf(u);f>=0&&(t.push(...ds(e,n[f])),n.splice(f));continue}if(s.startsWith("<")){let u=s.match(/^<\s*([a-zA-Z0-9:-]+)/);if(!u)continue;let f=u[1].toLowerCase(),g=/\bdata-preview-field-path\s*=/.test(s),E=/\bdata-preview-list-path\s*=/.test(s),S=/\bdata-preview-item-path\s*=/.test(s),m=g||E||S;if(g)for(let T of n)T.ownsFieldMarker&&(T.hasNestedFieldMarker=!0);let d=s.match(/\bdata-preview-static\s*=\s*(?:"([^"]*)"|'([^']*)')/),p=!!d;p&&!(d?.[1]??d?.[2]??"").trim()&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static requires a reason.`),m&&(p||a?.staticCovered)&&t.push(`${e.filePath}:${U(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&&xr.has(f)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-field-path cannot be placed on broad <${f}> content containers. Put the marker on the exact visible text, media, link, or control that the field edits.`),p&&xr.has(f)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static cannot cover a broad <${f}> content container. Mark only the smallest genuinely non-editable element.`);let h=!!a?.hidden||ms(s,f);m&&h&&t.push(`${e.filePath}:${U(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 b=s.match(/\bdata-preview-field-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null,c=s.match(/\bdata-preview-item-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null;c&&a?.itemPath&&!Ar(c,a.itemPath)&&t.push(`${e.filePath}:${U(e.content,o)} repeated item "${c}" is nested inside unrelated item "${a.itemPath}". One visual card must be one object-list item; do not couple parallel arrays by index.`);let y=c??a?.itemPath??null;b&&y&&/\[\d+\]/.test(b)&&!Ar(b,y)&&t.push(`${e.filePath}:${U(e.content,o)} repeated field "${b}" is rendered inside item "${y}" 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:f,ignored:!!a?.ignored||Go.has(f),hidden:h,fieldCovered:!!a?.fieldCovered||g,staticCovered:!!a?.staticCovered||p,ownsFieldMarker:g,hasNestedFieldMarker:!1,fieldPath:b,itemPath:y,shopAttributeValues:us(s,f),visibleTextParts:[],offset:o};if(!w.ignored&&!w.fieldCovered&&!w.staticCovered){let T=ps(e,s,f,o);t.push(...T),f==="img"&&!w.hidden&&T.length===0&&t.push(`${e.filePath}:${U(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(f)&&!/\/\s*>$/.test(s)&&n.push(w);continue}let l=Xt(s);if(ut(l))for(let u of n)u.ownsFieldMarker&&u.visibleTextParts.push(l);a?.ignored||a?.fieldCovered||a?.staticCovered||ut(l)&&t.push(`${e.filePath}:${U(e.content,o)} visible text "${pt(l,72)}" is not covered by data-preview-field-path or data-preview-static.`)}return t}function Ar(e,t){let n=Te(e).trim(),r=Te(t).trim();return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function ds(e,t){if(!t.ownsFieldMarker||t.hasNestedFieldMarker||t.shopAttributeValues.length===0)return[];let n=Xt(t.visibleTextParts.join(" "));return!ut(n)||t.shopAttributeValues.some(r=>fs(r,n))?[]:[`${e.filePath}:${U(e.content,t.offset)} data-preview-field-path="${t.fieldPath??""}" cannot cover both <${t.tag}> action/media attributes and different visible text "${pt(n,72)}". Put the action/media marker on the element and the label marker on an exact nested text element.`]}function us(e,t){return[...e.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)].map(n=>({name:n[1].toLowerCase(),value:Te(n[2]??n[3]??"").trim()})).filter(({name:n,value:r})=>$r(t,n,r)).map(({value:n})=>n)}function fs(e,t){let n=r=>Te(r).replace(/^(?:mailto:|tel:|sms:|https?:\/\/)/i,"").replace(/^www\./i,"").replace(/\/+$/g,"").replace(/\s+/g,"").toLowerCase();return n(e)===n(t)}function ps(e,t,n,r){let i=[],s=[...t.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)];for(let f of s){let g=f[1].toLowerCase(),E=Te(f[2]??f[3]??"").trim();$r(n,g,E)&&i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(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),l=(a?.[1]??a?.[2]??"").toLowerCase();for(let f of o){let g=f[1].toLowerCase(),E=Xt(f[2]??f[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(l))||!ut(E)||i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let u=t.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i);return u&&/(?:background|background-image)\s*:[^;]*url\(/i.test(u[1]??u[2]??"")&&i.push(`${e.filePath}:${U(e.content,r)} background image is not covered by data-preview-field-path or data-preview-static.`),i}function ms(e,t){let n=e.replace(/="[^"]*"|='[^']*'/g,'=""');if(/(?<![\w-])hidden(?:[\s=]|\/?>)/i.test(n)||/\baria-hidden\s*=\s*(?:"true"|'true')/i.test(e))return!0;if(t==="input"){let s=e.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i);if((s?.[1]??s?.[2]??"").trim().toLowerCase()==="hidden")return!0}let r=e.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i),i=r?.[1]??r?.[2]??"";return/\bdisplay\s*:\s*none\b/i.test(i)||/\bvisibility\s*:\s*hidden\b/i.test(i)}function gs(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 hs(e,t){for(let n of rt(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 $r(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 Xt(e){return Te(e).replace(/\s+/g," ").trim()}function ut(e){return e.length<=2||!new RegExp("\\p{L}","u").test(e)?!1:!/^(?:true|false|null|undefined)$/i.test(e)}function zt(e){return e==="editable field"?"field-path":e==="editable list"?"list-path":"item-path"}function ys(e,t){return t.includes("[*]")?e.includes("[*]")&&e===t:e===t}function Kt(e,t){return Z(e)===Z(t)}function ft(e,t){return t.some(n=>n.includes("[*]")?Z(e)===n:e===n)}function $e(e){let t=e.trim().replace(/\[\s*\$\{[^}]+\}\s*\]/g,"[*]").replace(/\[\s+/g,"[").replace(/\s+\]/g,"]");return qo.test(t)?t:null}function Z(e){return e.replace(/\[\d+\]/g,"[*]")}function X(e,t){return e?`${e}.${t}`:t}function Qt(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 Mr(e){return e==="home"?"/":`/${e}`}function en(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 Te(e){return e.replace(/&quot;/gi,'"').replace(/&#39;|&#x27;/gi,"'").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&nbsp;/gi," ")}function Br(e){return e.line}function U(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 pt(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}\u2026`}function Vr(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 jr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Es(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 Ur(e,t=[]){let r=(jr(e)&&Array.isArray(e.pages)?e.pages:[]).flatMap((s,o)=>{if(!jr(s)||typeof s.id!="string"||!s.id.trim())return[];let a=s.id.trim(),l=typeof s.label=="string"&&s.label.trim()?s.label.trim():a.replace(/_/g," ");return[{id:a,label:l,route:Es(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 zr(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,"")||"",u=`/${(a&&(o===a||o.startsWith(`${a}/`))?o.slice(a.length)||"/":o).replace(/\/index\.html$/i,"/").replace(/\.html$/i,"").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"")}`,f=u==="/"?"/":u,g=n.find(E=>{let S=E.route==="/"?"/":`/${E.route.replace(/^\/+|\/+$/g,"")}`;return S==="/"?f==="/":f===S||f.startsWith(`${S}/`)});g&&r.push({pageId:g.id,route:g.route,href:o})}return r}function Hr(e){let t=[],n=new Set(["router","navigation"]),r=new Set(["useRouter"]),i=new Set(["Link"]),s=d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=d=>{let p=d.replace(/\s+/g," ").trim();return p.length>180?`${p.slice(0,177)}...`:p},a=(d,p,h)=>{let b=1,c=null,y=!1,w=!1,T=!1;for(let P=d;P<e.length;P+=1){let x=e[P],v=e[P+1];if(w){x===`
4
+ `&&(w=!1);continue}if(T){x==="*"&&v==="/"&&(T=!1,P+=1);continue}if(c){y?y=!1:x==="\\"?y=!0:x===c&&(c=null);continue}if(x==="/"&&v==="/"){w=!0,P+=1;continue}if(x==="/"&&v==="*"){T=!0,P+=1;continue}if(x==="'"||x==='"'||x==="`"){c=x;continue}if(x===p)b+=1;else if(x===h&&(b-=1,b===0))return e.slice(d,P)}return e.slice(d,Math.min(e.length,d+4e3))},l=d=>{let p=c=>c.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g," ").replace(/`(?:\\.|[^`\\])*`/g," ").replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/[^\r\n]*/g," "),h=[...d.matchAll(/\$\{([\s\S]*?)\}/g)].map(c=>p(c[1])).join(" "),b=p(d);return/\b(?:[A-Za-z_$][\w$]*\s*\.\s*)*(?:[A-Za-z_$][\w$]*(?:base_?path|path_?base)[\w$]*|platformProductDetailHref)\b/i.test(`${b} ${h}`)},u=(d,p)=>{t.push({line:e.slice(0,d).split(/\r?\n/).length,expression:o(p),offset:d})};for(let d of e.matchAll(/\bimport\s*\{([^}]*)\}\s*from\s*['"]next\/(?:navigation|router)['"]/g))for(let p of d[1].split(",")){let h=p.trim().match(/^useRouter(?:\s+as\s+([A-Za-z_$][\w$]*))?$/)?.[1];h&&r.add(h)}let f=[...r].map(s).join("|"),g=new RegExp(`\\b(?:const|let|var)\\s+([A-Za-z_$][\\w$]*)\\s*(?::[^=;]+)?=\\s*(?:${f})\\s*\\(`,"g");for(let d of e.matchAll(g))n.add(d[1]);for(let d of e.matchAll(/\bimport\s+([^;]{0,300}?)\s+from\s*['"]next\/link['"]/g)){let p=d[1].trim(),h=p.match(/^([A-Za-z_$][\w$]*)/i)?.[1];h&&h!=="type"&&i.add(h);for(let b of p.matchAll(/\bdefault\s+as\s+([A-Za-z_$][\w$]*)/g))i.add(b[1])}for(let d of e.matchAll(/\b([A-Za-z_$][\w$]*)\s*\.\s*(push|replace|prefetch)\s*\(/g)){let p=d[1];if(!n.has(p)&&!/(?:router|navigation)/i.test(p))continue;let h=a((d.index??0)+d[0].length,"(",")");l(h)&&u(d.index??0,`${p}.${d[2]}(${h})`)}let E=new RegExp(`\\b(?:${f})\\s*\\(\\s*\\)\\s*\\.\\s*(push|replace|prefetch)\\s*\\(`,"g");for(let d of e.matchAll(E)){let p=a((d.index??0)+d[0].length,"(",")");l(p)&&u(d.index??0,`${d[0]}${p})`)}let S=[...i].map(s).join("|"),m=new RegExp(`<(${S})\\b[^>]{0,2000}?\\bhref\\s*=\\s*\\{`,"g");for(let d of e.matchAll(m)){let p=a((d.index??0)+d[0].length,"{","}");l(p)&&u(d.index??0,`<${d[1]} href={${p}}>`)}return t.sort((d,p)=>d.offset-p.offset).filter((d,p,h)=>p===0||d.offset!==h[p-1].offset).map(({line:d,expression:p})=>({line:d,expression:p}))}var wt=Ct(wi());function Pi(e){let t=[],n=new Set;for(let s of e.artifacts)if(s.kind==="html")for(let o of(0,wt.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,wt.validateStyleTree)(i,n.size>0?n:void 0)),t}var Le="deneb-template-validator",xt="1.0.0",Pt="fivora-template.json",Ri=2500,Li=12*1024*1024,En="/uploads/generated-sites/template-preview/simulation",ea=`https://fivora.example.invalid${En}/`,ta={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",NPM_CONFIG_PREFER_OFFLINE:"true",npm_config_prefer_offline:"true",NPM_CONFIG_AUDIT:"false",npm_config_audit:"false",NPM_CONFIG_FUND:"false",npm_config_fund:"false",NPM_CONFIG_UPDATE_NOTIFIER:"false",npm_config_update_notifier:"false",NPM_CONFIG_PROGRESS:"false",npm_config_progress:"false",PNPM_CONFIG_IGNORE_SCRIPTS:"true",YARN_IGNORE_SCRIPTS:"true",YARN_PRODUCTION:"false"},gn=class{constructor(t,n){this.options=t;this.report={validator:Le,version:xt,command:t.command,input:(0,_.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}
5
+ `);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} (${_i(Date.now()-i)})
6
6
  `),s}catch(s){throw this.report.steps.push({name:t,status:"failed",durationMs:Date.now()-i,detail:He(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}
7
7
  `)}finish(t,n){this.report.durationMs=Date.now()-t.getTime(),n&&(this.report.status="failed",this.report.error=He(n))}print(){if(this.options.json){process.stdout.write(`${JSON.stringify(this.report,null,2)}
8
8
  `);return}if(this.report.status==="passed"){process.stdout.write(`
9
- Template preflight PASSED in ${ki(this.report.durationMs)}.
9
+ Template preflight PASSED in ${_i(this.report.durationMs)}.
10
10
  `),this.report.output&&process.stdout.write(`Upload-ready ZIP: ${this.report.output}
11
11
  `);return}process.stderr.write(`
12
12
  Template preflight FAILED.
13
13
  ${this.report.error??"Unknown validation error."}
14
- `)}};async function Ni(e=process.argv.slice(2)){let t;try{t=da(e)}catch(s){let o=He(s);return e.includes("--json")?process.stdout.write(`${JSON.stringify({validator:De,version:xt,status:"failed",error:o},null,2)}
14
+ `)}};async function Di(e=process.argv.slice(2)){let t;try{t=ua(e)}catch(s){let o=He(s);return e.includes("--json")?process.stdout.write(`${JSON.stringify({validator:Le,version:xt,status:"failed",error:o},null,2)}
15
15
  `):process.stderr.write(`${o}
16
- Run "${De} --help" for usage.
17
- `),1}if(!t)return 0;let n=new Date,r=new gn(t,n),i=await(0,_.mkdtemp)((0,k.join)((0,Fi.tmpdir)(),"fivora-preflight-"));try{if(t.command==="package"){let s=(0,k.resolve)(t.outputPath??(0,k.join)((0,k.dirname)((0,k.resolve)(t.inputPath)),"fivora-template.zip"));await $i(s,t.force);let o=(0,k.join)(i,"fivora-template.zip"),l=await r.step("Create clean source package",()=>Li((0,k.resolve)(t.inputPath),o)),c=await(0,_.readFile)(o);await r.step("Check final ZIP policy",()=>{It(c)});let u=await hn(c,(0,k.join)(i,"validated-source"));await xi(u,t,r),await ca(o,s,t.force),r.report.output=s,r.report.steps.push({name:"Publish validated ZIP",status:"passed",durationMs:0,detail:`${l.files} files, ${pa(l.bytes)}, ${l.excluded} generated or private entries excluded`})}else{let s=await ta((0,k.resolve)(t.inputPath),i,t,r);s.archiveBuffer&&await r.step("Check ZIP policy",()=>{It(s.archiveBuffer)}),await xi(s.sourceDir,t,r)}return r.finish(n),r.print(),0}catch(s){return r.finish(n,s),r.print(),1}finally{await(0,_.rm)(i,{recursive:!0,force:!0}).catch(()=>{})}}async function ta(e,t,n,r){let i;try{i=await(0,_.stat)(e)}catch{throw new Error(`Template path does not exist: ${e}`)}if(i.isFile()){if((0,k.extname)(e).toLowerCase()!==".zip")throw new Error("Template input file must be a .zip archive.");if(n.skipBuild||n.skipInstall)throw new Error("--skip-build and --skip-install can only be used with a working source directory, not a ZIP archive.");let u=await(0,_.readFile)(e);return{sourceDir:await hn(u,(0,k.join)(t,"uploaded-source")),archiveBuffer:u}}if(!i.isDirectory())throw new Error("Template input must be a source directory or .zip archive.");if(n.skipBuild||n.skipInstall)return r.warn("Skip flags validate the working directory in place and are diagnostic only; they do not prove that a clean ZIP is upload-ready."),{sourceDir:e,archiveBuffer:null};let s=(0,k.join)(t,"source-snapshot.zip"),o=await r.step("Prepare isolated source-only snapshot",()=>Li(e,s)),l=await(0,_.readFile)(s);return It(l),{sourceDir:await hn(l,(0,k.join)(t,"source-snapshot")),archiveBuffer:l,packageResult:o}}function Ii(e){return!e||e==="*"||e==="latest"?!0:e.split("||").map(n=>n.trim()).some(n=>{let r=n.match(/>=s*(\d+)/);if(r)return parseInt(r[1],10)<=20;let i=n.match(/\^\s*(\d+)/);if(i)return parseInt(i[1],10)<=20;let s=n.match(/~\s*(\d+)/);if(s)return parseInt(s[1],10)<=20;let o=n.match(/^(\d+)/);return o?parseInt(o[1],10)===20:!0})}async function na(e,t){parseInt(process.versions.node.split(".")[0],10)>20&&t.warn(`Local Node.js (v${process.versions.node}) is newer than the Fivora platform target runtime (Node 20 LTS). Verifying dependencies for Node 20 compatibility...`);let r=(0,k.join)(e,"package.json"),i;try{i=JSON.parse(await(0,_.readFile)(r,"utf8"))}catch{return}if(i.engines?.node&&!Ii(i.engines.node))throw new Error(`Template package.json specifies engines.node "${i.engines.node}", which is incompatible with the Fivora platform runtime (Node 20 LTS). Update engines.node to support Node 20 (e.g. ">=20.0.0").`);let s=(0,k.join)(e,"package-lock.json"),o="";try{o=await(0,_.readFile)(s,"utf8")}catch{return}let l;try{l=JSON.parse(o)}catch{return}let c=[],u=l.packages||{};for(let[f,g]of Object.entries(u)){if(!f||f==="")continue;let E=g?.engines?.node;if(E&&typeof E=="string"&&!Ii(E)){let S=g.name||f.replace(/^node_modules\//,""),m=g.version||"";c.push(`${S}${m?`@${m}`:""} (requires Node "${E}")`)}}if(c.length>0){let f=c.slice(0,10).map(E=>` - ${E}`).join(`
18
- `),g=c.length>10?`
19
- - ...and ${c.length-10} more`:"";throw new Error(`Template package includes dependencies that are incompatible with the Fivora platform runtime (Node 20 LTS):
16
+ Run "${Le} --help" for usage.
17
+ `),1}if(!t)return 0;let n=new Date,r=new gn(t,n),i=await(0,k.mkdtemp)((0,_.join)((0,Fi.tmpdir)(),"fivora-preflight-"));try{if(t.command==="package"){let s=(0,_.resolve)(t.outputPath??(0,_.join)((0,_.dirname)((0,_.resolve)(t.inputPath)),"fivora-template.zip"));await $i(s,t.force);let o=(0,_.join)(i,"fivora-template.zip"),a=await r.step("Create clean source package",()=>Ni((0,_.resolve)(t.inputPath),o)),l=await(0,k.readFile)(o);await r.step("Check final ZIP policy",()=>{It(l)});let u=await hn(l,(0,_.join)(i,"validated-source"));await xi(u,t,r),await da(o,s,t.force),r.report.output=s,r.report.steps.push({name:"Publish validated ZIP",status:"passed",durationMs:0,detail:`${a.files} files, ${ma(a.bytes)}, ${a.excluded} generated or private entries excluded`})}else{let s=await na((0,_.resolve)(t.inputPath),i,t,r);s.archiveBuffer&&await r.step("Check ZIP policy",()=>{It(s.archiveBuffer)}),await xi(s.sourceDir,t,r)}return r.finish(n),r.print(),0}catch(s){return r.finish(n,s),r.print(),1}finally{await(0,k.rm)(i,{recursive:!0,force:!0}).catch(()=>{})}}async function na(e,t,n,r){let i;try{i=await(0,k.stat)(e)}catch{throw new Error(`Template path does not exist: ${e}`)}if(i.isFile()){if((0,_.extname)(e).toLowerCase()!==".zip")throw new Error("Template input file must be a .zip archive.");if(n.skipBuild||n.skipInstall)throw new Error("--skip-build and --skip-install can only be used with a working source directory, not a ZIP archive.");let u=await(0,k.readFile)(e);return{sourceDir:await hn(u,(0,_.join)(t,"uploaded-source")),archiveBuffer:u}}if(!i.isDirectory())throw new Error("Template input must be a source directory or .zip archive.");if(n.skipBuild||n.skipInstall)return r.warn("Skip flags validate the working directory in place and are diagnostic only; they do not prove that a clean ZIP is upload-ready."),{sourceDir:e,archiveBuffer:null};let s=(0,_.join)(t,"source-snapshot.zip"),o=await r.step("Prepare isolated source-only snapshot",()=>Ni(e,s)),a=await(0,k.readFile)(s);return It(a),{sourceDir:await hn(a,(0,_.join)(t,"source-snapshot")),archiveBuffer:a,packageResult:o}}function Ii(e){return!e||e==="*"||e==="latest"?!0:e.split("||").map(n=>n.trim()).some(n=>{let r=n.match(/>=s*(\d+)/);if(r)return parseInt(r[1],10)<=20;let i=n.match(/\^\s*(\d+)/);if(i)return parseInt(i[1],10)<=20;let s=n.match(/~\s*(\d+)/);if(s)return parseInt(s[1],10)<=20;let o=n.match(/^(\d+)/);return o?parseInt(o[1],10)===20:!0})}async function ra(e,t){parseInt(process.versions.node.split(".")[0],10)>20&&t.warn(`Local Node.js (v${process.versions.node}) is newer than the Fivora platform target runtime (Node 20 LTS). Verifying dependencies for Node 20 compatibility...`);let r=(0,_.join)(e,"package.json"),i;try{i=JSON.parse(await(0,k.readFile)(r,"utf8"))}catch{return}if(i.engines?.node&&!Ii(i.engines.node))throw new Error(`Template package.json specifies engines.node "${i.engines.node}", which is incompatible with the Fivora platform runtime (Node 20 LTS). Update engines.node to support Node 20 (e.g. ">=20.0.0").`);let s=(0,_.join)(e,"package-lock.json"),o="";try{o=await(0,k.readFile)(s,"utf8")}catch{return}let a;try{a=JSON.parse(o)}catch{return}let l=[],u=a.packages||{};for(let[f,g]of Object.entries(u)){if(!f||f==="")continue;let E=g?.engines?.node;if(E&&typeof E=="string"&&!Ii(E)){let S=g.name||f.replace(/^node_modules\//,""),m=g.version||"";l.push(`${S}${m?`@${m}`:""} (requires Node "${E}")`)}}if(l.length>0){let f=l.slice(0,10).map(E=>` - ${E}`).join(`
18
+ `),g=l.length>10?`
19
+ - ...and ${l.length-10} more`:"";throw new Error(`Template package includes dependencies that are incompatible with the Fivora platform runtime (Node 20 LTS):
20
20
  ${f}${g}
21
21
 
22
- Please downgrade, remove, or replace these dependencies to versions compatible with Node 20.`)}}async function ra(e,t){let n=(0,k.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 ze(e,/\.(tsx?|jsx?|mjs|cjs)$/i),c=(await Promise.all(o.map(u=>(0,_.readFile)(u,"utf8").catch(()=>"")))).join(`
23
- `);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 u of s)i.includes(u.name)&&!u.pattern.test(c)&&t.warn(`Unused dependency detected: "${u.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 ia(e,t){let n=t.outputDirectory?.trim()||"out",r=me(e,n);await(0,_.access)(r).catch(()=>{throw new Error(`Interactive preview build did not produce output directory "${n}".`)});let i=await ze(r,/\.html$/i);if(i.length===0)throw new Error(`Interactive preview build produced no HTML files in output directory "${n}".`);for(let s of i.slice(0,10)){let o=await(0,_.readFile)(s,"utf8");if(!o.includes("<!DOCTYPE")&&!o.includes("<html"))throw new Error(`Generated preview HTML "${(0,k.relative)(e,s)}" is malformed.`)}}async function xi(e,t,n){let r=await n.step("Validate manifest",()=>oa(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()=>{let f=(0,k.join)(e,"package.json");await(0,_.access)(f).catch(()=>{throw new Error("Template package must contain package.json at ZIP root.")});let g=null;try{g=JSON.parse(await(0,_.readFile)(f,"utf8"))}catch{}if(!!{...g?.dependencies||{},...g?.devDependencies||{}}.next){let m=["src/app/not-found.tsx","src/app/not-found.jsx","src/app/not-found.js","app/not-found.tsx","app/not-found.jsx","app/not-found.js","src/pages/404.tsx","src/pages/404.jsx","src/pages/404.js","pages/404.tsx","pages/404.jsx","pages/404.js"];await Promise.any(m.map(async p=>(await(0,_.access)((0,k.join)(e,p)),!0))).catch(()=>!1)||n.warn(`Template is missing an explicit 404/not-found page (e.g. "src/app/not-found.tsx"). In Next.js 15 static export, missing not-found.tsx causes Next.js to fall back to legacy "_error.js" and crash with "TypeError: Cannot read properties of null (reading 'useContext')".`)}}),await n.step("Validate client navigation source",async()=>{let f=await ze(e,/\.(?:[cm]?[jt]sx?)$/i,me(e,r.outputDirectory?.trim()||"out")),g=[],E=0;for(let S of f.slice(0,Ri)){let m=(0,k.relative)(e,S).split(k.sep).join("/");if(m==="template-authoring-kit"||m.startsWith("template-authoring-kit/"))continue;let d=await(0,_.readFile)(S,"utf8");if(E+=Buffer.byteLength(d),E>Di)break;for(let p of Hr(d))g.push(`${m}:${p.line} passes an already base-path-prefixed destination to Next navigation: ${p.expression}`)}if(g.length>0)throw new Error(["Template navigation validation failed before dependency installation.",...g.slice(0,12).map(S=>`- ${S}`),"- Next router.push/router.replace/router.prefetch and next/link already apply next.config basePath. Pass the route only, for example router.push(pageRoute(pageKey)) or <Link href={pageRoute(pageKey)}>; reserve base-path helpers for window.location and plain asset URLs."].join(`
24
- `))});let{contentDefaults:i,originalSiteData:s,siteDataPath:o}=await n.step("Validate site data",()=>sa(e,r)),l=aa(r,i),c=Vr(r.pages??[]),u=r.pages?.map(f=>f.id)??c;try{if(await n.step("Check platform runtime compatibility",async()=>{await na(e,n)}),await n.step("Audit package dependencies",async()=>{await ra(e,n)}),t.skipInstall)n.skip("Install dependencies","Dependency installation was skipped by --skip-install.");else{let m=r.installCommand?.trim()||"npm install";await n.step("Install dependencies",()=>Oi(m,e,ea,t.json))}let f=Yt(i,l);await _i(o,f,c),await Ci(e,r,t,n,"Build empty-state fixture");let g=await Ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate empty-state contract",()=>{let m=Rr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:i,editorSchema:l,artifacts:g}),d=Ur({pages:r.pages},u),p=new Set(mt(g.filter(h=>h.kind==="html")).markers.filter(h=>h.kind==="page"&&h.artifactKind==="html"&&c.includes(h.value)).map(h=>h.filePath));m.errors.push(...new Set(g.filter(h=>h.kind==="html"&&p.has(h.filePath)).flatMap(h=>zr({html:h.content,pageDefinitions:d,selectedPages:c,basePath:En}).map(b=>`${h.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 h of m.warnings)n.warn(h);mn("Template strict empty-state visual-editing validation failed.",m.errors)});let E=vr(i,l);await _i(o,E,u),await Ci(e,r,t,n,"Build probe-content fixture");let S=await Ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate probe-content contract",()=>{let m=Fr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:E,editorSchema:l,artifacts:S});for(let d of m.warnings)n.warn(d);mn("Template visual-editing contract validation failed.",m.errors)}),await n.step("Validate real-time style contract",()=>{let m=Pi({siteData:E,artifacts:S});mn("Template real-time style validation failed.",m.map(d=>`${d.path}: ${d.message}`))}),await n.step("Validate reusable interactive preview export",async()=>{await ia(e,r)})}finally{await(0,_.writeFile)(o,s,"utf8").catch(()=>{})}}async function Ci(e,t,n,r,i){if(n.skipBuild){r.skip(i,`${i} was skipped by --skip-build.`);let s=me(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 la(e,s);let o={...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:En}:{},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:Qs}:{},NODE_ENV:"production"};await Oi(t.buildCommand?.trim()||"npm run build",e,o,n.json),await(0,_.access)(me(e,s)).catch(()=>{throw new Error(`Template build completed, but output directory "${s}" was not created.`)})})}async function oa(e){let t=(0,k.join)(e,Pt),n;try{n=JSON.parse(await(0,_.readFile)(t,"utf8"))}catch(r){throw new Error(`${Pt} is missing from the package root or is not valid JSON: ${He(r)}`)}return Tr(n)}async function sa(e,t){let n=me(e,t.siteDataFile),r,i;try{r=await(0,_.readFile)(n,"utf8"),i=JSON.parse(r)}catch(l){throw new Error(`Template site data file "${t.siteDataFile}" is missing or is not valid JSON: ${He(l)}`)}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 l=s.common&&typeof s.common=="object"&&!Array.isArray(s.common)?s.common:{};s.common={...l,logoUrl:typeof l.logoUrl=="string"&&l.logoUrl.trim()?l.logoUrl:o}}return{contentDefaults:s,originalSiteData:r,siteDataPath:n}}function aa(e,t){return lr(Lt(e.editorSchema??null,ar(t,e.pages??[])))}async function _i(e,t,n=[]){await(0,_.mkdir)((0,k.dirname)(e),{recursive:!0}),await(0,_.writeFile)(e,JSON.stringify(Qn(t,n),null,2),"utf8")}async function Li(e,t){if(!(await(0,_.stat)(e).catch(()=>null))?.isDirectory())throw new Error(`Template source directory does not exist: ${e}`);let r=new yn.default,i=0,s=0,o=0,l=async c=>{let u=await(0,_.readdir)(c,{withFileTypes:!0});u.sort((f,g)=>f.name.localeCompare(g.name));for(let f of u){let g=(0,k.join)(c,f.name),E=(0,k.relative)(e,g).split(k.sep).join("/");if(Je(E)){o+=1;continue}let S=await(0,_.lstat)(g);if(S.isSymbolicLink())throw new Error(`Template source contains a symbolic link that cannot be packaged safely: ${E}`);if(S.isDirectory()){await l(g);continue}if(!S.isFile())continue;let m=await(0,_.readFile)(g);r.addFile(E,m),i+=1,s+=m.byteLength}};if(await l(e),i===0)throw new Error("Template source directory is empty.");return await(0,_.mkdir)((0,k.dirname)(t),{recursive:!0}),await(0,_.writeFile)(t,r.toBuffer()),{bytes:s,files:i,excluded:o}}async function hn(e,t){return It(e),await(0,_.mkdir)(t,{recursive:!0}),new yn.default(e).extractAllTo(t,!0),t}function It(e){let t=tr(e);if(t.forbiddenEntries.length>0)throw new Error(nr(t.forbiddenEntries));if(!t.entries.includes(Pt))throw new Error(`${Pt} must be at the ZIP root. Do not wrap the template in an extra parent directory.`)}async function Ai(e,t){let n=me(e,t),[r,i]=await Promise.all([ze(e,/\.(?:[cm]?[jt]sx?|html?)$/i,n),ze(n,/\.html?$/i)]),s=[],o=0;for(let l of r.slice(0,Ri)){let c=await(0,_.readFile)(l,"utf8");if(o+=Buffer.byteLength(c),o>Di)break;s.push({filePath:`source/${(0,k.relative)(e,l).split(k.sep).join("/")}`,kind:"source",content:c})}for(let l of i)s.push({filePath:(0,k.relative)(n,l).split(k.sep).join("/"),kind:"html",content:await(0,_.readFile)(l,"utf8")});return s}async function ze(e,t,n){let r=new Set([".deneb",".git",".next",".turbo","build","coverage","dist","node_modules"]),i=[],s=async o=>{if(n&&(0,k.resolve)(o)===(0,k.resolve)(n))return;let l=await(0,_.readdir)(o,{withFileTypes:!0});for(let c of l){let u=(0,k.join)(o,c.name);c.isDirectory()?r.has(c.name.toLowerCase())||await s(u):c.isFile()&&t.test(c.name)&&i.push(u)}};return await s(e),i.sort()}async function la(e,t){let n=me(e,t);n!==(0,k.resolve)(e)&&await(0,_.rm)(n,{recursive:!0,force:!0,maxRetries:5,retryDelay:200});let r=me(e,".next");try{let i=await(0,_.readdir)(r,{withFileTypes:!0});await Promise.all(i.filter(s=>s.name!=="cache").map(s=>(0,_.rm)((0,k.join)(r,s.name),{recursive:!0,force:!0,maxRetries:5,retryDelay:200})))}catch{}}async function Oi(e,t,n,r){e.trim()&&await new Promise((i,s)=>{let o=(0,vi.spawn)(e,{cwd:t,env:{...process.env,...n},shell:!0,stdio:["ignore","pipe","pipe"]}),l="",c=(u,f)=>{let g=u.toString();l=`${l}${g}`.slice(-64*1024),r||f.write(u)};o.stdout?.on("data",u=>c(u,process.stdout)),o.stderr?.on("data",u=>c(u,process.stderr)),o.on("error",s),o.on("close",(u,f)=>{if(u===0){i();return}let g=fa(l);s(new Error([`Command failed: ${e}`,f?`Process stopped by signal ${f}.`:`Exit code: ${u??"unknown"}.`,...g?[g]:[]].join(`
22
+ Please downgrade, remove, or replace these dependencies to versions compatible with Node 20.`)}}async function ia(e,t){let n=(0,_.join)(e,"package.json"),r;try{r=JSON.parse(await(0,k.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 ze(e,/\.(tsx?|jsx?|mjs|cjs)$/i),l=(await Promise.all(o.map(u=>(0,k.readFile)(u,"utf8").catch(()=>"")))).join(`
23
+ `);if(l.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 u of s)i.includes(u.name)&&!u.pattern.test(l)&&t.warn(`Unused dependency detected: "${u.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 oa(e,t){let n=t.outputDirectory?.trim()||"out",r=ge(e,n);await(0,k.access)(r).catch(()=>{throw new Error(`Interactive preview build did not produce output directory "${n}".`)});let i=await ze(r,/\.html$/i);if(i.length===0)throw new Error(`Interactive preview build produced no HTML files in output directory "${n}".`);for(let s of i.slice(0,10)){let o=await(0,k.readFile)(s,"utf8");if(!o.includes("<!DOCTYPE")&&!o.includes("<html"))throw new Error(`Generated preview HTML "${(0,_.relative)(e,s)}" is malformed.`)}}async function xi(e,t,n){let r=await n.step("Validate manifest",()=>sa(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()=>{let f=(0,_.join)(e,"package.json");await(0,k.access)(f).catch(()=>{throw new Error("Template package must contain package.json at ZIP root.")});let g=null;try{g=JSON.parse(await(0,k.readFile)(f,"utf8"))}catch{}if(!!{...g?.dependencies||{},...g?.devDependencies||{}}.next){let m=["src/app/not-found.tsx","src/app/not-found.jsx","src/app/not-found.js","app/not-found.tsx","app/not-found.jsx","app/not-found.js","src/pages/404.tsx","src/pages/404.jsx","src/pages/404.js","pages/404.tsx","pages/404.jsx","pages/404.js"];await Promise.any(m.map(async p=>(await(0,k.access)((0,_.join)(e,p)),!0))).catch(()=>!1)||n.warn(`Template is missing an explicit 404/not-found page (e.g. "src/app/not-found.tsx"). In Next.js 15 static export, missing not-found.tsx causes Next.js to fall back to legacy "_error.js" and crash with "TypeError: Cannot read properties of null (reading 'useContext')".`)}}),await n.step("Validate client navigation source",async()=>{let f=await ze(e,/\.(?:[cm]?[jt]sx?)$/i,ge(e,r.outputDirectory?.trim()||"out")),g=[],E=0;for(let S of f.slice(0,Ri)){let m=(0,_.relative)(e,S).split(_.sep).join("/");if(m==="template-authoring-kit"||m.startsWith("template-authoring-kit/"))continue;let d=await(0,k.readFile)(S,"utf8");if(E+=Buffer.byteLength(d),E>Li)break;for(let p of Hr(d))g.push(`${m}:${p.line} passes an already base-path-prefixed destination to Next navigation: ${p.expression}`)}if(g.length>0)throw new Error(["Template navigation validation failed before dependency installation.",...g.slice(0,12).map(S=>`- ${S}`),"- Next router.push/router.replace/router.prefetch and next/link already apply next.config basePath. Pass the route only, for example router.push(pageRoute(pageKey)) or <Link href={pageRoute(pageKey)}>; reserve base-path helpers for window.location and plain asset URLs."].join(`
24
+ `))});let{contentDefaults:i,originalSiteData:s,siteDataPath:o}=await n.step("Validate site data",()=>aa(e,r)),a=ca(r,i),l=Vr(r.pages??[]),u=r.pages?.map(f=>f.id)??l;try{if(await n.step("Check platform runtime compatibility",async()=>{await ra(e,n)}),await n.step("Audit package dependencies",async()=>{await ia(e,n)}),t.skipInstall)n.skip("Install dependencies","Dependency installation was skipped by --skip-install.");else{let m=r.installCommand?.trim()||"npm install";await n.step("Install dependencies",()=>Oi(m,e,ta,t.json))}let f=Yt(i,a);await ki(o,f,l),await Ci(e,r,t,n,"Build empty-state fixture");let g=await Ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate empty-state contract",()=>{let m=Rr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:i,editorSchema:a,artifacts:g}),d=Ur({pages:r.pages},u),p=new Set(mt(g.filter(h=>h.kind==="html")).markers.filter(h=>h.kind==="page"&&h.artifactKind==="html"&&l.includes(h.value)).map(h=>h.filePath));m.errors.push(...new Set(g.filter(h=>h.kind==="html"&&p.has(h.filePath)).flatMap(h=>zr({html:h.content,pageDefinitions:d,selectedPages:l,basePath:En}).map(b=>`${h.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 h of m.warnings)n.warn(h);mn("Template strict empty-state visual-editing validation failed.",m.errors)});let E=vr(i,a);await ki(o,E,u),await Ci(e,r,t,n,"Build probe-content fixture");let S=await Ai(e,r.outputDirectory?.trim()||"out");await n.step("Validate probe-content contract",()=>{let m=Fr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:E,editorSchema:a,artifacts:S});for(let d of m.warnings)n.warn(d);mn("Template visual-editing contract validation failed.",m.errors)}),await n.step("Validate real-time style contract",()=>{let m=Pi({siteData:E,artifacts:S});mn("Template real-time style validation failed.",m.map(d=>`${d.path}: ${d.message}`))}),await n.step("Validate reusable interactive preview export",async()=>{await oa(e,r)})}finally{await(0,k.writeFile)(o,s,"utf8").catch(()=>{})}}async function Ci(e,t,n,r,i){if(n.skipBuild){r.skip(i,`${i} was skipped by --skip-build.`);let s=ge(e,t.outputDirectory?.trim()||"out");await(0,k.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 la(e,s);let o={...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:En}:{},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:ea}:{},NODE_ENV:"production"};await Oi(t.buildCommand?.trim()||"npm run build",e,o,n.json),await(0,k.access)(ge(e,s)).catch(()=>{throw new Error(`Template build completed, but output directory "${s}" was not created.`)})})}async function sa(e){let t=(0,_.join)(e,Pt),n;try{n=JSON.parse(await(0,k.readFile)(t,"utf8"))}catch(r){throw new Error(`${Pt} is missing from the package root or is not valid JSON: ${He(r)}`)}return Tr(n)}async function aa(e,t){let n=ge(e,t.siteDataFile),r,i;try{r=await(0,k.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: ${He(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 ca(e,t){return cr(Nt(e.editorSchema??null,ar(t,e.pages??[])))}async function ki(e,t,n=[]){await(0,k.mkdir)((0,_.dirname)(e),{recursive:!0}),await(0,k.writeFile)(e,JSON.stringify(Qn(t,n),null,2),"utf8")}async function Ni(e,t){if(!(await(0,k.stat)(e).catch(()=>null))?.isDirectory())throw new Error(`Template source directory does not exist: ${e}`);let r=new yn.default,i=0,s=0,o=0,a=async l=>{let u=await(0,k.readdir)(l,{withFileTypes:!0});u.sort((f,g)=>f.name.localeCompare(g.name));for(let f of u){let g=(0,_.join)(l,f.name),E=(0,_.relative)(e,g).split(_.sep).join("/");if(Je(E)){o+=1;continue}let S=await(0,k.lstat)(g);if(S.isSymbolicLink())throw new Error(`Template source contains a symbolic link that cannot be packaged safely: ${E}`);if(S.isDirectory()){await a(g);continue}if(!S.isFile())continue;let m=await(0,k.readFile)(g);r.addFile(E,m),i+=1,s+=m.byteLength}};if(await a(e),i===0)throw new Error("Template source directory is empty.");return await(0,k.mkdir)((0,_.dirname)(t),{recursive:!0}),await(0,k.writeFile)(t,r.toBuffer()),{bytes:s,files:i,excluded:o}}async function hn(e,t){return It(e),await(0,k.mkdir)(t,{recursive:!0}),new yn.default(e).extractAllTo(t,!0),t}function It(e){let t=tr(e);if(t.forbiddenEntries.length>0)throw new Error(nr(t.forbiddenEntries));if(!t.entries.includes(Pt))throw new Error(`${Pt} must be at the ZIP root. Do not wrap the template in an extra parent directory.`)}async function Ai(e,t){let n=ge(e,t),[r,i]=await Promise.all([ze(e,/\.(?:[cm]?[jt]sx?|html?)$/i,n),ze(n,/\.html?$/i)]),s=[],o=0;for(let a of r.slice(0,Ri)){let l=await(0,k.readFile)(a,"utf8");if(o+=Buffer.byteLength(l),o>Li)break;s.push({filePath:`source/${(0,_.relative)(e,a).split(_.sep).join("/")}`,kind:"source",content:l})}for(let a of i)s.push({filePath:(0,_.relative)(n,a).split(_.sep).join("/"),kind:"html",content:await(0,k.readFile)(a,"utf8")});return s}async function ze(e,t,n){let r=new Set([".deneb",".git",".next",".turbo","build","coverage","dist","node_modules"]),i=[],s=async o=>{if(n&&(0,_.resolve)(o)===(0,_.resolve)(n))return;let a=await(0,k.readdir)(o,{withFileTypes:!0});for(let l of a){let u=(0,_.join)(o,l.name);l.isDirectory()?r.has(l.name.toLowerCase())||await s(u):l.isFile()&&t.test(l.name)&&i.push(u)}};return await s(e),i.sort()}async function la(e,t){let n=ge(e,t);n!==(0,_.resolve)(e)&&await(0,k.rm)(n,{recursive:!0,force:!0,maxRetries:5,retryDelay:200});let r=ge(e,".next");try{let i=await(0,k.readdir)(r,{withFileTypes:!0});await Promise.all(i.filter(s=>s.name!=="cache").map(s=>(0,k.rm)((0,_.join)(r,s.name),{recursive:!0,force:!0,maxRetries:5,retryDelay:200})))}catch{}}async function Oi(e,t,n,r){e.trim()&&await new Promise((i,s)=>{let o=(0,vi.spawn)(e,{cwd:t,env:{...process.env,...n},shell:!0,stdio:["ignore","pipe","pipe"]}),a="",l=(u,f)=>{let g=u.toString();a=`${a}${g}`.slice(-64*1024),r||f.write(u)};o.stdout?.on("data",u=>l(u,process.stdout)),o.stderr?.on("data",u=>l(u,process.stderr)),o.on("error",s),o.on("close",(u,f)=>{if(u===0){i();return}let g=pa(a);s(new Error([`Command failed: ${e}`,f?`Process stopped by signal ${f}.`:`Exit code: ${u??"unknown"}.`,...g?[g]:[]].join(`
25
25
  `)))})})}function mn(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(`
26
- `))}function me(e,t){let n=(0,k.resolve)(e),r=(0,k.resolve)(e,t),i=`${n}${k.sep}`;if(r!==n&&!r.startsWith(i))throw new Error("Template path resolves outside the workspace.");return r}async function $i(e,t){if((0,k.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 ca(e,t,n){let r=(0,k.dirname)(t),i=(0,k.join)(r,`.${(0,k.basename)(t)}.${process.pid}-${Date.now()}.tmp`);await(0,_.mkdir)(r,{recursive:!0});try{await(0,_.copyFile)(e,i),await $i(t,n),n&&await(0,_.rm)(t,{force:!0}),await(0,_.rename)(i,t)}finally{await(0,_.rm)(i,{force:!0}).catch(()=>{})}}function da(e){if(e.includes("--help")||e.includes("-h"))return ua(),null;if(e.includes("--version")||e.includes("-v"))return process.stdout.write(`${xt}
27
- `),null;let t=[...e],r=t[0]==="validate"||t[0]==="package"?t.shift():"validate",i="",s,o=!1,l=!1,c=!1,u=!1;for(let f=0;f<t.length;f+=1){let g=t[f];if(g==="--json")o=!0;else if(g==="--force")l=!0;else if(g==="--skip-build")c=!0;else if(g==="--skip-install")u=!0;else if(g==="--output"||g==="-o"){if(s=t[f+1],f+=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 "${De} --help" for usage.`);if(r==="package"&&(c||u))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:l,skipBuild:c,skipInstall:u}}function ua(){process.stdout.write(`Fivora Template Preflight Validator v${xt}
26
+ `))}function ge(e,t){let n=(0,_.resolve)(e),r=(0,_.resolve)(e,t),i=`${n}${_.sep}`;if(r!==n&&!r.startsWith(i))throw new Error("Template path resolves outside the workspace.");return r}async function $i(e,t){if((0,_.extname)(e).toLowerCase()!==".zip")throw new Error(`Package output must use the .zip extension: ${e}`);let n=await(0,k.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 da(e,t,n){let r=(0,_.dirname)(t),i=(0,_.join)(r,`.${(0,_.basename)(t)}.${process.pid}-${Date.now()}.tmp`);await(0,k.mkdir)(r,{recursive:!0});try{await(0,k.copyFile)(e,i),await $i(t,n),n&&await(0,k.rm)(t,{force:!0}),await(0,k.rename)(i,t)}finally{await(0,k.rm)(i,{force:!0}).catch(()=>{})}}function ua(e){if(e.includes("--help")||e.includes("-h"))return fa(),null;if(e.includes("--version")||e.includes("-v"))return process.stdout.write(`${xt}
27
+ `),null;let t=[...e],r=t[0]==="validate"||t[0]==="package"?t.shift():"validate",i="",s,o=!1,a=!1,l=!1,u=!1;for(let f=0;f<t.length;f+=1){let g=t[f];if(g==="--json")o=!0;else if(g==="--force")a=!0;else if(g==="--skip-build")l=!0;else if(g==="--skip-install")u=!0;else if(g==="--output"||g==="-o"){if(s=t[f+1],f+=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 "${Le} --help" for usage.`);if(r==="package"&&(l||u))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:l,skipInstall:u}}function fa(){process.stdout.write(`Fivora Template Preflight Validator v${xt}
28
28
 
29
29
  `),process.stdout.write(`Usage:
30
- `),process.stdout.write(` ${De} validate <template-directory-or-zip> [--json]
31
- `),process.stdout.write(` ${De} package <template-directory> [--output <file.zip>] [--force] [--json]
30
+ `),process.stdout.write(` ${Le} validate <template-directory-or-zip> [--json]
31
+ `),process.stdout.write(` ${Le} package <template-directory> [--output <file.zip>] [--force] [--json]
32
32
 
33
33
  `),process.stdout.write(`Commands:
34
34
  `),process.stdout.write(` validate Validate an isolated source-only snapshot or an existing ZIP.
@@ -37,9 +37,9 @@ Please downgrade, remove, or replace these dependencies to versions compatible w
37
37
  `),process.stdout.write(`Diagnostic options:
38
38
  `),process.stdout.write(` --skip-install Reuse dependencies in a working directory (not upload proof).
39
39
  `),process.stdout.write(` --skip-build Inspect an existing export in place (not upload proof).
40
- `)}function fa(e){let t=e.split(/\r?\n/).map(n=>n.trimEnd()).filter(Boolean);return t.length<=28?t.join(`
40
+ `)}function pa(e){let t=e.split(/\r?\n/).map(n=>n.trimEnd()).filter(Boolean);return t.length<=28?t.join(`
41
41
  `):`${t.slice(0,8).join(`
42
42
  `)}
43
43
  ...
44
44
  ${t.slice(-20).join(`
45
- `)}`}function He(e){return e instanceof Error?e.message:typeof e=="string"?e:"Unknown validation error."}function ki(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function pa(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}require.main===module&&Ni().then(e=>{process.exitCode=e});0&&(module.exports={runTemplatePreflight});
45
+ `)}`}function He(e){return e instanceof Error?e.message:typeof e=="string"?e:"Unknown validation error."}function _i(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ma(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}require.main===module&&Di().then(e=>{process.exitCode=e});0&&(module.exports={runTemplatePreflight});