JezK
Edit File: admin-customizer.bundle.js.map
{"version":3,"file":"admin-customizer.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,IAAI;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,oBAAoB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gCAAgC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA,0DAA0D;AAC1D,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,eAAe,aAAa,eAAe;AACjF;AACA;AACA;AACA,yDAAyD,2DAA2D;AACpH;AACA;AACA,wDAAwD,kCAAkC;AAC1F;AACA;AACA;AACA;AACA;AACA,+DAA+D,+BAA+B;AAC9F;AACA;AACA,sDAAsD,+BAA+B,cAAc,eAAe;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,0BAA0B;AACxF;AACA,qCAAqC,SAAS,oDAAoD,0BAA0B;AAC5H;AACA;AACA;AACA,iEAAiE,4BAA4B;AAC7F;AACA;AACA,+DAA+D,0BAA0B;AACzF;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,iBAAiB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,sEAAsE,EAAE,eAAe;AACvI;AACA,iDAAiD,iEAAiE,EAAE,eAAe;AACnI;AACA,4CAA4C;AAC5C;AACA;AACA;AACA,0CAA0C,EAAE,cAAc;AAC1D;AACA,0CAA0C;AAC1C;AACA;AACA;AACA,0CAA0C,EAAE,gCAAgC;AAC5E;AACA;AACA;AACA;AACA;AACA,gDAAgD,qEAAqE,EAAE,eAAe;AACtI;AACA,iDAAiD,iEAAiE,EAAE,eAAe;AACnI;AACA,4CAA4C;AAC5C;AACA;AACA;AACA,uCAAuC,EAAE,cAAc;AACvD;AACA,4CAA4C;AAC5C;AACA;AACA;AACA,uCAAuC,EAAE,cAAc;AACvD;AACA,0CAA0C;AAC1C;AACA;AACA;AACA,0CAA0C,EAAE,gCAAgC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,iBAAiB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,mCAAmC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,kCAAkC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,CAAC;AACD,4BAA4B,wBAAwB;AACpD,yBAAyB,wBAAwB;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA,sEAAsE,UAAU;AAChF;AACA,CAAC,8BAA8B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,4DAA4D;AACxE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,mCAAmC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,mCAAmC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC;AACtD,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,8BAA8B;AACpD,SAAS;AACT;AACA;A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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,iDAAiD;AACvF;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,yBAAyB;AAC/D;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,uBAAuB;AAC7D;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,gCAAgC,+CAA+C;AAC/E;AACA;AACA,gCAAgC,6CAA6C;AAC7E;AACA;AACA,gCAAgC,+CAA+C;AAC/E;AACA;AACA,gCAAgC,8CAA8C;AAC9E;AACA;AACA,gCAAgC,8CAA8C;AAC9E;AACA;AACA,gCAAgC,+CAA+C;AAC/E;AACA;AACA,gCAAgC,8CAA8C;AAC9E;AACA;AACA,gCAAgC,4CAA4C;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,wDAAwD;AACjF,SAAS;AACT;AACA;AACA;AACA;AACA,yBAAyB,wDAAwD;AACjF,SAAS;AACT;AACA;AACA;AACA;AACA,2BAA2B,kDAAkD;AAC7E,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,aAAa;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,yBAAyB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,6BAA6B;AAC5D,iCAAiC,uCAAuC;AACxE,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,oBAAoB;AACpB,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,8BAA8B,eAAe;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,cAAc;AACjF;AACA;AACA;AACA,8DAA8D,uBAAuB,sBAAsB,cAAc;AACzH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,4BAA4B,kBAAkB;AAC9C;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,iCAAiC;AACjC;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sDAAsD;AAC7E,SAAS;AACT;AACA;AACA;AACA;AACA,uBAAuB,sDAAsD;AAC7E,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA,mCAAmC,6CAA6C;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,mCAAmC,6CAA6C;AAChF;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,mCAAmC,6CAA6C;AAChF;AACA;AACA;AACA,uGAAuG,qCAAqC;AAC5I,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,kBAAkB,2CAA2C;AAC7D;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,yBAAyB;AACzB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,cAAc;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,qDAAqD,aAAa;AAClE,+BAA+B,sCAAsC;AACrE;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sDAAsD;AACvD;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,sBAAsB;AAC/D,yCAAyC,sBAAsB;AAC/D;AACA;AACA;AACA,KAAK;AACL,yCAAyC,sBAAsB;AAC/D,qCAAqC,sBAAsB;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC,wBAAwB,oBAAoB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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CAAC;;;;;;;;;;;;;;;AChyEU;AACN;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,wDAAwD;AACzD;;;;;;;;;;;;;;;;ACvCmD;AAC8C;AACjG,kCAAkC,4DAAY;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,iEAAe,uGAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;ACtCgJ;AAC5D;AACpF,mBAAmB,mGAA4B;AAC/C,gCAAgC,kGAAoB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iHAAmC;AACtD;AACA;AACA;AACA;AACA,iEAAe,uGAAqB;AACpC;AACA;AACA;AACA;AACA,mCAAmC,cAAc;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;AC9CqH;AACjC;AACpF,cAAc,8FAAuB;AACrC;AACA;AACA,iCAAiC,gBAAgB,KAAK,aAAa;AACnE;AACA;AACA;AACA,2BAA2B,gGAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,uGAAqB;AACpC;AACA;AACA;AACA,sEAAsE,gBAAgB;AACtF;AACA;AACA;AACA;AACA;AACA,sBAAsB,mEAAmE;AACzF;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;;ACvCuH;AACnC;AACpF,cAAc,8FAAuB;AACc;AACnD,+BAA+B,kGAAoB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,gFAAgC;AAC/D,yBAAyB,oFAAoC;AAC7D;AACA;AACA;AACA;AACA;AACA,iEAAe,uGAAqB;AACpC,mDAAmD,oDAAoD;AACvG;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;;ACvBgJ;AAC5D;AACpF,cAAc,8FAAuB;AACrC,cAAc,8FAAuB;AACrC,mBAAmB,mGAA4B;AACxC,2BAA2B,kGAAoB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iHAAmC;AAC1D;AACA;AACA,uBAAuB,iHAAmC;AAC1D;AACA;AACA;AACA,mBAAmB,iHAAmC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iHAAmC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,uGAAqB;AACpC,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA,sDAAsD,oDAAoD;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;ACtHsH;AACtH,6BAA6B,iGAAmB;AAChD;AACA;AACA;AACA;AACA,iEAAe,uGAAqB;AACpC;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;ACT8H;AAC1C;AACpF,cAAc,8FAAuB;AACrC,6BAA6B,iGAAmB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,+GAA6B;AAC5C;AACA,sBAAsB,4DAA4D;AAClF;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;ACxCsH;AACtH,oCAAoC,iGAAmB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,uGAAqB;AACpC;AACA;AACA,6EAA6E,qBAAqB;AAClG;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;AC5Ba;AAC0E;AACd;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iEAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa,WAAW,yBAAyB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa,WAAW,yBAAyB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iFAAsB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,0CAA0C;AACvE;AACA;AACA;AACA;AACA,yEAAyE,mBAAmB;AAC5F;AACA;AACA;AACA,2DAA2D,uBAAuB;AAClF;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;AC1SyD;AAClD;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,+BAA+B,iEAAmB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACnBa;AAC0E;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iEAAmB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,0CAA0C,2BAA2B;AAC3F;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;AChCuF;AACvF;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iEAAmB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3CA;AACA;AACA;AACA;AAC0E;AACN;AACc;AACR;AACN;AACkB;AACP;AACd;AACH;AAC2B;AACxB;AACH;AACe;AACN;AACZ;AACiC;AAC3B;AACjE;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,iDAAiD,iFAAgB;AACjE,+CAA+C,6EAAc;AAC7D,oDAAoD,uFAAkB;AACtE,iDAAiD,iFAAgB;AACjE,+CAA+C,6EAAc;AAC7D,qDAAqD,yFAAoB;AACzE,mDAAmD,qFAAiB;AACpE,8CAA8C,2EAAa;AAC3D,6CAA6C,yEAAY;AACzD,sDAAsD,2FAAqB;AAC3E,8CAA8C,4EAAa;AAC3D,6CAA6C,0EAAY;AACzD,kDAAkD,oFAAiB;AACnE,gDAAgD,gFAAe;AAC/D,4CAA4C,wEAAW;AACvD,uDAAuD,8FAAsB;AAC7E,8CAA8C,4EAAa;AAC3D;AACA;AACA;;;;;;;;;;;;;;;AClD0D;AAC1D;AACA;AACA;AACO,sCAAsC,kEAAoB;AACjE;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACVuF;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,SAAS,IAAI,OAAO;AAC9C;AACA,mDAAmD,YAAY;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,iCAAiC,iEAAmB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA,oEAAoE,oBAAoB;AACxF;AACA;AACA;AACA;AACA,mCAAmC,wDAAwD;AAC3F;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;ACnKuF;AACvF,qCAAqC,iEAAmB;AACxD;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;ACTa;AAC0E;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iEAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA,8DAA8D,wBAAwB;AACtF;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;AC/C2D;AACqB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,wFAAuB;AAC1D;AACA,iEAAe,uEAAqB;AACpC;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;;ACbA;AACsF;AACvB;AAC/D,cAAc,4EAAuB;AAC9B,6BAA6B,gEAAkB;AACtD;AACA;AACA;AACA;AACA,qDAAqD,yBAAyB;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E,qBAAqB;AAChG;AACA;AACA;AACA;AACA;AACA,yCAAyC,gDAAgD;AACzF;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;ACnHa;AACqD;AACa;AAC/E,gCAAgC,uFAAgB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA,8DAA8D,2BAA2B;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;AC9Ba;AACqD;AACa;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,8BAA8B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,uFAAgB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,wEAAwE;AAChF;AACA;AACA,UAAU,sCAAsC;AAChD;AACA;AACA,uBAAuB,yCAAyC,2BAA2B;AAC3F;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA,MAAM,gBAAgB;AACtB;AACA;AACA,SAAS,eAAe;AACxB;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,2BAA2B,8CAA8C;AACzE;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;AClG+E;AACb;AAClE,2BAA2B,uFAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA,sBAAsB,0CAA0C,2BAA2B;AAC3F;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;ACjB2D;AACqB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,wFAAuB;AAC3D;AACA,iEAAe,uEAAqB;AACpC;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;ACfuF;AACvF,4BAA4B,iEAAmB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;ACrBsF;AAC/E,2BAA2B,gEAAkB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,wBAAwB;AACvD;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA,sBAAsB,0CAA0C,2BAA2B;AAC3F;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;AC1BuF;AACvF,gCAAgC,iEAAmB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA,uBAAuB,yCAAyC,2BAA2B;AAC3F;AACA;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;ACtCuF;AAChF,8BAA8B,iEAAmB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA;AACA,SAAS,aAAa;AACtB,EAAE,EAAC;AACH;;;;;;;;;;;;;;;ACjBa;AAC0E;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,iEAAmB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,4BAA4B;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,+BAA+B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,8EAA4B;AAC3C;AACA,EAAE,EAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;ACpK4D;AAC5D,cAAc,4EAAuB;AACrC,yBAAyB,uFAAkC;AAC3D,cAAc,4EAAuB;AAC9B;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF,WAAW;AAClG;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC5RA;AACA;AACA;AACA;AACA;AACO;AACP,iIAAiI;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack:///./extras/zod/lib/index.js","webpack:///./extras/modules/admin-customizer/admin-customizer.ts","webpack:///./extras/modules/admin-customizer/admin-customizer-base.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-content-section.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-control-group.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-control.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-section-link.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-section.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-separator.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-structure.js","webpack:///./extras/modules/admin-customizer/ko-components/ame-ac-validation-errors.js","webpack:///./extras/pro-customizables/ko-components/ame-box-dimensions/ame-box-dimensions.js","webpack:///./extras/pro-customizables/ko-components/ame-choice-control/ame-choice-control.js","webpack:///./extras/pro-customizables/ko-components/ame-code-editor/ame-code-editor.js","webpack:///./extras/pro-customizables/ko-components/ame-color-picker/ame-color-picker.js","webpack:///./extras/pro-customizables/ko-components/ame-components.js","webpack:///./extras/pro-customizables/ko-components/ame-description/ame-description.js","webpack:///./extras/pro-customizables/ko-components/ame-font-style-picker/ame-font-style-picker.js","webpack:///./extras/pro-customizables/ko-components/ame-horizontal-separator/ame-horizontal-separator.js","webpack:///./extras/pro-customizables/ko-components/ame-image-selector/ame-image-selector.js","webpack:///./extras/pro-customizables/ko-components/ame-nested-description/ame-nested-description.js","webpack:///./extras/pro-customizables/ko-components/ame-number-input/ame-number-input.js","webpack:///./extras/pro-customizables/ko-components/ame-radio-button-bar/ame-radio-button-bar.js","webpack:///./extras/pro-customizables/ko-components/ame-radio-group/ame-radio-group.js","webpack:///./extras/pro-customizables/ko-components/ame-select-box/ame-select-box.js","webpack:///./extras/pro-customizables/ko-components/ame-sibling-description/ame-sibling-description.js","webpack:///./extras/pro-customizables/ko-components/ame-static-html/ame-static-html.js","webpack:///./extras/pro-customizables/ko-components/ame-text-input/ame-text-input.js","webpack:///./extras/pro-customizables/ko-components/ame-toggle-checkbox/ame-toggle-checkbox.js","webpack:///./extras/pro-customizables/ko-components/ame-unit-dropdown/ame-unit-dropdown.js","webpack:///./extras/pro-customizables/ko-components/ame-wp-editor/ame-wp-editor.js","webpack:///./extras/pro-customizables/ko-components/control-base.js","webpack:///./extras/pro-customizables/ko-components/lazy-popup-slider-adapter.js"],"sourcesContent":["var util;\n(function (util) {\n util.assertEqual = (val) => val;\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array\n .map((val) => (typeof val === \"string\" ? `'${val}'` : val))\n .join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nvar objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nconst ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nconst getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then &&\n typeof data.then === \"function\" &&\n data.catch &&\n typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n\nconst ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nconst quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nclass ZodError extends Error {\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n get errors() {\n return this.issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `smaller than or equal to`\n : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\n\nlet overrideErrorMap = errorMap;\nfunction setErrorMap(map) {\n overrideErrorMap = map;\n}\nfunction getErrorMap() {\n return overrideErrorMap;\n}\n\nconst makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message || errorMessage,\n };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n errorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nclass ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n syncPairs.push({\n key: await pair.key,\n value: await pair.value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (typeof value.value !== \"undefined\" || pair.alwaysSet) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nconst INVALID = Object.freeze({\n status: \"aborted\",\n});\nconst DIRTY = (value) => ({ status: \"dirty\", value });\nconst OK = (value) => ({ status: \"valid\", value });\nconst isAborted = (x) => x.status === \"aborted\";\nconst isDirty = (x) => x.status === \"dirty\";\nconst isValid = (x) => x.status === \"valid\";\nconst isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n\nvar errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message === null || message === void 0 ? void 0 : message.message;\n})(errorUtil || (errorUtil = {}));\n\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (this._key instanceof Array) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n if (typeof ctx.data === \"undefined\") {\n return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };\n }\n return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n }\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n var _a;\n const ctx = {\n common: {\n issues: [],\n async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n async: true,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult)\n ? maybeAsyncResult\n : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\"\n ? refinementData(val, ctx)\n : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this, this._def);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[a-z][a-z0-9]*$/;\nconst ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;\nconst uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\nconst emailRegex = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst emojiRegex = /^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$/u;\nconst ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;\nconst ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\n// Adapted from https://stackoverflow.com/a/3143231\nconst datetimeRegex = (args) => {\n if (args.precision) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}Z$`);\n }\n }\n else if (args.precision === 0) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z$`);\n }\n }\n else {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?Z$`);\n }\n }\n};\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nclass ZodString extends ZodType {\n constructor() {\n super(...arguments);\n this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n /**\n * @deprecated Use z.string().min(1) instead.\n * @see {@link ZodString.min}\n */\n this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));\n this.trim = () => new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n this.toLowerCase = () => new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n this.toUpperCase = () => new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n }\n //\n );\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch (_a) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options === null || options === void 0 ? void 0 : options.position,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n var _a;\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / Math.pow(10, decCount);\n}\nclass ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" ||\n (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null, min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" ||\n ch.kind === \"int\" ||\n ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = BigInt(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n var _a;\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\nclass ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nclass ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nclass ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nclass ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nclass ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nclass ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nclass ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nclass ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nclass ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nclass ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n return (this._cached = { shape, keys });\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever &&\n this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") ;\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n syncPairs.push({\n key,\n value: await pair.value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n var _a, _b, _c, _d;\n const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n util.objectKeys(mask).forEach((key) => {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n util.objectKeys(this.shape).forEach((key) => {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n util.objectKeys(this.shape).forEach((key) => {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n util.objectKeys(this.shape).forEach((key) => {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nclass ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return Object.keys(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else {\n return null;\n }\n};\nclass ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util\n .objectKeys(a)\n .filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date &&\n bType === ZodParsedType.date &&\n +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nclass ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\nclass ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nclass ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nclass ZodMap extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nclass ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nclass ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n errorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n errorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n return OK(async (...args) => {\n const error = new ZodError([]);\n const parsedArgs = await this._def.args\n .parseAsync(args, params)\n .catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await fn(...parsedArgs);\n const parsedReturns = await this._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n return OK((...args) => {\n const parsedArgs = this._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = fn(...parsedArgs.data);\n const parsedReturns = this._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args\n ? args\n : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nclass ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nclass ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nclass ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (this._def.values.indexOf(input.data) === -1) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values) {\n return ZodEnum.create(values);\n }\n exclude(values) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));\n }\n}\nZodEnum.create = createZodEnum;\nclass ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string &&\n ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (nativeEnumValues.indexOf(input.data) === -1) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nclass ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise &&\n ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise\n ? ctx.data\n : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nclass ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data);\n if (ctx.common.async) {\n return Promise.resolve(processed).then((processed) => {\n return this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n });\n }\n else {\n return this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc\n // effect: RefinementEffect<any>\n ) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return base;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((base) => {\n if (!isValid(base))\n return base;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nclass ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nclass ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nclass ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\"\n ? params.default\n : () => params.default,\n ...processCreateParams(params),\n });\n};\nclass ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nclass ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nconst BRAND = Symbol(\"zod_brand\");\nclass ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nclass ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nconst custom = (check, params = {}, \n/*\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) => {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n var _a, _b;\n if (!check(data)) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n ctx.addIssue({ code: \"custom\", ...p2, fatal: _fatal });\n }\n });\n return ZodAny.create();\n};\nconst late = {\n object: ZodObject.lazycreate,\n};\nvar ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nconst coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nconst NEVER = INVALID;\n\nvar z = /*#__PURE__*/Object.freeze({\n __proto__: null,\n defaultErrorMap: errorMap,\n setErrorMap: setErrorMap,\n getErrorMap: getErrorMap,\n makeIssue: makeIssue,\n EMPTY_PATH: EMPTY_PATH,\n addIssueToContext: addIssueToContext,\n ParseStatus: ParseStatus,\n INVALID: INVALID,\n DIRTY: DIRTY,\n OK: OK,\n isAborted: isAborted,\n isDirty: isDirty,\n isValid: isValid,\n isAsync: isAsync,\n get util () { return util; },\n get objectUtil () { return objectUtil; },\n ZodParsedType: ZodParsedType,\n getParsedType: getParsedType,\n ZodType: ZodType,\n ZodString: ZodString,\n ZodNumber: ZodNumber,\n ZodBigInt: ZodBigInt,\n ZodBoolean: ZodBoolean,\n ZodDate: ZodDate,\n ZodSymbol: ZodSymbol,\n ZodUndefined: ZodUndefined,\n ZodNull: ZodNull,\n ZodAny: ZodAny,\n ZodUnknown: ZodUnknown,\n ZodNever: ZodNever,\n ZodVoid: ZodVoid,\n ZodArray: ZodArray,\n ZodObject: ZodObject,\n ZodUnion: ZodUnion,\n ZodDiscriminatedUnion: ZodDiscriminatedUnion,\n ZodIntersection: ZodIntersection,\n ZodTuple: ZodTuple,\n ZodRecord: ZodRecord,\n ZodMap: ZodMap,\n ZodSet: ZodSet,\n ZodFunction: ZodFunction,\n ZodLazy: ZodLazy,\n ZodLiteral: ZodLiteral,\n ZodEnum: ZodEnum,\n ZodNativeEnum: ZodNativeEnum,\n ZodPromise: ZodPromise,\n ZodEffects: ZodEffects,\n ZodTransformer: ZodEffects,\n ZodOptional: ZodOptional,\n ZodNullable: ZodNullable,\n ZodDefault: ZodDefault,\n ZodCatch: ZodCatch,\n ZodNaN: ZodNaN,\n BRAND: BRAND,\n ZodBranded: ZodBranded,\n ZodPipeline: ZodPipeline,\n custom: custom,\n Schema: ZodType,\n ZodSchema: ZodType,\n late: late,\n get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },\n coerce: coerce,\n any: anyType,\n array: arrayType,\n bigint: bigIntType,\n boolean: booleanType,\n date: dateType,\n discriminatedUnion: discriminatedUnionType,\n effect: effectsType,\n 'enum': enumType,\n 'function': functionType,\n 'instanceof': instanceOfType,\n intersection: intersectionType,\n lazy: lazyType,\n literal: literalType,\n map: mapType,\n nan: nanType,\n nativeEnum: nativeEnumType,\n never: neverType,\n 'null': nullType,\n nullable: nullableType,\n number: numberType,\n object: objectType,\n oboolean: oboolean,\n onumber: onumber,\n optional: optionalType,\n ostring: ostring,\n pipeline: pipelineType,\n preprocess: preprocessType,\n promise: promiseType,\n record: recordType,\n set: setType,\n strictObject: strictObjectType,\n string: stringType,\n symbol: symbolType,\n transformer: effectsType,\n tuple: tupleType,\n 'undefined': undefinedType,\n union: unionType,\n unknown: unknownType,\n 'void': voidType,\n NEVER: NEVER,\n ZodIssueCode: ZodIssueCode,\n quotelessJson: quotelessJson,\n ZodError: ZodError\n});\n\nexport { BRAND, DIRTY, EMPTY_PATH, INVALID, NEVER, OK, ParseStatus, ZodType as Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodError, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPipeline, ZodPromise, ZodRecord, ZodType as ZodSchema, ZodSet, ZodString, ZodSymbol, ZodEffects as ZodTransformer, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, addIssueToContext, anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, coerce, custom, dateType as date, z as default, errorMap as defaultErrorMap, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, getErrorMap, getParsedType, instanceOfType as instanceof, intersectionType as intersection, isAborted, isAsync, isDirty, isValid, late, lazyType as lazy, literalType as literal, makeIssue, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, objectUtil, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, quotelessJson, recordType as record, setType as set, setErrorMap, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, util, voidType as void, z };\n","'use strict';\n\n/// <reference path=\"../../../js/common.d.ts\" />\n/// <reference types=\"@types/lodash\" />\n/// <reference path=\"../../jszip/jszip.d.ts\" />\n\nimport {AmeCustomizable, AmeCustomizableViewModel} from '../../pro-customizables/assets/customizable.js';\nimport {registerBaseComponents} from '../../pro-customizables/ko-components/ame-components.js';\nimport AmeAcStructure from './ko-components/ame-ac-structure.js';\nimport AmeAcSection from './ko-components/ame-ac-section.js';\nimport AmeAcSectionLink from './ko-components/ame-ac-section-link.js';\nimport AmeAcControl from './ko-components/ame-ac-control.js';\nimport AmeAcControlGroup from './ko-components/ame-ac-control-group.js';\nimport AmeAcContentSection from './ko-components/ame-ac-content-section.js';\nimport {AmeAdminCustomizerBase} from './admin-customizer-base.js';\nimport AmeAcSeparator from './ko-components/ame-ac-separator.js';\nimport AmeAcValidationErrors from './ko-components/ame-ac-validation-errors.js';\nimport z, {ZodError, ZodType} from '../../zod/lib/index.js';\n\ndeclare var wsAmeLodash: _.LoDashStatic;\ndeclare const wsAmeAdminCustomizerData: AmeAdminCustomizer.ScriptData;\n\nexport namespace AmeAdminCustomizer {\n\timport Setting = AmeCustomizable.Setting;\n\timport SettingCollection = AmeCustomizable.SettingCollection;\n\timport InterfaceStructureData = AmeCustomizable.InterfaceStructureData;\n\timport InterfaceStructure = AmeCustomizable.InterfaceStructure;\n\timport unserializeUiElement = AmeCustomizable.unserializeUiElement;\n\timport unserializeSetting = AmeCustomizable.unserializeSetting;\n\timport AnySpecificElementData = AmeCustomizable.AnySpecificElementData;\n\timport CustomizableVmInterface = AmeCustomizableViewModel.CustomizableVmInterface;\n\n\tconst $ = jQuery;\n\tconst _ = wsAmeLodash;\n\n\tregisterBaseComponents();\n\tko.components.register('ame-ac-structure', AmeAcStructure);\n\tko.components.register('ame-ac-section', AmeAcSection);\n\tko.components.register('ame-ac-section-link', AmeAcSectionLink);\n\tko.components.register('ame-ac-content-section', AmeAcContentSection);\n\tko.components.register('ame-ac-control-group', AmeAcControlGroup);\n\tko.components.register('ame-ac-control', AmeAcControl);\n\tko.components.register('ame-ac-separator', AmeAcSeparator);\n\tko.components.register('ame-ac-validation-errors', AmeAcValidationErrors);\n\n\texport interface ScriptData extends AmeAdminCustomizerBase.ScriptData, AdminThemeTexts {\n\t\tajaxUrl: string;\n\t\tsaveChangesetNonce: string;\n\t\ttrashChangesetNonce: string;\n\t\tchangesetItemCount: number;\n\t\tchangesetStatus: string;\n\t\tchangesetThemeMetadata: AdminThemeMetadata | null;\n\n\t\trefreshPreviewNonce: string;\n\t\tinitialPreviewUrl: string;\n\t\tinterfaceStructure: InterfaceStructureData;\n\n\t\t/**\n\t\t * The template to use when generating the URL for a changeset.\n\t\t *\n\t\t * By default, the changeset name is added as a query parameter. Alternatively,\n\t\t * you can use a path template that includes a \"{changeset}\" placeholder, which\n\t\t * will be replaced with the changeset name.\n\t\t */\n\t\tchangesetPathTemplate: string | null;\n\n\t\t/**\n\t\t * Whether to use pushState() to update the URL when the changeset name changes.\n\t\t *\n\t\t * By default, we discourage navigating to the old URL (no pushState()) because\n\t\t * the name is only expected to change when the old changeset becomes invalid\n\t\t * (e.g. it's deleted or published).\n\t\t */\n\t\tchangesetPushStateEnabled: boolean;\n\n\t\t/**\n\t\t * Admin Customizer base path. Defaults to the current URL path.\n\t\t *\n\t\t * Note that setting this to a non-empty value will also stop AC from\n\t\t * adding the \"page\" query parameter to the URL.\n\t\t */\n\t\tcustomBasePath: string | null;\n\n\t\texitPromptMode?: number;\n\n\t\t/**\n\t\t * Whether generating an admin theme requires the current changeset to be non-empty.\n\t\t *\n\t\t * By default, even if the current changeset is empty, the user can still generate an admin\n\t\t * theme from previously saved settings. If there are no settings, the generated theme just\n\t\t * won't change the admin interface at all.\n\t\t */\n\t\tdownloadOnlyIfChangesetIsNonEmpty?: boolean;\n\t}\n\n\tinterface AdminThemeTexts {\n\t\tgeneratorCreditPhrase?: string;\n\t\tstandalonePluginNote?: string;\n\t}\n\n\tconst reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n\tlet prefersReducedMotion = reducedMotionQuery && reducedMotionQuery.matches;\n\treducedMotionQuery.addEventListener('change', () => {\n\t\tprefersReducedMotion = reducedMotionQuery.matches;\n\t});\n\n\tclass CustomizerSettingsCollection extends SettingCollection {\n\t\t/**\n\t\t * Settings that have changed since the last save attempt.\n\t\t */\n\t\tprivate pendingSettings: Record<string, Setting> = {};\n\t\t/**\n\t\t * Settings that in the process of being sent to the server to be saved.\n\t\t * They might not be saved yet.\n\t\t */\n\t\tprivate sentSettings: Record<string, Setting> = {};\n\t\tprivate currentChangesetRequest: JQueryXHR | null = null;\n\t\tprivate saveTriggerTimeoutId: null | ReturnType<typeof setTimeout> = null;\n\n\t\tprivate readonly currentChangeset: KnockoutObservable<Changeset>;\n\t\tpublic readonly changesetName: KnockoutComputed<string>;\n\n\t\tpublic readonly adminThemeMetadata: KnockoutObservable<AdminThemeMetadata | null>;\n\t\tprivate readonly underlyingMetadata: KnockoutObservable<AdminThemeMetadata | null> = ko.observable<AdminThemeMetadata | null>(null);\n\t\tprivate readonly metadataHasChanged: KnockoutObservable<boolean> = ko.observable<boolean>(false);\n\n\t\tpublic readonly isExclusiveOperationInProgress: KnockoutComputed<boolean>;\n\t\tprivate readonly exclusiveOperation: KnockoutObservable<boolean> = ko.observable(false);\n\n\t\tconstructor(\n\t\t\tpublic readonly ajaxUrl: string,\n\t\t\tpublic readonly saveChangesetNonce: string,\n\t\t\tpublic readonly trashChangesetNonce: string,\n\t\t\tchangesetName: string,\n\t\t\tchangesetItemCount: number = 0,\n\t\t\tchangesetStatus: string | null = null\n\t\t) {\n\t\t\tsuper();\n\t\t\tconst self = this;\n\n\t\t\tthis.currentChangeset = ko.observable(\n\t\t\t\tnew Changeset(changesetName, changesetItemCount, changesetStatus)\n\t\t\t);\n\t\t\tthis.changesetName = ko.pureComputed(() => {\n\t\t\t\treturn (self.currentChangeset()?.name()) || '';\n\t\t\t});\n\n\t\t\tthis.adminThemeMetadata = ko.computed({\n\t\t\t\tread: () => this.underlyingMetadata(),\n\t\t\t\twrite: (newValue) => {\n\t\t\t\t\tconst oldValue = this.underlyingMetadata.peek();\n\t\t\t\t\tif (!_.isEqual(newValue, oldValue)) {\n\t\t\t\t\t\tthis.underlyingMetadata(newValue);\n\t\t\t\t\t\tthis.metadataHasChanged(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t//Automatically save the changeset when any settings change.\n\t\t\tconst totalChangeCount = ko.pureComputed(() => {\n\t\t\t\tconst changeset = self.currentChangeset();\n\t\t\t\treturn (changeset ? changeset.currentSessionChanges() : 0);\n\t\t\t});\n\t\t\tconst debouncedSaveTrigger = _.debounce(\n\t\t\t\t() => {\n\t\t\t\t\t//Only save if there are changes. This may look like a duplicate check,\n\t\t\t\t\t//but it's not: the totalChangeCount() may change between the time\n\t\t\t\t\t//the debounced function is called and the time this code is executed.\n\t\t\t\t\t//\n\t\t\t\t\t//Also save if the metadata has changed, but only if the changeset\n\t\t\t\t\t//is not empty. Saving a changeset with only metadata is not useful.\n\t\t\t\t\tif (\n\t\t\t\t\t\t(totalChangeCount() > 0)\n\t\t\t\t\t\t|| (this.metadataHasChanged() && this.currentChangeset().isNonEmpty())\n\t\t\t\t\t) {\n\t\t\t\t\t\tself.queueChangesetUpdate()\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t3000,\n\t\t\t\t{leading: true, trailing: true}\n\t\t\t)\n\t\t\ttotalChangeCount.subscribe((counter) => {\n\t\t\t\tif (counter > 0) {\n\t\t\t\t\tdebouncedSaveTrigger();\n\t\t\t\t}\n\t\t\t});\n\t\t\t//Also save when theme metadata changes.\n\t\t\tthis.metadataHasChanged.subscribe((hasChanged) => {\n\t\t\t\tif (hasChanged) {\n\t\t\t\t\tdebouncedSaveTrigger();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.isExclusiveOperationInProgress = ko.pureComputed(() => {\n\t\t\t\treturn self.exclusiveOperation();\n\t\t\t});\n\n\t\t\t//Keep track of unsaved changes and changesets.\n\t\t\tthis.addChangeListener((setting: Setting) => {\n\t\t\t\tthis.pendingSettings[setting.id] = setting;\n\n\t\t\t\tlet changeset = this.currentChangeset();\n\t\t\t\t//If the current changeset cannot be modified, create a new one\n\t\t\t\t//for the changed setting(s).\n\t\t\t\tif (!changeset?.canBeModified()) {\n\t\t\t\t\tchangeset = new Changeset();\n\t\t\t\t\tthis.currentChangeset(changeset);\n\t\t\t\t}\n\t\t\t\t//Track the number of changes in the current session.\n\t\t\t\tchangeset.currentSessionChanges(changeset.currentSessionChanges() + 1);\n\t\t\t});\n\t\t}\n\n\t\tqueueChangesetUpdate(delay: number = 0) {\n\t\t\tif (delay > 0) {\n\t\t\t\tif (this.saveTriggerTimeoutId !== null) {\n\t\t\t\t\t//Replace the existing timeout with a new one.\n\t\t\t\t\tclearTimeout(this.saveTriggerTimeoutId);\n\t\t\t\t}\n\t\t\t\tthis.saveTriggerTimeoutId = setTimeout(() => {\n\t\t\t\t\tthis.saveTriggerTimeoutId = null;\n\t\t\t\t\tthis.queueChangesetUpdate(0);\n\t\t\t\t}, delay);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.saveTriggerTimeoutId !== null) {\n\t\t\t\treturn; //Another timeout is already waiting.\n\t\t\t}\n\n\t\t\tif (this.currentChangesetRequest !== null) {\n\t\t\t\t//There's an in-progress request, so wait until it's done.\n\t\t\t\tthis.currentChangesetRequest.always(() => {\n\t\t\t\t\t//Wait a bit to avoid hammering the server.\n\t\t\t\t\tthis.queueChangesetUpdate(1000);\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.saveChangeset();\n\t\t}\n\n\t\tprivate saveChangeset(status: string | null = null): JQueryPromise<any> {\n\t\t\t//Do nothing if there are no changes.\n\t\t\tif (_.isEmpty(this.pendingSettings) && (status === null) && !this.metadataHasChanged()) {\n\t\t\t\treturn $.Deferred().reject(new Error('There are no changes to save.')).promise();\n\t\t\t}\n\n\t\t\tif (this.isExclusiveOperationInProgress()) {\n\t\t\t\treturn $.Deferred().reject(\n\t\t\t\t\tnew Error('Another exclusive changeset operation is in progress.')\n\t\t\t\t).promise();\n\t\t\t}\n\n\t\t\tlet isExclusiveRequest = (status === 'publish') || (status === 'trash');\n\t\t\tif (isExclusiveRequest) {\n\t\t\t\tthis.exclusiveOperation(true);\n\t\t\t}\n\n\t\t\tconst savedChangeset = this.currentChangeset();\n\n\t\t\t//Keep a local copy of the settings in case something changes instance\n\t\t\t//properties while the request is in progress (should never happen).\n\t\t\tconst settingsToSend = this.pendingSettings;\n\t\t\tthis.sentSettings = settingsToSend;\n\t\t\tthis.pendingSettings = {};\n\n\t\t\tconst modifiedSettings = _.mapValues(settingsToSend, setting => setting.value());\n\t\t\tconst requestData: Record<string, any> = {\n\t\t\t\taction: 'ws_ame_ac_save_changeset',\n\t\t\t\t_ajax_nonce: this.saveChangesetNonce,\n\t\t\t\tchangeset: (savedChangeset?.name()) ?? '',\n\t\t\t\tmodified: JSON.stringify(modifiedSettings),\n\t\t\t};\n\t\t\tif (status !== null) {\n\t\t\t\trequestData['status'] = status;\n\t\t\t}\n\t\t\t//If the changeset doesn't have a name, it is new.\n\t\t\tif (!savedChangeset?.hasName()) {\n\t\t\t\trequestData['createNew'] = 1;\n\t\t\t}\n\n\t\t\t//Also send the metadata if it has changed.\n\t\t\tconst metadataWasChanged = this.metadataHasChanged();\n\t\t\tif (metadataWasChanged) {\n\t\t\t\tconst metadata = this.adminThemeMetadata();\n\t\t\t\trequestData['adminThemeMetadata'] = JSON.stringify(metadata);\n\t\t\t}\n\t\t\tthis.metadataHasChanged(false);\n\n\t\t\tconst request = $.ajax({\n\t\t\t\turl: this.ajaxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tdata: requestData,\n\t\t\t\tdataType: 'json',\n\t\t\t\ttimeout: 20000,\n\t\t\t});\n\t\t\tthis.currentChangesetRequest = request;\n\n\t\t\tinterface ServerValidationResults {\n\t\t\t\t[settingId: string]: {\n\t\t\t\t\tisValid: boolean;\n\t\t\t\t\terrors: Array<{ code: string; message: string; }>;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst self = this;\n\n\t\t\tfunction storeValidationResultsFrom(serverResponse: any) {\n\t\t\t\tconst results: ServerValidationResults = _.get(\n\t\t\t\t\tserverResponse,\n\t\t\t\t\t['data', 'validationResults']\n\t\t\t\t);\n\t\t\t\tif (typeof results !== 'object') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfor (const settingId in results) {\n\t\t\t\t\tconst setting = self.get(settingId);\n\t\t\t\t\tif (!setting.isDefined()) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!modifiedSettings.hasOwnProperty(settingId)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst sentValue = modifiedSettings[settingId];\n\n\t\t\t\t\tconst state = results[settingId];\n\t\t\t\t\tif (state.isValid) {\n\t\t\t\t\t\tsetting.get().clearValidationErrorsForValue(sentValue);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//Since the server response is not fully validated, some typeof checks\n\t\t\t\t\t\t//are still useful.\n\t\t\t\t\t\t// noinspection SuspiciousTypeOfGuard\n\t\t\t\t\t\tsetting.get().addValidationErrorsForValue(\n\t\t\t\t\t\t\tsentValue,\n\t\t\t\t\t\t\t_.filter(state.errors, error => (typeof error.message === 'string'))\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction storeChangesetDetailsFrom(serverResponse: any) {\n\t\t\t\tif (!savedChangeset) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t//Store the returned changeset name in case a new changeset was created\n\t\t\t\t//or an existing changeset was forked due to permissions.\n\t\t\t\tconst newName = _.get(serverResponse, ['data', 'changeset']);\n\t\t\t\tif (!savedChangeset.hasName() || (newName !== savedChangeset.name())) {\n\t\t\t\t\tif (typeof newName === 'string') {\n\t\t\t\t\t\tsavedChangeset.name(newName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//Store the changeset status.\n\t\t\t\tconst newStatus = _.get(serverResponse, ['data', 'changesetStatus']);\n\t\t\t\tif (typeof newStatus === 'string') {\n\t\t\t\t\tsavedChangeset.status(newStatus);\n\t\t\t\t}\n\n\t\t\t\t//Store the number of changes in the changeset.\n\t\t\t\tconst newChangeCount = _.get(serverResponse, ['data', 'changesetItemCount']);\n\t\t\t\tif (typeof newChangeCount === 'number') {\n\t\t\t\t\tsavedChangeset.knownItemCount(newChangeCount);\n\t\t\t\t}\n\n\t\t\t\t//Was the changeset published? Because changesets are typically moved\n\t\t\t\t//to trash after publishing, \"status\" might be \"trash\" instead of \"publish\",\n\t\t\t\t//but we still want to know if it was successfully published.\n\t\t\t\tconst wasPublished = _.get(serverResponse, ['data', 'changesetWasPublished'], null);\n\t\t\t\tif (wasPublished) {\n\t\t\t\t\tsavedChangeset.wasPublished(wasPublished);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trequest.done(function (response) {\n\t\t\t\tstoreChangesetDetailsFrom(response);\n\t\t\t\tstoreValidationResultsFrom(response);\n\n\t\t\t\t//After successfully publishing a changeset, it has no more\n\t\t\t\t//unsaved changes.\n\t\t\t\tconst isPublished =\n\t\t\t\t\t(savedChangeset.status() === 'publish')\n\t\t\t\t\t|| (savedChangeset.status() === 'future')\n\t\t\t\t\t|| (savedChangeset.wasPublished());\n\t\t\t\tif (isPublished) {\n\t\t\t\t\tsavedChangeset.currentSessionChanges(0);\n\t\t\t\t}\n\n\t\t\t\t//After a changeset is published or trashed, it can no longer\n\t\t\t\t//be edited. We may be able to replace it with a new changeset\n\t\t\t\t//that was created on the server.\n\t\t\t\tif (!self.currentChangeset().canBeModified()) {\n\t\t\t\t\tconst nextChangeset = _.get(response, ['data', 'nextChangeset']);\n\t\t\t\t\tif ((typeof nextChangeset === 'string') && (nextChangeset !== '')) {\n\t\t\t\t\t\tself.currentChangeset(new Changeset(nextChangeset));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\trequest.fail((requestObject: JQueryXHR) => {\n\t\t\t\tif (typeof requestObject.responseJSON === 'object') {\n\t\t\t\t\tstoreValidationResultsFrom(requestObject.responseJSON);\n\t\t\t\t\tstoreChangesetDetailsFrom(requestObject.responseJSON);\n\t\t\t\t}\n\n\t\t\t\t//Add the unsaved settings back to the pending list.\n\t\t\t\tfor (const id in settingsToSend) {\n\t\t\t\t\t//Keep only settings that still exist.\n\t\t\t\t\tif (this.get(id).isDefined()) {\n\t\t\t\t\t\tthis.pendingSettings[id] = settingsToSend[id];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//We don't automatically retry because the problem might be something\n\t\t\t\t//that doesn't get better on its own, like missing permissions.\n\t\t\t});\n\n\t\t\trequest.always(() => {\n\t\t\t\tthis.currentChangesetRequest = null;\n\t\t\t\tthis.sentSettings = {};\n\t\t\t\tif (isExclusiveRequest) {\n\t\t\t\t\tthis.exclusiveOperation(false);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn request;\n\t\t}\n\n\t\tpublic savePendingSettings(timeout: number = 20): JQueryPromise<any> {\n\t\t\tif (this.isExclusiveOperationInProgress()) {\n\t\t\t\t//Wait for the exclusive operation to finish.\n\t\t\t\tconst deferred = $.Deferred();\n\t\t\t\tconst result = deferred.then(() => this.doSavePendingSettings());\n\n\t\t\t\tconst startTime = Date.now();\n\t\t\t\tconst timer = setInterval(() => {\n\t\t\t\t\tif (!this.isExclusiveOperationInProgress()) {\n\t\t\t\t\t\tclearInterval(timer);\n\t\t\t\t\t\tdeferred.resolve();\n\t\t\t\t\t} else if ((Date.now() - startTime) > timeout) {\n\t\t\t\t\t\tclearInterval(timer);\n\t\t\t\t\t\tdeferred.reject(new Error('Exclusive operation timed out.'));\n\t\t\t\t\t}\n\t\t\t\t}, 200);\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\treturn this.doSavePendingSettings();\n\t\t}\n\n\t\tprivate doSavePendingSettings(): JQueryPromise<any> {\n\t\t\t//If there are no changes, we don't need to do anything.\n\t\t\tif (_.isEmpty(this.pendingSettings)) {\n\t\t\t\treturn $.Deferred().resolve().promise();\n\t\t\t}\n\t\t\treturn this.saveChangeset();\n\t\t}\n\n\t\tpublic getCurrentChangeset(): Changeset {\n\t\t\treturn this.currentChangeset();\n\t\t}\n\n\t\t/**\n\t\t * Get any unsaved setting changes.\n\t\t *\n\t\t * @returns Object An object mapping setting IDs to their modified values.\n\t\t */\n\t\tpublic get unsavedChanges(): Record<string, any> {\n\t\t\t//Include both pending settings and sent settings. Sent settings\n\t\t\t//might not be saved yet.\n\t\t\tlet unsavedSettings: Record<string, Setting> = {};\n\t\t\t_.defaults(unsavedSettings, this.pendingSettings, this.sentSettings);\n\n\t\t\treturn _.mapValues(unsavedSettings, setting => setting.value());\n\t\t}\n\n\t\tpublic publishChangeset(): JQueryPromise<any> {\n\t\t\tif (this.isExclusiveOperationInProgress()) {\n\t\t\t\treturn $.Deferred()\n\t\t\t\t\t.reject(new Error('Another exclusive changeset operation is already in progress.'))\n\t\t\t\t\t.promise();\n\t\t\t}\n\t\t\treturn this.saveChangeset('publish');\n\t\t}\n\n\t\tpublic trashChangeset(): JQueryPromise<any> {\n\t\t\tif (this.isExclusiveOperationInProgress()) {\n\t\t\t\treturn $.Deferred()\n\t\t\t\t\t.reject(new Error('Another exclusive changeset operation is already in progress.'))\n\t\t\t\t\t.promise();\n\t\t\t}\n\n\t\t\tconst changeset = this.currentChangeset();\n\t\t\tif (!changeset.hasName()) {\n\t\t\t\t//The changeset hasn't been saved yet, so we can just mark it as trashed.\n\t\t\t\tchangeset.status('trash');\n\t\t\t\tchangeset.currentSessionChanges(0);\n\n\t\t\t\t//It's a success of sorts.\n\t\t\t\treturn $.Deferred().resolve(true).promise();\n\t\t\t}\n\n\t\t\tthis.exclusiveOperation(true);\n\n\t\t\tconst requestData: Record<string, any> = {\n\t\t\t\taction: 'ws_ame_ac_trash_changeset',\n\t\t\t\t_ajax_nonce: this.trashChangesetNonce,\n\t\t\t\tchangeset: changeset.name\n\t\t\t};\n\n\t\t\tconst request = $.ajax({\n\t\t\t\turl: this.ajaxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tdata: requestData,\n\t\t\t\tdataType: 'json',\n\t\t\t\ttimeout: 20000,\n\t\t\t});\n\t\t\tthis.currentChangesetRequest = request;\n\n\t\t\trequest.done(function () {\n\t\t\t\tchangeset.status('trash');\n\t\t\t\tchangeset.currentSessionChanges(0);\n\t\t\t});\n\n\t\t\t//Unfortunately, jQuery doesn't seem to allow us to create a custom\n\t\t\t//error object and pass it to other handlers, so code that uses this\n\t\t\t//method will have to parse the error response itself.\n\n\t\t\trequest.always(() => {\n\t\t\t\tthis.currentChangesetRequest = null;\n\t\t\t\tthis.exclusiveOperation(false);\n\t\t\t});\n\n\t\t\treturn request;\n\t\t}\n\n\t\tpublic addInitialThemeMetadata(metadata: AdminThemeMetadata | null) {\n\t\t\tthis.underlyingMetadata(metadata);\n\t\t\tthis.metadataHasChanged(false);\n\t\t}\n\t}\n\n\tclass Changeset {\n\t\tpublic readonly name: KnockoutObservable<string>;\n\t\tpublic readonly knownItemCount: KnockoutObservable<number>;\n\t\tpublic readonly status: KnockoutObservable<string>;\n\n\t\t/**\n\t\t * The number of times settings have been changed in this changeset\n\t\t * during the current customizer session.\n\t\t *\n\t\t * Note that this is not the same as the number settings in the changeset:\n\t\t * if the same setting is changed X times, this counter will increase by X,\n\t\t * but the changeset will still only have one entry for that setting.\n\t\t */\n\t\tpublic readonly currentSessionChanges: KnockoutObservable<number> = ko.observable(0);\n\n\t\t/**\n\t\t * Once a changeset has been published or deleted, its contents can't be modified any more.\n\t\t * @private\n\t\t */\n\t\tprivate readonly fixedContentStatuses: Record<string, any> =\n\t\t\t{'publish': true, 'trash': true, 'future': true};\n\n\t\tpublic readonly wasPublished: KnockoutObservable<boolean> = ko.observable(false);\n\n\t\tconstructor(name: string = '', knownItemCount: number = 0, initialStatus: string | null = '') {\n\t\t\tthis.name = ko.observable(name);\n\n\t\t\tthis.name.subscribe((newName) => {\n\t\t\t\t//In theory, the type system should ensure that the name is always a string,\n\t\t\t\t//but that only works on the TS side. I've previously run into a bug where\n\t\t\t\t//a null value was sent from the server. Let's add a check here to make it\n\t\t\t\t//easier to spot bugs like that in the future.\n\t\t\t\tif ((typeof (newName as unknown) !== 'string')) {\n\t\t\t\t\tthrow new Error('Changeset name must always be a string, found ' + (typeof newName));\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.knownItemCount = ko.observable(knownItemCount);\n\t\t\tthis.status = ko.observable(initialStatus ?? '');\n\t\t}\n\n\t\tpublic hasName(): boolean {\n\t\t\tconst name = this.name();\n\t\t\treturn (name !== '');\n\t\t}\n\n\t\tpublic canBeModified(): boolean {\n\t\t\treturn !this.fixedContentStatuses.hasOwnProperty(this.status());\n\t\t}\n\n\t\tpublic isNonEmpty(): boolean {\n\t\t\treturn (this.currentSessionChanges() > 0) || (this.knownItemCount() > 0)\n\t\t}\n\t}\n\n\tconst TemporaryChangesetName = 'temporary000'; //Note: Must match the value used in PHP.\n\n\t//region Admin theme\n\tconst UrlOrEmpty = z.union([\n\t\tz.string().url().max(1000),\n\t\tz.literal('')\n\t]);\n\n\tconst AdminThemeMetadata = z.object({\n\t\tpluginName: z.string().max(100),\n\t\tshortDescription: z.string().max(500),\n\n\t\tpluginSlug: z.string().max(64).toLowerCase().default('')\n\t\t\t.refine(\n\t\t\t\tfunction (input: string) {\n\t\t\t\t\t//Only allow alphanumeric characters, underscores, and dashes.\n\t\t\t\t\t//Empty string is allowed.\n\t\t\t\t\treturn /^[a-z0-9_-]*$/.test(input);\n\t\t\t\t},\n\t\t\t\t{message: 'The slug can only contain letters (a-z), numbers, underscores, and dashes.'}\n\t\t\t),\n\t\tidentifierPrefix: z.string().max(20).optional(),\n\n\t\tpluginVersion: z.string().default('1.0').optional(),\n\t\tpluginUrl: UrlOrEmpty.optional(),\n\t\tauthorName: z.string().max(100).optional(),\n\t\tauthorUrl: UrlOrEmpty.optional(),\n\t\trequiredWpVersion: z.string().max(30).default('4.7').optional(),\n\t\ttestedWpVersion: z.string().max(30).optional(),\n\t\twasEverConfirmed: z.boolean().default(false).optional(),\n\t});\n\n\ttype AdminThemeMetadata = z.infer<typeof AdminThemeMetadata>;\n\n\tconst AdminThemeSettings = z.record(\n\t\t//Key type\n\t\tz.string().min(1),\n\t\t//Value type\n\t\tz.any()\n\t);\n\n\tclass AdminThemeImportReport {\n\t\tpublic totalSettings: number = 0;\n\t\tpublic importedSettings: number = 0;\n\t\tpublic invalidSettings: number = 0;\n\t\tpublic skippedSettings: number = 0;\n\t\tpublic differentImportedSettings: number = 0;\n\n\t\tpublic readonly pluginName: string;\n\n\t\tconstructor(\n\t\t\tpublic readonly fileName: string,\n\t\t\tpublic readonly metadata: AdminThemeMetadata\n\t\t) {\n\t\t\tthis.pluginName = metadata.pluginName || '(Unnamed)';\n\t\t}\n\t}\n\n\tinterface WithZodValidationResults extends ObservableValidationFields {\n\t\tameZodValidationError: KnockoutObservable<z.ZodError | null>;\n\t}\n\n\ttype ZodValidatedObservable<T> = KnockoutComputed<T> & WithZodValidationResults;\n\n\tfunction observableWithZodValidation<T, S extends z.Schema<T>>(\n\t\tvalue: z.output<S>,\n\t\tschema: S\n\t): ZodValidatedObservable<z.output<S>> {\n\t\tconst underlyingObservable = ko.observable(value);\n\n\t\tconst observable: ZodValidatedObservable<T> = ko.pureComputed({\n\t\t\tread: underlyingObservable,\n\t\t\twrite: (newValue: T) => {\n\t\t\t\tconst validationResult = schema.safeParse(newValue);\n\t\t\t\tif (validationResult.success) {\n\t\t\t\t\tunderlyingObservable(validationResult.data);\n\t\t\t\t\tobservable.ameZodValidationError(null);\n\t\t\t\t\tobservable.ameValidationErrors([]);\n\t\t\t\t} else {\n\t\t\t\t\tobservable.ameZodValidationError(validationResult.error);\n\t\t\t\t\t//Convert Zod issues to ObservableValidationErrors.\n\t\t\t\t\tobservable.ameValidationErrors(validationResult.error.issues.map(issue => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcode: issue.code,\n\t\t\t\t\t\t\tmessage: issue.message\n\t\t\t\t\t\t} satisfies ObservableValidationError;\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t}\n\t\t}) as ZodValidatedObservable<T>;\n\n\t\tobservable.ameZodValidationError = ko.observable(null);\n\t\tobservable.ameValidationErrors = ko.observable([] as ObservableValidationError[]);\n\t\tobservable.ameIsValid = ko.pureComputed(() => {\n\t\t\tconst errors = observable.ameValidationErrors();\n\t\t\treturn !errors || errors.length === 0;\n\t\t});\n\n\t\treturn observable;\n\t}\n\n\tclass ObservableThemeMetadata {\n\t\tpublic readonly pluginName: ZodValidatedObservable<string>;\n\t\tpublic readonly shortDescription: ZodValidatedObservable<string>;\n\t\tpublic readonly pluginSlug: ZodValidatedObservable<AdminThemeMetadata['pluginSlug']>;\n\t\tpublic readonly identifierPrefix: ZodValidatedObservable<AdminThemeMetadata['identifierPrefix']>;\n\t\tpublic readonly pluginVersion: ZodValidatedObservable<AdminThemeMetadata['pluginVersion']>;\n\t\tpublic readonly pluginUrl: ZodValidatedObservable<AdminThemeMetadata['pluginUrl']>;\n\t\tpublic readonly authorName: ZodValidatedObservable<AdminThemeMetadata['authorName']>;\n\t\tpublic readonly authorUrl: ZodValidatedObservable<AdminThemeMetadata['authorUrl']>;\n\t\tpublic readonly requiredWpVersion: ZodValidatedObservable<AdminThemeMetadata['requiredWpVersion']>;\n\t\tpublic readonly testedWpVersion: ZodValidatedObservable<AdminThemeMetadata['testedWpVersion']>;\n\t\tpublic readonly wasEverConfirmed: ZodValidatedObservable<AdminThemeMetadata['wasEverConfirmed']>;\n\n\t\tconstructor(metadata: AdminThemeMetadata) {\n\t\t\tthis.pluginName = observableWithZodValidation(\n\t\t\t\tmetadata.pluginName,\n\t\t\t\tAdminThemeMetadata.shape.pluginName\n\t\t\t);\n\t\t\tthis.shortDescription = observableWithZodValidation(\n\t\t\t\tmetadata.shortDescription,\n\t\t\t\tAdminThemeMetadata.shape.shortDescription\n\t\t\t);\n\n\t\t\tthis.pluginSlug = observableWithZodValidation(\n\t\t\t\tmetadata.pluginSlug ?? '',\n\t\t\t\tAdminThemeMetadata.shape.pluginSlug\n\t\t\t);\n\t\t\tthis.identifierPrefix = observableWithZodValidation(\n\t\t\t\tmetadata.identifierPrefix ?? '',\n\t\t\t\tAdminThemeMetadata.shape.identifierPrefix\n\t\t\t);\n\n\t\t\tthis.pluginVersion = observableWithZodValidation(\n\t\t\t\tmetadata.pluginVersion ?? '',\n\t\t\t\tAdminThemeMetadata.shape.pluginVersion\n\t\t\t);\n\t\t\tthis.pluginUrl = observableWithZodValidation(\n\t\t\t\tmetadata.pluginUrl ?? '',\n\t\t\t\tAdminThemeMetadata.shape.pluginUrl\n\t\t\t);\n\t\t\tthis.authorName = observableWithZodValidation(\n\t\t\t\tmetadata.authorName ?? '',\n\t\t\t\tAdminThemeMetadata.shape.authorName\n\t\t\t);\n\t\t\tthis.authorUrl = observableWithZodValidation(\n\t\t\t\tmetadata.authorUrl ?? '',\n\t\t\t\tAdminThemeMetadata.shape.authorUrl\n\t\t\t);\n\t\t\tthis.requiredWpVersion = observableWithZodValidation(\n\t\t\t\tmetadata.requiredWpVersion ?? '',\n\t\t\t\tAdminThemeMetadata.shape.requiredWpVersion\n\t\t\t);\n\t\t\tthis.testedWpVersion = observableWithZodValidation(\n\t\t\t\tmetadata.testedWpVersion ?? '',\n\t\t\t\tAdminThemeMetadata.shape.testedWpVersion\n\t\t\t);\n\n\t\t\tthis.wasEverConfirmed = observableWithZodValidation(\n\t\t\t\tmetadata.wasEverConfirmed ?? false,\n\t\t\t\tAdminThemeMetadata.shape.wasEverConfirmed\n\t\t\t);\n\t\t}\n\n\t\tpublic toObject(): AdminThemeMetadata {\n\t\t\treturn {\n\t\t\t\tpluginName: this.pluginName(),\n\t\t\t\tshortDescription: this.shortDescription(),\n\t\t\t\tpluginSlug: this.pluginSlug(),\n\t\t\t\tidentifierPrefix: this.identifierPrefix(),\n\t\t\t\tpluginVersion: this.pluginVersion(),\n\t\t\t\tpluginUrl: this.pluginUrl(),\n\t\t\t\tauthorName: this.authorName(),\n\t\t\t\tauthorUrl: this.authorUrl(),\n\t\t\t\trequiredWpVersion: this.requiredWpVersion(),\n\t\t\t\ttestedWpVersion: this.testedWpVersion(),\n\t\t\t\twasEverConfirmed: this.wasEverConfirmed()\n\t\t\t};\n\t\t}\n\n\t\tisValid(): boolean {\n\t\t\t//This seems really inelegant, but I can't think of a better way to do it.\n\t\t\treturn this.pluginName.ameIsValid()\n\t\t\t\t&& this.shortDescription.ameIsValid()\n\t\t\t\t&& this.pluginSlug.ameIsValid()\n\t\t\t\t&& this.identifierPrefix.ameIsValid()\n\t\t\t\t&& this.pluginVersion.ameIsValid()\n\t\t\t\t&& this.pluginUrl.ameIsValid()\n\t\t\t\t&& this.authorName.ameIsValid()\n\t\t\t\t&& this.authorUrl.ameIsValid()\n\t\t\t\t&& this.requiredWpVersion.ameIsValid()\n\t\t\t\t&& this.testedWpVersion.ameIsValid()\n\t\t\t\t&& this.wasEverConfirmed.ameIsValid();\n\t\t}\n\t}\n\n\tenum MetadataDialogMode {\n\t\tDownload,\n\t\tEdit\n\t}\n\n\tclass DownloadThemeDialog extends AmeBaseKnockoutDialog {\n\t\tpublic readonly meta: KnockoutObservable<ObservableThemeMetadata>;\n\t\tpublic readonly areFieldsEditable: KnockoutComputed<boolean>;\n\t\tpublic readonly isOperationInProgress: KnockoutObservable<boolean> = ko.observable(false);\n\n\t\tpublic readonly mode: KnockoutObservable<MetadataDialogMode> = ko.observable<MetadataDialogMode>(MetadataDialogMode.Download);\n\n\t\tautoCancelButton: boolean = true;\n\t\tisConfirmButtonEnabled: KnockoutObservable<boolean>;\n\t\treadonly confirmButtonLabel: KnockoutObservable<string | null>;\n\n\t\tadvancedOptionsVisible: KnockoutObservable<boolean> = ko.observable(false);\n\t\tadvancedOptionsToggleLabel: KnockoutComputed<string>;\n\n\t\thelpVisible: KnockoutObservable<boolean> = ko.observable(false);\n\t\thelpToggleLabel: KnockoutComputed<string>;\n\t\thelpContainerVisible: KnockoutComputed<boolean>;\n\n\t\tchangesetName: KnockoutObservable<string> = ko.observable('');\n\t\tmetadataJson: KnockoutObservable<string> = ko.observable('');\n\t\tdownloadCookieName: KnockoutObservable<string> = ko.observable('');\n\n\t\tpublic readonly adminThemeTexts: Required<AdminThemeTexts>;\n\n\t\tprivate cleanupCurrentDownload: () => void = () => {\n\t\t};\n\n\t\tconstructor(\n\t\t\tprivate readonly getChangesetName: () => string,\n\t\t\tprivate readonly savePendingChangesetData: () => JQueryPromise<any>,\n\t\t\tprivate readonly metadataObservable: KnockoutObservable<AdminThemeMetadata | null>,\n\t\t\tcustomAdminThemeTexts: AdminThemeTexts\n\t\t) {\n\t\t\tsuper();\n\t\t\tthis.options.minWidth = 400;\n\n\t\t\tthis.adminThemeTexts = {\n\t\t\t\t...{\n\t\t\t\t\tgeneratorCreditPhrase: 'generated using the Admin Menu Editor Pro plugin.',\n\t\t\t\t\tstandalonePluginNote: 'The result is a standalone plugin that you can use without Admin Menu Editor Pro.',\n\t\t\t\t},\n\t\t\t\t...customAdminThemeTexts\n\t\t\t}\n\n\t\t\tlet initialMetadata = metadataObservable();\n\t\t\tif (initialMetadata === null) {\n\t\t\t\tinitialMetadata = this.getSampleMetadata();\n\t\t\t}\n\n\t\t\tthis.meta = ko.observable(new ObservableThemeMetadata(initialMetadata));\n\n\t\t\tthis.confirmButtonLabel = ko.computed(() => {\n\t\t\t\tif (this.mode() === MetadataDialogMode.Download) {\n\t\t\t\t\treturn 'Download Admin Theme';\n\t\t\t\t}\n\t\t\t\treturn 'OK';\n\t\t\t});\n\n\t\t\tthis.isConfirmButtonEnabled = ko.computed(() => {\n\t\t\t\tif (this.isOperationInProgress()) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (getChangesetName() === '') {\n\t\t\t\t\t//To generate an admin theme, the changeset must have already been saved.\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn this.meta().isValid();\n\t\t\t});\n\n\t\t\tthis.areFieldsEditable = ko.computed(() => {\n\t\t\t\treturn !this.isOperationInProgress();\n\t\t\t});\n\n\t\t\tthis.advancedOptionsToggleLabel = ko.pureComputed((): string => {\n\t\t\t\treturn this.advancedOptionsVisible() ? 'Fewer options' : 'More options';\n\t\t\t});\n\t\t\tthis.helpToggleLabel = ko.pureComputed((): string => {\n\t\t\t\treturn this.helpVisible() ? 'Hide info' : 'How it works';\n\t\t\t});\n\n\t\t\t//Hide the help container in download mode.\n\t\t\tthis.helpContainerVisible = ko.pureComputed((): boolean => {\n\t\t\t\treturn this.mode() === MetadataDialogMode.Download;\n\t\t\t});\n\n\t\t\tthis.mode.subscribe((newMode: MetadataDialogMode) => {\n\t\t\t\tif (newMode === MetadataDialogMode.Download) {\n\t\t\t\t\tthis.title('Generate admin theme');\n\t\t\t\t} else if (newMode === MetadataDialogMode.Edit) {\n\t\t\t\t\tthis.title('Edit admin theme properties');\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tprivate getSampleMetadata() {\n\t\t\treturn AdminThemeMetadata.parse({\n\t\t\t\tpluginName: 'Custom Admin Theme',\n\t\t\t\tshortDescription: 'A custom admin theme ' + this.adminThemeTexts.generatorCreditPhrase,\n\t\t\t\tpluginVersion: '1.0',\n\t\t\t});\n\t\t}\n\n\t\tonOpen(event: JQueryEventObject, ui: any): void {\n\t\t\tlet latestMetadata = this.metadataObservable();\n\t\t\tif (latestMetadata === null) {\n\t\t\t\tlatestMetadata = this.getSampleMetadata();\n\t\t\t}\n\t\t\tthis.meta(new ObservableThemeMetadata(latestMetadata));\n\t\t}\n\n\t\ttoggleAdvancedOptions(): void {\n\t\t\tthis.advancedOptionsVisible(!this.advancedOptionsVisible());\n\t\t}\n\n\t\ttoggleHelp(): void {\n\t\t\tthis.helpVisible(!this.helpVisible());\n\t\t}\n\n\t\tonConfirm(event: JQueryEventObject) {\n\t\t\tif (!this.meta().isValid()) {\n\t\t\t\t//This should never happen because the confirm button is disabled\n\t\t\t\t//when the metadata is invalid.\n\t\t\t\talert('Error: The admin theme details are not valid.');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst metadata = this.meta().toObject();\n\t\t\tmetadata.wasEverConfirmed = true;\n\t\t\tthis.metadataObservable(metadata);\n\n\t\t\tif (this.mode() === MetadataDialogMode.Edit) {\n\t\t\t\t//That's all we need to do in edit mode.\n\t\t\t\tthis.isOpen(false);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.triggerDownloadWithErrorReporting(metadata);\n\t\t}\n\n\t\tpublic triggerDownloadWithErrorReporting(metadata: AdminThemeMetadata) {\n\t\t\tif (this.isOperationInProgress()) {\n\t\t\t\talert('Error: Another operation is already in progress.');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.triggerDownload(metadata)\n\t\t\t\t.fail((error: string) => {\n\t\t\t\t\tif (error !== '') {\n\t\t\t\t\t\talert('Error: ' + error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\tprivate triggerDownload(metadata: AdminThemeMetadata): JQueryPromise<any> {\n\t\t\tconst deferred = $.Deferred();\n\n\t\t\t//Sanity checks.\n\t\t\t//Download mode still requires a saved changeset.\n\t\t\tconst changesetName = this.getChangesetName();\n\t\t\tif (changesetName === '') {\n\t\t\t\treturn deferred.reject('The changeset has not been saved yet (name is empty).').promise();\n\t\t\t}\n\n\t\t\tthis.isOperationInProgress(true);\n\n\t\t\tconst $form = $('#ame-ac-theme-download-request-form');\n\t\t\tconst $frame = $('#ame-ac-theme-download-frame');\n\n\t\t\t//Cancel the operation and re-enable buttons if the request takes too long.\n\t\t\tlet isCancelledOrDone: boolean = false;\n\t\t\tconst requestTimeoutMs = 30000;\n\t\t\tconst requestStartTime = (new Date()).getTime();\n\t\t\tlet statusCheckInterval: ReturnType<typeof setTimeout> | null = null;\n\n\t\t\tconst cleanup = this.cleanupCurrentDownload = () => {\n\t\t\t\tisCancelledOrDone = true;\n\n\t\t\t\t$frame.off('load.ameAcDownloadAdminTheme');\n\t\t\t\tif (timeoutTimer) {\n\t\t\t\t\tclearTimeout(timeoutTimer);\n\t\t\t\t}\n\t\t\t\tif (statusCheckInterval) {\n\t\t\t\t\tclearInterval(statusCheckInterval);\n\t\t\t\t}\n\t\t\t\t$frame.attr('src', 'about:blank');\n\n\t\t\t\tthis.isOperationInProgress(false);\n\n\t\t\t\tif (this.cleanupCurrentDownload === cleanup) {\n\t\t\t\t\tthis.cleanupCurrentDownload = () => {\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst timeoutTimer = setTimeout(() => {\n\t\t\t\tdeferred.reject('The download operation timed out.');\n\t\t\t\tcleanup();\n\t\t\t}, requestTimeoutMs);\n\n\t\t\tthis.savePendingChangesetData().then(\n\t\t\t\t() => {\n\t\t\t\t\tif (isCancelledOrDone) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.changesetName(changesetName);\n\t\t\t\t\tthis.metadataJson(JSON.stringify(metadata));\n\n\t\t\t\t\t//The server will set a cookie with a unique name that can be used\n\t\t\t\t\t//to check if the download has been initiated. Note that the user\n\t\t\t\t\t//can still cancel the download.\n\t\t\t\t\tconst cookieName = ('ameAcFileDownload_'\n\t\t\t\t\t\t+ new Date().getTime()\n\t\t\t\t\t\t+ '_'\n\t\t\t\t\t\t+ Math.round(Math.random() * 10000) //No dots allowed in these cookie names.\n\t\t\t\t\t);\n\t\t\t\t\tthis.downloadCookieName(cookieName);\n\n\t\t\t\t\t//Clear the frame to prevent the old response from being read.\n\t\t\t\t\t$frame.attr('src', 'about:blank');\n\t\t\t\t\ttry {\n\t\t\t\t\t\t$frame.contents().find('body').html('');\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t//Ignore but log cross-origin errors. These should not happen in practice.\n\t\t\t\t\t\tif (console && console.error) {\n\t\t\t\t\t\t\tconsole.error(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstatusCheckInterval = setInterval(() => {\n\t\t\t\t\t\tconst cookieValue = $.cookie(cookieName);\n\t\t\t\t\t\tif (cookieValue) {\n\t\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\t\t$.removeCookie(cookieName);\n\n\t\t\t\t\t\t\t//Close the dialog when the download starts.\n\t\t\t\t\t\t\tthis.isOpen(false);\n\t\t\t\t\t\t\tdeferred.resolve();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ((new Date()).getTime() - requestStartTime > requestTimeoutMs) {\n\t\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\t\tdeferred.reject('The download operation timed out.');\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 1000);\n\n\t\t\t\t\t$frame.on('load.ameAcDownloadAdminTheme', () => {\n\t\t\t\t\t\t//Get the response from the frame. It should be JSON displayed as text.\n\t\t\t\t\t\tconst responseText = String($frame.contents().text()).trim();\n\t\t\t\t\t\tconst response = JSON.parse(responseText);\n\n\t\t\t\t\t\tcleanup();\n\n\t\t\t\t\t\tif ((response === null) || (typeof response !== 'object')) {\n\t\t\t\t\t\t\tdeferred.reject('Received an invalid response from the server.');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!response.success) {\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\tif (response.data.message) {\n\t\t\t\t\t\t\t\t\terrorMessage = response.data.message;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\terrorMessage = 'An unknown error occurred on the server.';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdeferred.reject(errorMessage);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//This should never happen in practice.\n\t\t\t\t\t\t\t\tdeferred.reject('The server did not start the download correctly.');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\t$form.trigger('submit');\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tif (isCancelledOrDone) {\n\t\t\t\t\t\tif (deferred.state() === 'pending') {\n\t\t\t\t\t\t\tdeferred.reject(''); //No error message; the user probably cancelled the operation.\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcleanup();\n\t\t\t\t\tdeferred.reject('Could not save the changeset data before generating an admin theme.');\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn deferred.promise();\n\t\t}\n\n\t\tonClose(event: JQueryEventObject, ui: any) {\n\t\t\tthis.cleanupCurrentDownload();\n\t\t}\n\t}\n\n\t//endregion\n\n\tclass SectionNavigation {\n\t\tprivate sectionNavStack: KnockoutObservableArray<string> = ko.observableArray([] as string[]);\n\t\tprivate $sectionList: JQuery;\n\n\t\tpublic readonly breadcrumbs: KnockoutObservable<NavigationBreadcrumb[]>;\n\n\t\tconstructor() {\n\t\t\tthis.$sectionList = $('#ame-ac-container-collection');\n\n\t\t\tthis.$sectionList.on('click', '.ame-ac-section-link', (event) => {\n\t\t\t\tevent.preventDefault()\n\n\t\t\t\tif (event.currentTarget === null) {\n\t\t\t\t\treturn; //Shouldn't happen in practice, but let's satisfy the type checker.\n\t\t\t\t}\n\n\t\t\t\tconst targetId = $(event.currentTarget).data('target-id');\n\t\t\t\tif (targetId) {\n\t\t\t\t\tthis.navigateToSection(targetId);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.$sectionList.on('click', '.ame-ac-section-back-button', (event) => {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.navigateBack();\n\t\t\t});\n\n\t\t\tthis.breadcrumbs = ko.pureComputed(() => {\n\t\t\t\treturn this.sectionNavStack()\n\t\t\t\t\t.map((sectionId) => $('#' + sectionId))\n\t\t\t\t\t.filter(($section) => $section.length > 0)\n\t\t\t\t\t.map(($section) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: $section.find('.ame-ac-section-title .ame-ac-section-own-title')\n\t\t\t\t\t\t\t\t.first().text()\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tnavigateToSection(sectionElementId: string) {\n\t\t\tconst $section = $('#' + sectionElementId);\n\t\t\tif ($section.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ($section.hasClass('ame-ac-current-section')) {\n\t\t\t\treturn; //Already on this section.\n\t\t\t}\n\n\t\t\t//If the requested section is in the navigation stack, navigate back\n\t\t\t//to it instead of putting more sections on the stack.\n\t\t\tconst stackIndex = this.sectionNavStack.indexOf(sectionElementId);\n\t\t\tif (stackIndex !== -1) {\n\t\t\t\twhile (this.sectionNavStack().length > stackIndex) {\n\t\t\t\t\tthis.navigateBack();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst $previousSection = this.$sectionList.find('.ame-ac-current-section');\n\t\t\tif ($previousSection.length > 0) {\n\t\t\t\tthis.expectTransition($previousSection, '.ame-ac-section');\n\t\t\t\t$previousSection\n\t\t\t\t\t.removeClass('ame-ac-current-section')\n\t\t\t\t\t.addClass('ame-ac-previous-section');\n\t\t\t\tthis.sectionNavStack.push($previousSection.attr('id'));\n\n\t\t\t\t$previousSection.trigger('adminMenuEditor:leaveSection');\n\t\t\t}\n\n\t\t\tthis.expectTransition($section, '.ame-ac-section');\n\t\t\t$section.addClass('ame-ac-current-section');\n\n\t\t\t$section.trigger('adminMenuEditor:enterSection');\n\t\t}\n\n\t\tnavigateBack() {\n\t\t\tif (this.sectionNavStack().length < 1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst $newCurrentSection = $('#' + this.sectionNavStack.pop());\n\t\t\tif ($newCurrentSection.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst $oldCurrentSection = this.$sectionList.find('.ame-ac-current-section');\n\t\t\tthis.expectTransition($oldCurrentSection, '.ame-ac-section');\n\t\t\t$oldCurrentSection.removeClass('ame-ac-current-section ame-ac-previous-section');\n\t\t\t$oldCurrentSection.trigger('adminMenuEditor:leaveSection');\n\n\t\t\tconst $oldPreviousSection = this.$sectionList.find('.ame-ac-previous-section');\n\t\t\t$oldPreviousSection.removeClass('ame-ac-previous-section');\n\n\t\t\t//Show the new current section.\n\t\t\tthis.expectTransition($newCurrentSection, '.ame-ac-section');\n\t\t\t$newCurrentSection.addClass('ame-ac-current-section');\n\t\t\t$newCurrentSection.trigger('adminMenuEditor:enterSection');\n\n\t\t\t//The next section in the stack becomes the previous section.\n\t\t\tif (this.sectionNavStack().length > 0) {\n\t\t\t\tthis.$sectionList.find('#' + this.sectionNavStack()[this.sectionNavStack().length - 1])\n\t\t\t\t\t.addClass('ame-ac-previous-section');\n\t\t\t}\n\t\t}\n\n\t\t//Add a special class to sections when they have an active CSS transition.\n\t\t//This is used to keep both sections visible while the previous section\n\t\t//slides out and the next section slides in.\n\t\texpectTransition($element: JQuery, requiredSelector: string) {\n\t\t\tif (prefersReducedMotion) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ($element.data('ameHasTransitionEvents')) {\n\t\t\t\treturn; //Event handler(s) already added.\n\t\t\t}\n\n\t\t\tconst transitionEvents = 'transitionend transitioncancel';\n\n\t\t\t$element.addClass('ame-ac-transitioning');\n\n\t\t\tfunction transitionEndCallback(event: JQueryEventObject) {\n\t\t\t\t//Ignore events that bubble from child elements.\n\t\t\t\tif (!$(event.target).is(requiredSelector)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$element\n\t\t\t\t\t.off(transitionEvents, transitionEndCallback)\n\t\t\t\t\t.data('ameHasTransitionEvents', null)\n\t\t\t\t\t.removeClass('ame-ac-transitioning');\n\t\t\t}\n\n\t\t\t$element.data('ameHasTransitionEvents', true);\n\t\t\t$element.on(transitionEvents, transitionEndCallback);\n\t\t}\n\t}\n\n\texport interface NavigationBreadcrumb {\n\t\ttitle: string;\n\t}\n\n\t/**\n\t * Whether to ask for confirmation when the user tries to exit the customizer.\n\t */\n\tenum ExitPromptMode {\n\t\t/**\n\t\t * Ask if there are unsaved changes.\n\t\t */\n\t\tUnsavedChanges = 1,\n\n\t\t/**\n\t\t * Ask if the current changeset hasn't been published yet.\n\t\t */\n\t\tUnpublishedChanges = 2\n\t}\n\n\texport class AdminCustomizer extends AmeAdminCustomizerBase.AdminCustomizerBase implements CustomizableVmInterface {\n\t\tprivate readonly exitPromptMessage = 'Unsaved changes will be lost if you navigate away from this page.';\n\t\t//Admin themes generated by this plugin should be fairly small.\n\t\tprivate readonly maxImportFileSize = 500 * 1024;\n\n\t\tsectionNavigation: SectionNavigation;\n\t\tsettings: CustomizerSettingsCollection;\n\t\tpublic readonly interfaceStructure: InterfaceStructure;\n\n\t\tprivate readonly $previewFrame: JQuery;\n\n\t\t/**\n\t\t * Preview frame URL.\n\t\t */\n\t\tprivate currentPreviewUrl: string | null = null;\n\t\t/**\n\t\t * The default preview URL that can be used when the current frame URL cannot be detected.\n\t\t */\n\t\tprivate readonly initialPreviewUrl: string;\n\t\tprivate previewConnection: ReturnType<typeof AmeAcCommunicator.connectToChild> | null = null;\n\t\tprivate readonly refreshPreviewNonce: string;\n\n\t\tprivate readonly $saveButton: JQuery;\n\n\t\tpublic readonly downloadThemeDialog: DownloadThemeDialog;\n\t\tprivate $extraActionMenu: JQuery | null = null;\n\t\tprivate $extraActionButton: JQuery | null = null;\n\n\t\tprivate $importFileInput: JQuery | null = null;\n\t\tprivate isImporting: KnockoutObservable<boolean> = ko.observable(false);\n\t\tprivate lastImportReport: KnockoutObservable<AdminThemeImportReport | null> = ko.observable(null);\n\t\tprivate isImportReportVisible: KnockoutObservable<boolean> = ko.observable(true);\n\n\t\tprivate isDiscardingChanges: KnockoutObservable<boolean> = ko.observable(false);\n\n\t\tpublic readonly isGeneralOverlayVisible: KnockoutObservable<boolean>;\n\n\t\tprivate readonly importActionEnabled: KnockoutComputed<boolean>;\n\t\tprivate readonly discardChangesActionEnabled: KnockoutComputed<boolean>;\n\t\tprivate readonly downloadThemeActionEnabled: KnockoutComputed<boolean>;\n\n\t\tprivate readonly customBasePath: string | null;\n\t\tprivate readonly consoleLoggingEnabled: boolean;\n\t\tprivate readonly exitPromptMode: ExitPromptMode;\n\n\t\tprivate readonly downloadOnlyIfChangesetIsNonEmpty: boolean;\n\n\t\tconstructor(scriptData: ScriptData) {\n\t\t\tsuper(scriptData);\n\n\t\t\tthis.settings = new CustomizerSettingsCollection(\n\t\t\t\tscriptData.ajaxUrl,\n\t\t\t\tscriptData.saveChangesetNonce,\n\t\t\t\tscriptData.trashChangesetNonce,\n\t\t\t\tscriptData.changesetName,\n\t\t\t\tscriptData.changesetItemCount,\n\t\t\t\tscriptData.changesetStatus\n\t\t\t);\n\t\t\t_.forOwn(scriptData.settings, (data, id) => {\n\t\t\t\tif (typeof id === 'string') {\n\t\t\t\t\tthis.settings.add(unserializeSetting(id, data));\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (scriptData.changesetThemeMetadata) {\n\t\t\t\tthis.settings.addInitialThemeMetadata(scriptData.changesetThemeMetadata);\n\t\t\t}\n\n\t\t\tthis.customBasePath = scriptData.customBasePath || null;\n\t\t\tthis.consoleLoggingEnabled = scriptData.isWpDebugEnabled || false;\n\t\t\tthis.downloadOnlyIfChangesetIsNonEmpty = scriptData.downloadOnlyIfChangesetIsNonEmpty || false;\n\n\t\t\tif ((typeof scriptData.exitPromptMode === 'number') && (scriptData.exitPromptMode in ExitPromptMode)) {\n\t\t\t\tthis.exitPromptMode = scriptData.exitPromptMode;\n\t\t\t} else {\n\t\t\t\tthis.exitPromptMode = ExitPromptMode.UnpublishedChanges;\n\t\t\t}\n\n\t\t\tlet sectionIdCounter = 0;\n\n\t\t\tthis.interfaceStructure = unserializeUiElement(\n\t\t\t\tscriptData.interfaceStructure,\n\t\t\t\tthis.settings.get.bind(this.settings),\n\t\t\t\t(data: AnySpecificElementData) => {\n\t\t\t\t\tswitch (data.t) {\n\t\t\t\t\t\tcase 'section':\n\t\t\t\t\t\t\tdata.component = 'ame-ac-section';\n\t\t\t\t\t\t\t//All sections must have unique IDs for navigation to work.\n\t\t\t\t\t\t\tif (!data.id) {\n\t\t\t\t\t\t\t\tdata.id = 'autoID-' + (++sectionIdCounter);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'control-group':\n\t\t\t\t\t\t\tdata.component = 'ame-ac-control-group';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'control':\n\t\t\t\t\t\t\t//Tell controls that use number inputs to position the popup\n\t\t\t\t\t\t\t//slider within the customizer sidebar.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t(data.component === 'ame-number-input')\n\t\t\t\t\t\t\t\t|| (data.component === 'ame-box-dimensions')\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tdata.params = data.params || {};\n\t\t\t\t\t\t\t\tdata.params.popupSliderWithin = '#ame-ac-sidebar-content';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//Replace regular separators with AC-specific ones.\n\t\t\t\t\t\t\tif (data.component === 'ame-horizontal-separator') {\n\t\t\t\t\t\t\t\tdata.component = 'ame-ac-separator';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t//Remove the reload parameter from the URL. It is only used to avoid\n\t\t\t//caching issues, and is not needed otherwise.\n\t\t\tconst currentUrl = new URL(window.location.href);\n\t\t\tif (currentUrl.searchParams.get('_ame-ac-reload') !== null) {\n\t\t\t\tcurrentUrl.searchParams.delete('_ame-ac-reload');\n\t\t\t\twindow.history.replaceState({}, '', currentUrl.href);\n\t\t\t}\n\n\t\t\t//Also remove the \"request new changeset\" parameter.\n\t\t\tif (currentUrl.searchParams.get('_ame-ac-new-changeset') !== null) {\n\t\t\t\tcurrentUrl.searchParams.delete('_ame-ac-new-changeset');\n\t\t\t\twindow.history.replaceState({}, '', currentUrl.href);\n\t\t\t}\n\n\t\t\tconst changesetPathTemplate: string | null = scriptData.changesetPathTemplate;\n\t\t\tconst changesetPlaceholder = '{changeset}';\n\n\t\t\tfunction addChangesetToUrl(currentUrl: string, changesetName: string): URL {\n\t\t\t\tconst url = new URL(currentUrl);\n\t\t\t\tif (changesetPathTemplate) {\n\t\t\t\t\turl.pathname = changesetPathTemplate.replace(changesetPlaceholder, changesetName);\n\t\t\t\t\t//With a custom path, the \"page\" parameter that points to the AC\n\t\t\t\t\t//admin page is not necessary and would be confusing.\n\t\t\t\t\turl.searchParams.delete('page');\n\t\t\t\t\t//When the changeset name is stored in the path, the \"ame-ac-changeset\"\n\t\t\t\t\t//parameter is no longer needed, and could be out of sync with the path.\n\t\t\t\t\turl.searchParams.delete('ame-ac-changeset');\n\t\t\t\t} else {\n\t\t\t\t\turl.searchParams.set('ame-ac-changeset', changesetName);\n\t\t\t\t}\n\t\t\t\treturn url;\n\t\t\t}\n\n\t\t\tfunction getChangesetFromUrl(url: string): string {\n\t\t\t\tconst parsedUrl = new URL(url);\n\t\t\t\tif (changesetPathTemplate) {\n\t\t\t\t\tfunction escapeRegExp(input: string): string {\n\t\t\t\t\t\treturn input.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\t\t\t\t\t}\n\n\t\t\t\t\tconst placeholderStart = changesetPathTemplate.indexOf(changesetPlaceholder);\n\t\t\t\t\tconst placeholderEnd = placeholderStart + changesetPlaceholder.length;\n\n\t\t\t\t\tconst changesetPathTemplateRegex = new RegExp(\n\t\t\t\t\t\t'^' + escapeRegExp(changesetPathTemplate.slice(0, placeholderStart))\n\t\t\t\t\t\t+ '([^a-zA-Z0-9]+)'\n\t\t\t\t\t\t+ escapeRegExp(changesetPathTemplate.slice(placeholderEnd))\n\t\t\t\t\t);\n\n\t\t\t\t\tconst match = parsedUrl.pathname.match(changesetPathTemplateRegex);\n\t\t\t\t\treturn match ? match[1] : '';\n\t\t\t\t} else {\n\t\t\t\t\treturn parsedUrl.searchParams.get('ame-ac-changeset') ?? '';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//Add the changeset name to the URL (if not already present).\n\t\t\tif (getChangesetFromUrl(window.location.href) !== this.settings.changesetName()) {\n\t\t\t\tconst newUrl = addChangesetToUrl(window.location.href, this.settings.changesetName());\n\t\t\t\twindow.history.replaceState({}, '', newUrl.href);\n\t\t\t}\n\n\t\t\t//When the changeset name changes, also change the URL.\n\t\t\tthis.settings.changesetName.subscribe((changesetName) => {\n\t\t\t\tconst url = addChangesetToUrl(window.location.href, changesetName);\n\t\t\t\tif (scriptData.changesetPushStateEnabled) {\n\t\t\t\t\twindow.history.pushState({}, '', url.href);\n\t\t\t\t} else {\n\t\t\t\t\twindow.history.replaceState({}, '', url.href);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.$saveButton = $('#ame-ac-apply-changes');\n\n\t\t\t//The save button should be enabled when:\n\t\t\t// - There are non-zero changes in the current changeset.\n\t\t\t// - All settings are valid.\n\t\t\t// - The changeset is not in the process of being published, deleted, etc.\n\t\t\t// - The contents of the changeset can be modified (e.g. not already published).\n\t\t\tconst isSaveButtonEnabled = ko.pureComputed(() => {\n\t\t\t\tconst changeset = this.settings.getCurrentChangeset();\n\t\t\t\treturn (\n\t\t\t\t\tchangeset.isNonEmpty()\n\t\t\t\t\t&& changeset.canBeModified()\n\t\t\t\t\t&& !this.settings.isExclusiveOperationInProgress()\n\t\t\t\t\t&& !this.settings.hasValidationErrors()\n\t\t\t\t);\n\t\t\t});\n\t\t\t//Update button state when the customizer loads.\n\t\t\tthis.$saveButton.prop('disabled', !isSaveButtonEnabled());\n\t\t\t//And also on changes.\n\t\t\tisSaveButtonEnabled.subscribe((isEnabled) => {\n\t\t\t\tthis.$saveButton.prop('disabled', !isEnabled);\n\t\t\t\t//Change the text back to the default when the button is enabled.\n\t\t\t\tif (isEnabled) {\n\t\t\t\t\tthis.$saveButton.val(this.$saveButton.data('default-text') ?? 'Save Changes');\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t//Handle the \"Save Changes\" button.\n\t\t\tthis.$saveButton.on('click', () => {\n\t\t\t\t//Show the spinner.\n\t\t\t\tconst $spinner = $('#ame-ac-primary-actions .spinner');\n\t\t\t\t$spinner.css('visibility', 'visible').show();\n\n\t\t\t\tconst publishFailNoticeId = 'ame-ac-publish-failed-notice';\n\t\t\t\t//Remove the previous error notification, if any.\n\t\t\t\t$('#' + publishFailNoticeId).remove();\n\n\t\t\t\tconst promise = this.settings.publishChangeset();\n\n\t\t\t\tpromise.fail((error) => {\n\t\t\t\t\t//Show a dismissible error notification.\n\t\t\t\t\tlet message = 'An unexpected error occurred while saving changes.';\n\t\t\t\t\tif (typeof error === 'string') {\n\t\t\t\t\t\tmessage = error;\n\t\t\t\t\t} else if (error instanceof Error) {\n\t\t\t\t\t\tmessage = error.message;\n\t\t\t\t\t} else if (typeof error.responseJSON === 'object') {\n\t\t\t\t\t\tmessage = _.get(error.responseJSON, ['data', 'message'], message);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst $notice = $('<div>')\n\t\t\t\t\t\t.attr('id', publishFailNoticeId)\n\t\t\t\t\t\t.addClass('notice notice-error is-dismissible')\n\t\t\t\t\t\t.text(message);\n\n\t\t\t\t\t//WordPress won't automatically add the dismiss button to a dynamically\n\t\t\t\t\t//generated notice like this, so we have to do it.\n\t\t\t\t\t$notice.append(\n\t\t\t\t\t\t$('<button type=\"button\" class=\"notice-dismiss\"></button>')\n\t\t\t\t\t\t\t.append('<span class=\"screen-reader-text\">Dismiss this notice</span>')\n\t\t\t\t\t\t\t.on('click', (event) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t$notice.remove(); //Not as fancy as WP does it.\n\t\t\t\t\t\t\t})\n\t\t\t\t\t);\n\n\t\t\t\t\tconst $container = $('#ame-ac-global-notification-area');\n\t\t\t\t\t$container.append($notice);\n\t\t\t\t})\n\n\t\t\t\tpromise.done(() => {\n\t\t\t\t\tthis.$saveButton.val(this.$saveButton.data('published-text') ?? 'Saved');\n\n\t\t\t\t\t//The preview could be stale. For example, the color scheme module\n\t\t\t\t\t//switches between \"actual\" and \"preview\" color schemes dynamically,\n\t\t\t\t\t//but the \"actual\" scheme could change after applying new settings.\n\t\t\t\t\t//Let's reload the preview frame to make sure it's up-to-date.\n\t\t\t\t\tthis.queuePreviewFrameReload();\n\t\t\t\t});\n\n\t\t\t\tpromise.always(() => {\n\t\t\t\t\t$spinner.css('visibility', 'hidden');\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t//Prevent the user from interacting with settings while the changeset is being modified.\n\t\t\tthis.settings.isExclusiveOperationInProgress.subscribe((isInProgress) => {\n\t\t\t\t$('#ame-ac-sidebar-blocker-overlay').toggle(isInProgress);\n\t\t\t});\n\n\t\t\t//Show a general overlay with a progress spinner while something is happening.\n\t\t\tthis.isGeneralOverlayVisible = ko.pureComputed(() => {\n\t\t\t\treturn this.isImporting() || this.isDiscardingChanges();\n\t\t\t});\n\n\t\t\t//Initialize the \"download admin theme\" dialog.\n\t\t\tthis.downloadThemeDialog = new DownloadThemeDialog(\n\t\t\t\t() => this.settings.getCurrentChangeset().name(),\n\t\t\t\t() => this.settings.savePendingSettings(),\n\t\t\t\tthis.settings.adminThemeMetadata,\n\t\t\t\tscriptData\n\t\t\t);\n\n\t\t\t//Toggle available extra actions based on changeset status.\n\t\t\tthis.importActionEnabled = ko.pureComputed(() => {\n\t\t\t\tconst changeset = this.settings.getCurrentChangeset();\n\t\t\t\treturn changeset && changeset.canBeModified()\n\t\t\t\t\t&& !this.settings.isExclusiveOperationInProgress();\n\t\t\t});\n\t\t\tthis.importActionEnabled.subscribe((isEnabled) => {\n\t\t\t\tif (this.$extraActionMenu) {\n\t\t\t\t\tthis.$extraActionMenu.find('.ame-ac-import-theme-action')\n\t\t\t\t\t\t.toggleClass('ui-state-disabled', !isEnabled);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.discardChangesActionEnabled = ko.pureComputed(() => {\n\t\t\t\tconst changeset = this.settings.getCurrentChangeset();\n\t\t\t\treturn changeset && changeset.isNonEmpty() && changeset.canBeModified()\n\t\t\t\t\t&& !this.settings.isExclusiveOperationInProgress()\n\t\t\t});\n\t\t\tthis.discardChangesActionEnabled.subscribe((isEnabled) => {\n\t\t\t\tif (this.$extraActionMenu) {\n\t\t\t\t\tthis.$extraActionMenu.find('.ame-ac-discard-changes-action')\n\t\t\t\t\t\t.toggleClass('ui-state-disabled', !isEnabled);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.downloadThemeActionEnabled = ko.pureComputed(() => {\n\t\t\t\treturn (\n\t\t\t\t\t!this.settings.isExclusiveOperationInProgress()\n\t\t\t\t\t&& !this.downloadThemeDialog.isOperationInProgress()\n\t\t\t\t\t//The changeset must already be saved for the download to work,\n\t\t\t\t\t//which means it should have a name.\n\t\t\t\t\t&& (this.settings.getCurrentChangeset().name() !== '')\n\t\t\t\t\t&& (\n\t\t\t\t\t\t//Optionally, the download can be restricted to non-empty changesets.\n\t\t\t\t\t\t!this.downloadOnlyIfChangesetIsNonEmpty\n\t\t\t\t\t\t|| this.settings.getCurrentChangeset().isNonEmpty()\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t});\n\t\t\tthis.downloadThemeActionEnabled.subscribe((isEnabled) => {\n\t\t\t\tif (this.$extraActionMenu) {\n\t\t\t\t\tthis.$extraActionMenu.find('.ame-ac-download-theme-action')\n\t\t\t\t\t\t.toggleClass('ui-state-disabled', !isEnabled);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.sectionNavigation = new SectionNavigation();\n\n\t\t\t//Set up the preview frame.\n\t\t\tthis.$previewFrame = $('iframe#ame-ac-preview');\n\n\t\t\tthis.initialPreviewUrl = scriptData.initialPreviewUrl;\n\t\t\tthis.refreshPreviewNonce = scriptData.refreshPreviewNonce;\n\n\t\t\tthis.$previewFrame.on('load', () => {\n\t\t\t\tthis.isFrameLoading = false;\n\n\t\t\t\t//The URL that was actually loaded might not match the one that\n\t\t\t\t//was requested (e.g. because there was a redirect).\n\t\t\t\tthis.currentPreviewUrl = null;\n\n\t\t\t\t//Close the previous postMessage connection.\n\t\t\t\tif (this.previewConnection) {\n\t\t\t\t\tthis.previewConnection.disconnect();\n\t\t\t\t\tthis.previewConnection = null;\n\t\t\t\t}\n\n\t\t\t\tconst frame = this.$previewFrame.get(0) as HTMLIFrameElement;\n\t\t\t\tif (!frame || !(frame instanceof HTMLIFrameElement)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t//Try to get the preview URL from the iframe.\n\t\t\t\ttry {\n\t\t\t\t\tconst url = frame.contentWindow?.location.href;\n\t\t\t\t\tif (url) {\n\t\t\t\t\t\tthis.currentPreviewUrl = url;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\t//We can't get the URL directly, probably because it's a cross-origin iframe.\n\t\t\t\t}\n\n\t\t\t\tthis.previewConnection = AmeAcCommunicator.connectToChild(\n\t\t\t\t\tframe,\n\t\t\t\t\t{\n\t\t\t\t\t\t'setPreviewUrl': (url: string) => {\n\t\t\t\t\t\t\tif (this.isPreviewableUrl(url)) {\n\t\t\t\t\t\t\t\tthis.previewUrl = url;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'notifyPreviewUrlChanged': (url: string) => {\n\t\t\t\t\t\t\tthis.currentPreviewUrl = url;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tthis.allowedCommOrigins,\n\t\t\t\t\tscriptData.isWpDebugEnabled\n\t\t\t\t);\n\n\t\t\t\tthis.previewConnection.promise.then((connection) => {\n\t\t\t\t\tif (typeof connection === 'undefined') {\n\t\t\t\t\t\t//This should never happen, but the type checker doesn't know that.\n\t\t\t\t\t\tthrow new Error('Unexpected error: Connection apparently succeeded, but the connection object is undefined');\n\t\t\t\t\t}\n\n\t\t\t\t\tconnection.execute('getCurrentUrl').then((url) => {\n\t\t\t\t\t\tif (url && (typeof url === 'string')) {\n\t\t\t\t\t\t\tthis.currentPreviewUrl = url;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\t//Notify other scripts that the preview frame is loaded and\n\t\t\t\t\t//the postMessage connection is ready for use.\n\t\t\t\t\t$('body').trigger('adminMenuEditor:acPreviewConnectionReady');\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tthis.previewUrl = this.initialPreviewUrl;\n\n\t\t\t//Notify other scripts. This lets them register custom controls and so on.\n\t\t\t$('#ame-ac-admin-customizer').trigger('adminMenuEditor:acRegister', [this]);\n\n\t\t\tconst throttledReloadPreview = _.throttle(\n\t\t\t\t() => {\n\t\t\t\t\tthis.queuePreviewFrameReload();\n\t\t\t\t},\n\t\t\t\t1000, //The reload method does its own throttling, so we use a low wait time here.\n\t\t\t\t{leading: true, trailing: true}\n\t\t\t);\n\n\t\t\t//Refresh the preview when any setting changes.\n\t\t\tthis.settings.addChangeListener((setting, newValue) => {\n\t\t\t\tif (\n\t\t\t\t\tsetting.supportsPostMessage\n\t\t\t\t\t&& this.previewConnection\n\t\t\t\t\t&& this.previewConnection.isConnected\n\t\t\t\t) {\n\t\t\t\t\tthis.previewConnection.execute('previewSetting', setting.id, newValue);\n\t\t\t\t} else {\n\t\t\t\t\tlet reason: string = 'Unknown';\n\t\t\t\t\tif (!setting.supportsPostMessage) {\n\t\t\t\t\t\treason = 'Setting \"' + setting.id + '\" does not support postMessage';\n\t\t\t\t\t} else if (!this.previewConnection) {\n\t\t\t\t\t\treason = 'No preview connection';\n\t\t\t\t\t} else if (!this.previewConnection.isConnected) {\n\t\t\t\t\t\treason = 'Preview connection is not connected';\n\t\t\t\t\t}\n\t\t\t\t\tthis.log('Reloading the preview frame because: ' + reason);\n\n\t\t\t\t\tthrottledReloadPreview();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst registerUnloadPrompt = () => {\n\t\t\t\t//Ask for confirmation when the user tries to leave the page and the changeset\n\t\t\t\t//has unpublished/unsaved changes.\n\t\t\t\t$(window).on('beforeunload.ame-ac-exit-confirm', (event) => {\n\t\t\t\t\tif (this.isExitPromptNeeded()) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t//Note: The confirmation prompt will only be displayed if the user\n\t\t\t\t\t\t//has interacted with the page (e.g. clicked something).\n\n\t\t\t\t\t\t//As of this writing, MDN says that some browsers still don't support triggering\n\t\t\t\t\t\t//an \"unsaved changes\" prompt with event.preventDefault(). You need to set\n\t\t\t\t\t\t//event.returnValue to a string or return a string from the event handler.\n\t\t\t\t\t\t//Modern browsers will ignore the content and display their own generic message.\n\t\t\t\t\t\treturn this.exitPromptMessage;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/*\n\t\t\t Allegedly, registering a beforeunload handler can cause the browser to\n\t\t\t disable some optimizations, so let's only do it when the user changes\n\t\t\t something or the changeset already contains some changes.\n\t\t\t */\n\t\t\tif (this.settings.getCurrentChangeset().isNonEmpty()) {\n\t\t\t\tregisterUnloadPrompt();\n\t\t\t} else {\n\t\t\t\tconst listenerId = this.settings.addChangeListener(() => {\n\t\t\t\t\t//Remove the listener after it has been triggered once.\n\t\t\t\t\tthis.settings.removeChangeListener(listenerId);\n\t\t\t\t\tregisterUnloadPrompt();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tgetSettingObservable(settingId: string, defaultValue: any): KnockoutObservable<any> {\n\t\t\t//Let's just implement this temporarily while working on refactoring this\n\t\t\t//stuff to use KO components.\n\t\t\treturn this.settings\n\t\t\t\t.get(settingId)\n\t\t\t\t.map(setting => setting.value)\n\t\t\t\t.getOrElse(ko.observable(defaultValue));\n\t\t}\n\n\t\tgetAllSettingValues(): Record<string, any> {\n\t\t\tthrow new Error('Method not implemented.');\n\t\t}\n\n\t\tget previewUrl(): string | null {\n\t\t\treturn this.currentPreviewUrl;\n\t\t}\n\n\t\tset previewUrl(url: string | null) {\n\t\t\tif (url === this.currentPreviewUrl) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t//The URL starts out as null, but it cannot be set to NULL again after\n\t\t\t//the preview frame has been loaded.\n\t\t\tif (url === null) {\n\t\t\t\tthrow new Error('Cannot directly set preview URL to null');\n\t\t\t}\n\n\t\t\tif (this.isPreviewableUrl(url)) {\n\t\t\t\tthis.navigatePreviewFrame(url);\n\t\t\t}\n\t\t}\n\n\t\tprivate navigatePreviewFrame(url: string | null = null, forceReload: boolean = false) {\n\t\t\tconst oldUrl = this.previewUrl;\n\t\t\tif (url === null) {\n\t\t\t\turl = oldUrl ?? this.initialPreviewUrl;\n\t\t\t}\n\n\t\t\tconst isSameUrl = (oldUrl === url);\n\t\t\tif (isSameUrl && !forceReload) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//If there are any unsaved changes, let's include them in the preview by simulating\n\t\t\t//a form submission and sending the changes as form data. The server-side component\n\t\t\t//will merge these changes with existing changeset data.\n\t\t\tconst unsavedChanges = this.settings.unsavedChanges;\n\t\t\tconst simulateFormSubmission = !_.isEmpty(unsavedChanges);\n\n\t\t\tconst parsedUrl = new URL(url);\n\n\t\t\t//If we're not using form submission, add a special parameter\n\t\t\t//to the URL to force a refresh.\n\t\t\tconst refreshParam = '_ame-ac-refresh-trigger';\n\t\t\tif (isSameUrl && !simulateFormSubmission) {\n\t\t\t\tparsedUrl.searchParams.set(refreshParam, Date.now() + '_' + Math.random());\n\t\t\t} else {\n\t\t\t\t//Otherwise, remove the parameter just to be safe.\n\t\t\t\tparsedUrl.searchParams.delete(refreshParam);\n\t\t\t}\n\n\t\t\t//Ensure that the changeset used in the preview matches the current\n\t\t\t//changeset and preview is enabled. This is just a precaution. Normally,\n\t\t\t//the preview script automatically changes link URLs.\n\t\t\tlet changesetName = this.settings.changesetName();\n\t\t\tif (changesetName === '') {\n\t\t\t\t//Use a special value if the changeset hasn't been saved yet.\n\t\t\t\tchangesetName = TemporaryChangesetName;\n\t\t\t}\n\t\t\tparsedUrl.searchParams.set('ame-ac-changeset', changesetName);\n\t\t\tparsedUrl.searchParams.set('ame-ac-preview', '1');\n\n\t\t\tthis.hasPendingPreviewReload = false; //Reloading now, so no longer pending.\n\t\t\tthis.isFrameLoading = true;\n\n\t\t\t//console.info('navigatePreviewFrame: Navigating to ' + parsedUrl.href);\n\t\t\tif (simulateFormSubmission) {\n\t\t\t\tconst formData = {\n\t\t\t\t\taction: 'ws_ame_ac_refresh_preview_frame',\n\t\t\t\t\t\"ame-ac-changeset\": changesetName,\n\t\t\t\t\tmodified: JSON.stringify(unsavedChanges),\n\t\t\t\t\tnonce: this.refreshPreviewNonce\n\t\t\t\t}\n\n\t\t\t\tconst $form = $('<form>')\n\t\t\t\t\t.attr('method', 'post')\n\t\t\t\t\t.attr('action', parsedUrl.href)\n\t\t\t\t\t.attr('target', 'ame-ac-preview-frame')\n\t\t\t\t\t.appendTo('body');\n\n\t\t\t\tlet key: keyof typeof formData;\n\t\t\t\tfor (key in formData) {\n\t\t\t\t\tconst value = formData[key];\n\t\t\t\t\t$('<input>')\n\t\t\t\t\t\t.attr('type', 'hidden')\n\t\t\t\t\t\t.attr('name', key)\n\t\t\t\t\t\t.val(value)\n\t\t\t\t\t\t.appendTo($form);\n\t\t\t\t}\n\n\t\t\t\tthis.currentPreviewUrl = parsedUrl.href;\n\t\t\t\t$form.trigger('submit');\n\t\t\t\t$form.remove();\n\t\t\t} else {\n\t\t\t\tthis.currentPreviewUrl = parsedUrl.href;\n\t\t\t\tthis.$previewFrame.attr('src', this.currentPreviewUrl);\n\t\t\t}\n\t\t}\n\n\t\tprivate _isFrameLoading: boolean = false;\n\t\tprivate frameLoadingTimeoutId: number | null = null;\n\t\tprivate lastPreviewLoadTimestamp: Date = new Date(0);\n\n\t\tprivate reloadWaitTimeoutId: number | null = null;\n\t\tprivate hasPendingPreviewReload: boolean = false;\n\n\t\tprivate set isFrameLoading(isLoading: boolean) {\n\t\t\tconst wasLoadingBefore = this._isFrameLoading;\n\t\t\tif (!isLoading && (isLoading === wasLoadingBefore)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t//In some circumstances, we may start to load a new URL before\n\t\t\t//the previous one has finished loading. This is valid and should\n\t\t\t//reset the load timeout.\n\n\t\t\t$('#ame-ac-preview-refresh-indicator').toggleClass('ame-ac-show-indicator', isLoading);\n\t\t\tif (this.frameLoadingTimeoutId) {\n\t\t\t\tclearTimeout(this.frameLoadingTimeoutId);\n\t\t\t\tthis.frameLoadingTimeoutId = null;\n\t\t\t}\n\n\t\t\tif (isLoading) {\n\t\t\t\t//As a precaution, we'll assume that if the frame doesn't load in a reasonable\n\t\t\t\t//time, it will never finish loading.\n\t\t\t\tthis.frameLoadingTimeoutId = window.setTimeout(() => {\n\t\t\t\t\tif (this.isFrameLoading) {\n\t\t\t\t\t\tthis.isFrameLoading = false;\n\t\t\t\t\t}\n\t\t\t\t}, 20000);\n\t\t\t}\n\t\t\tthis._isFrameLoading = isLoading;\n\n\t\t\tif (wasLoadingBefore && !isLoading) {\n\t\t\t\tthis.lastPreviewLoadTimestamp = new Date();\n\t\t\t}\n\n\t\t\t//Once the frame is loaded, trigger any pending reload.\n\t\t\tif (!isLoading && this.hasPendingPreviewReload) {\n\t\t\t\tthis.hasPendingPreviewReload = false;\n\t\t\t\tthis.queuePreviewFrameReload();\n\t\t\t}\n\t\t}\n\n\t\tpublic get isFrameLoading(): boolean {\n\t\t\treturn this._isFrameLoading;\n\t\t}\n\n\t\tprivate queuePreviewFrameReload() {\n\t\t\tif (this.reloadWaitTimeoutId) {\n\t\t\t\treturn; //The frame will reload soon.\n\t\t\t}\n\n\t\t\tif (this.isFrameLoading) {\n\t\t\t\tthis.hasPendingPreviewReload = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//To avoid stressing the server, wait at least X ms after the last\n\t\t\t//load completes before reloading the frame.\n\t\t\tconst reloadWaitTime = 2000;\n\t\t\tconst now = new Date();\n\t\t\tconst timeSinceLastLoad = now.getTime() - this.lastPreviewLoadTimestamp.getTime();\n\t\t\tif (timeSinceLastLoad < reloadWaitTime) {\n\t\t\t\tthis.reloadWaitTimeoutId = window.setTimeout(() => {\n\t\t\t\t\tthis.reloadWaitTimeoutId = null;\n\t\t\t\t\tthis.queuePreviewFrameReload();\n\t\t\t\t}, reloadWaitTime - timeSinceLastLoad);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//Actually reload the frame.\n\t\t\tthis.navigatePreviewFrame(null, true);\n\t\t}\n\n\t\tonBindingsApplied(rootElement: HTMLElement) {\n\t\t\t//Navigate to the root section. In the current implementation this can't happen\n\t\t\t//until bindings have been applied, so it's not part of the constructor.\n\t\t\tthis.navigateToRootSection();\n\n\t\t\t//Initialize the action menu.\n\t\t\tthis.$extraActionButton = jQuery('#ame-ac-extra-actions-trigger', rootElement);\n\t\t\tthis.$extraActionMenu = jQuery('#ame-ac-extra-actions-menu', rootElement).menu();\n\n\t\t\t//Update menu states.\n\t\t\tthis.importActionEnabled.notifySubscribers(this.importActionEnabled());\n\t\t\tthis.discardChangesActionEnabled.notifySubscribers(this.discardChangesActionEnabled());\n\t\t\tthis.downloadThemeActionEnabled.notifySubscribers(this.downloadThemeActionEnabled());\n\n\t\t\t//Get the file picker.\n\t\t\tthis.$importFileInput = jQuery('#ame-ac-import-admin-theme-file', rootElement);\n\t\t}\n\n\t\tnavigateToRootSection() {\n\t\t\tthis.sectionNavigation.navigateToSection('ame-ac-section-structure-root');\n\t\t}\n\n\t\t// noinspection JSUnusedGlobalSymbols -- Used in at least one add-on.\n\t\t/**\n\t\t * Execute an RPC method in the preview frame.\n\t\t *\n\t\t * @param {string} methodName\n\t\t * @param {*} args\n\t\t */\n\t\texecuteRpcMethod(methodName: string, ...args: any): JQueryPromise<any> {\n\t\t\tif (!this.previewConnection || !this.previewConnection.isConnected) {\n\t\t\t\treturn $.Deferred().reject('The preview frame is not connected.').promise();\n\t\t\t}\n\t\t\treturn this.previewConnection.execute(methodName, ...args);\n\t\t}\n\n\t\tconfirmExit() {\n\t\t\tif (this.isExitPromptNeeded()) {\n\t\t\t\tif (window.confirm(this.exitPromptMessage)) {\n\t\t\t\t\t//Remove the confirmation prompt that appears when leaving the page.\n\t\t\t\t\t//We don't want to show two prompts.\n\t\t\t\t\t$(window).off('beforeunload.ame-ac-exit-confirm');\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate isExitPromptNeeded(): boolean {\n\t\t\tconst changeset = this.settings.getCurrentChangeset();\n\n\t\t\t//No need to save anything if the changeset is empty.\n\t\t\tif (!changeset.isNonEmpty()) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tswitch (this.exitPromptMode) {\n\t\t\t\tcase ExitPromptMode.UnpublishedChanges:\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!changeset.wasPublished()\n\t\t\t\t\t\t&& (changeset.status() !== 'trash') //Can't publish a trashed changeset.\n\t\t\t\t\t);\n\t\t\t\tcase ExitPromptMode.UnsavedChanges:\n\t\t\t\t\tconst unsavedChanges = this.settings.unsavedChanges;\n\t\t\t\t\treturn !_.isEmpty(unsavedChanges);\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\n\t\t// noinspection JSUnusedGlobalSymbols -- Used in the Knockout template.\n\t\ttoggleExtraActionMenu() {\n\t\t\tif (!this.$extraActionMenu) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.$extraActionMenu.toggle();\n\n\t\t\tif (this.$extraActionMenu.is(':visible')) {\n\t\t\t\t//Position the menu below the button.\n\t\t\t\tconst $button = $('#ame-ac-extra-actions-trigger');\n\t\t\t\tthis.$extraActionMenu.position({\n\t\t\t\t\tmy: 'right top',\n\t\t\t\t\tat: 'right bottom',\n\t\t\t\t\tof: $button,\n\t\t\t\t\tcollision: 'flipfit'\n\t\t\t\t});\n\n\t\t\t\t//Hide the menu when the user clicks outside the menu or the button.\n\t\t\t\t$(document).on('mousedown.ameAcExtraMenuHide', this.handleClickOutsideActionMenu.bind(this));\n\t\t\t} else {\n\t\t\t\t//Remove the click listener if it's still active.\n\t\t\t\t$(document).off('mousedown.ameAcExtraMenuHide');\n\t\t\t}\n\t\t}\n\n\t\thandleClickOutsideActionMenu(event: JQueryEventObject) {\n\t\t\tif (\n\t\t\t\t!this.$extraActionMenu\n\t\t\t\t|| !this.$extraActionMenu.is(':visible')\n\t\t\t\t|| !this.$extraActionButton\n\t\t\t) {\n\t\t\t\t//The event listener should not be active if the menu is not visible.\n\t\t\t\t$(document).off('mousedown.ameAcExtraMenuHide');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuElement = this.$extraActionMenu.get(0);\n\t\t\tconst buttonElement = this.$extraActionButton.get(0);\n\t\t\tconst isClickOutsideMenu = !menuElement.contains(event.target);\n\t\t\tconst isClickOutsideButton = !buttonElement.contains(event.target);\n\n\t\t\tif (isClickOutsideMenu && isClickOutsideButton) {\n\t\t\t\tthis.hideExtraActionMenu();\n\t\t\t}\n\t\t}\n\n\t\tprivate hideExtraActionMenu() {\n\t\t\tif (!this.$extraActionMenu) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.$extraActionMenu.hide();\n\t\t\t//Stop listening for clicks outside the menu.\n\t\t\t$(document).off('mousedown.ameAcExtraMenuHide');\n\t\t}\n\n\t\tprivate openMetadataDialog(mode: MetadataDialogMode) {\n\t\t\tthis.downloadThemeDialog.mode(mode);\n\t\t\tthis.downloadThemeDialog.isOpen(true);\n\t\t\tthis.isImportReportVisible(false);\n\t\t\tthis.hideExtraActionMenu();\n\t\t}\n\n\t\tactionOpenDownloadDialog() {\n\t\t\tif (!this.downloadThemeActionEnabled()) {\n\t\t\t\talert('Currently disabled because there are no changes to download.');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.openMetadataDialog(MetadataDialogMode.Download);\n\t\t}\n\n\t\t// noinspection JSUnusedGlobalSymbols -- Used in another plugin.\n\t\tactionEditOrDownloadTheme() {\n\t\t\tif (!this.downloadThemeActionEnabled()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//If the user hasn't confirmed the theme metadata yet, show the dialog.\n\t\t\tconst metadata = this.settings.adminThemeMetadata();\n\t\t\tif ((metadata === null) || !metadata.wasEverConfirmed) {\n\t\t\t\tthis.openMetadataDialog(MetadataDialogMode.Download);\n\t\t\t} else {\n\t\t\t\tthis.downloadThemeDialog.triggerDownloadWithErrorReporting(metadata);\n\t\t\t}\n\t\t}\n\n\t\t// noinspection JSUnusedGlobalSymbols -- Used in another plugin.\n\t\tactionOpenMetadataDialog() {\n\t\t\tthis.openMetadataDialog(MetadataDialogMode.Edit);\n\t\t}\n\n\t\tactionOpenImportDialog() {\n\t\t\tif (!this.importActionEnabled()) {\n\t\t\t\t//Can't import if there is no changeset or the changeset can't be edited.\n\t\t\t\t//The menu item should be disabled in this case, but we'll check anyway.\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.hideExtraActionMenu();\n\n\t\t\t//Allow the default action to proceed, which will open the file picker.\n\t\t\treturn true;\n\t\t}\n\n\t\tactionDiscardChanges() {\n\t\t\tif (!this.discardChangesActionEnabled()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.hideExtraActionMenu();\n\n\t\t\tif (this.settings.isExclusiveOperationInProgress()) {\n\t\t\t\talert('Another operation is in progress. Please wait for it to complete before discarding changes.');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!confirm('Are you sure you want to discard your unsaved changes?')) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.isImportReportVisible(false);\n\t\t\tthis.isDiscardingChanges(true);\n\n\t\t\tthis.settings.trashChangeset()\n\t\t\t\t.then(() => {\n\t\t\t\t\t//Reload the customizer with a new changeset.\n\t\t\t\t\tconst url = new URL(window.location.href);\n\t\t\t\t\tif (this.customBasePath) {\n\t\t\t\t\t\turl.pathname = this.customBasePath;\n\t\t\t\t\t\turl.search = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//To get the customizer's base URL, get the current URL\n\t\t\t\t\t\t//and remove all query parameters except \"page\".\n\t\t\t\t\t\tconst page = url.searchParams.get('page');\n\t\t\t\t\t\turl.search = '';\n\t\t\t\t\t\turl.searchParams.set('page', page || 'ame-admin-customizer');\n\t\t\t\t\t}\n\t\t\t\t\t//Notify the customizer that we definitely want a new changeset;\n\t\t\t\t\t//don't try to load a draft.\n\t\t\t\t\turl.searchParams.set('_ame-ac-new-changeset', '1');\n\n\t\t\t\t\t//Don't need the hash.\n\t\t\t\t\turl.hash = '';\n\n\t\t\t\t\t//Add a random parameter to force a reload.\n\t\t\t\t\turl.searchParams.set('_ame-ac-reload', Math.random().toString(36).substring(7));\n\n\t\t\t\t\t//Navigate to the new URL.\n\t\t\t\t\twindow.location.href = url.toString();\n\n\t\t\t\t\t//Note that the isDiscardingChanges flag is not reset here,\n\t\t\t\t\t//so the progress overlay will stay visible until the page reloads.\n\t\t\t\t})\n\t\t\t\t.fail((requestObject) => {\n\t\t\t\t\tlet message: string = requestObject.statusText || 'Unknown error.';\n\n\t\t\t\t\tif (typeof requestObject.responseJSON === 'object') {\n\t\t\t\t\t\tconst customMessage = _.get(requestObject.responseJSON, ['data', 'message']);\n\t\t\t\t\t\tif (typeof customMessage === 'string') {\n\t\t\t\t\t\t\tmessage = customMessage;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\talert('Error: ' + message);\n\t\t\t\t\tthis.isDiscardingChanges(false);\n\t\t\t\t});\n\t\t}\n\n\t\thandleImportFileSelection() {\n\t\t\tif (!this.$importFileInput) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst fileInput = this.$importFileInput.get(0) as HTMLInputElement;\n\t\t\tif (!fileInput || !fileInput.files || (fileInput.files.length < 1)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//Get the first file. Normally, there should only be one.\n\t\t\tconst selectedFile = fileInput.files.item(0);\n\t\t\tif (!selectedFile) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//Limit the file size.\n\t\t\tif (selectedFile.size > this.maxImportFileSize) {\n\t\t\t\talert(\n\t\t\t\t\t'Error: The selected file is too large. The maximum file size is '\n\t\t\t\t\t+ Math.round(this.maxImportFileSize / 1024) + ' KiB'\n\t\t\t\t);\n\t\t\t\t//Clear the file input.\n\t\t\t\tthis.$importFileInput.val('');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.isImporting(true);\n\t\t\tthis.lastImportReport(null);\n\n\t\t\tJSZip.loadAsync(selectedFile).then(\n\t\t\t\t(zip) => {\n\t\t\t\t\tconst metadataFileRegex = /^([\\\\/]?[a-zA-Z0-9_-]+[\\\\/])metadata\\.json$/;\n\t\t\t\t\tconst foundMetadataFiles = zip.file(metadataFileRegex);\n\t\t\t\t\tif (!foundMetadataFiles || (foundMetadataFiles.length < 1)) {\n\t\t\t\t\t\tthrow new Error('The selected file is not an admin theme generated by this tool.');\n\t\t\t\t\t}\n\t\t\t\t\tconst metadataFile = foundMetadataFiles[0];\n\n\t\t\t\t\t//Get the directory name and separator from the metadata file path.\n\t\t\t\t\t//The prefix will usually be something like \"admin-theme-slug/\".\n\t\t\t\t\tconst matches = metadataFileRegex.exec(metadataFile.name);\n\t\t\t\t\tlet directoryPrefix: string;\n\t\t\t\t\tif (!matches || (matches.length < 2)) {\n\t\t\t\t\t\tthrow new Error('The directory structure of this ZIP file is not recognized.');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdirectoryPrefix = matches[1];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst settingsFile = zip.file(directoryPrefix + 'settings.json');\n\t\t\t\t\tif (!settingsFile) {\n\t\t\t\t\t\tthrow new Error('The selected ZIP file is missing a settings.json file.');\n\t\t\t\t\t}\n\n\t\t\t\t\t//Read both files.\n\t\t\t\t\treturn Promise.all([\n\t\t\t\t\t\tmetadataFile.async('string'),\n\t\t\t\t\t\tsettingsFile.async('string')\n\t\t\t\t\t]);\n\t\t\t\t},\n\t\t\t\t(error) => {\n\t\t\t\t\tconst errorMessage = error.message || error;\n\t\t\t\t\tthrow new Error('Error reading \"' + selectedFile.name + '\": ' + errorMessage);\n\t\t\t\t}\n\t\t\t).then((fileContents) => {\n\t\t\t\tif (!fileContents) {\n\t\t\t\t\tthrow new Error('Failed to read settings and metadata from the ZIP file.');\n\t\t\t\t}\n\n\t\t\t\tconst metadata = this.parseImportedAdminThemeFile(\n\t\t\t\t\tfileContents[0],\n\t\t\t\t\t'metadata.json',\n\t\t\t\t\tAdminThemeMetadata\n\t\t\t\t);\n\t\t\t\tconst settings = this.parseImportedAdminThemeFile(\n\t\t\t\t\tfileContents[1],\n\t\t\t\t\t'settings.json',\n\t\t\t\t\tAdminThemeSettings\n\t\t\t\t);\n\t\t\t\tconst report = new AdminThemeImportReport(selectedFile.name, metadata);\n\n\t\t\t\t//Import metadata.\n\t\t\t\tthis.downloadThemeDialog.meta(new ObservableThemeMetadata(metadata));\n\n\t\t\t\t//Import settings.\n\t\t\t\tfor (const [settingId, value] of Object.entries(settings)) {\n\t\t\t\t\treport.totalSettings++;\n\n\t\t\t\t\tconst foundSetting = this.settings.get(settingId);\n\t\t\t\t\tfoundSetting.forEach((setting) => {\n\t\t\t\t\t\tconst oldValue = setting.value();\n\t\t\t\t\t\tconst errors = setting.tryUpdate(value);\n\t\t\t\t\t\tif (errors && errors.length) {\n\t\t\t\t\t\t\treport.invalidSettings++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treport.importedSettings++;\n\t\t\t\t\t\t\tif (oldValue != value) {\n\t\t\t\t\t\t\t\treport.differentImportedSettings++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tif (foundSetting.isEmpty()) {\n\t\t\t\t\t\treport.skippedSettings++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.lastImportReport(report);\n\t\t\t\tthis.isImportReportVisible(true);\n\n\t\t\t}).catch((error) => {\n\t\t\t\t//Error handling: Show the error message to the user.\n\t\t\t\tlet errorMessage: string;\n\t\t\t\tif (error instanceof Error) {\n\t\t\t\t\terrorMessage = error.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = String(error);\n\t\t\t\t}\n\t\t\t\talert('Error: ' + errorMessage);\n\t\t\t}).finally(() => {\n\t\t\t\tthis.isImporting(false);\n\t\t\t\tthis.$importFileInput?.val('');\n\t\t\t});\n\t\t}\n\n\t\tprivate parseImportedAdminThemeFile<T extends ZodType>(\n\t\t\tcontent: string,\n\t\t\tname: string,\n\t\t\tschema: T\n\t\t): ReturnType<T['parse']> {\n\t\t\ttry {\n\t\t\t\tconst parsedJson = JSON.parse(content);\n\t\t\t\treturn schema.parse(parsedJson);\n\t\t\t} catch (error) {\n\t\t\t\tlet errorMessage: string;\n\t\t\t\tif (error instanceof ZodError) {\n\t\t\t\t\t//Convert issues to a newline-separated string.\n\t\t\t\t\terrorMessage = error.issues.map((issue) => {\n\t\t\t\t\t\treturn issue.path.join('.') + ': ' + issue.message;\n\t\t\t\t\t}).join('\\n');\n\t\t\t\t} else if (error instanceof Error) {\n\t\t\t\t\terrorMessage = error.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = String(error);\n\t\t\t\t}\n\t\t\t\t//Add the file name to the error message.\n\t\t\t\tthrow new Error('Error parsing ' + name + ':\\n' + errorMessage);\n\t\t\t}\n\t\t}\n\n\t\tdismissImportReport(): void {\n\t\t\tthis.isImportReportVisible(false);\n\t\t}\n\n\t\tlog(message: any): void {\n\t\t\tif (this.consoleLoggingEnabled && console && console.log) {\n\t\t\t\tconsole.log(message);\n\t\t\t}\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\twsAdminCustomizer: AmeAdminCustomizer.AdminCustomizer;\n\t}\n}\n\njQuery(function () {\n\t//Give other scripts a chance to load before we start.\n\t//Some of them also use jQuery to run when the DOM is ready.\n\tsetTimeout(() => {\n\t\twindow.wsAdminCustomizer = new AmeAdminCustomizer.AdminCustomizer(wsAmeAdminCustomizerData);\n\t\tconst rootElement = document.getElementById('ame-ac-admin-customizer');\n\t\tif (rootElement === null) {\n\t\t\tthrow new Error('The root element for the admin customizer was not found.');\n\t\t}\n\n\t\tko.applyBindings(window.wsAdminCustomizer, rootElement);\n\n\t\t//Notify the customizer that bindings have been applied. It needs to do some\n\t\t//additional setup that can't be done until the DOM structure is ready.\n\t\tsetTimeout(() => {\n\t\t\twindow.wsAdminCustomizer.onBindingsApplied(rootElement);\n\t\t}, 5); //Components are rendered asynchronously.\n\t}, 20);\n});","'use strict';\nexport var AmeAdminCustomizerBase;\n(function (AmeAdminCustomizerBase) {\n class AdminCustomizerBase {\n constructor(scriptData) {\n this.allowedCommOrigins = scriptData.allowedCommOrigins;\n if (this.allowedCommOrigins.length === 0) {\n this.allowedCommOrigins = [window.location.origin];\n }\n this.allowedPreviewUrls = scriptData.allowedPreviewUrls;\n this.parsedAllowedUrls = this.allowedPreviewUrls.map(url => new URL(url));\n }\n isPreviewableUrl(url) {\n if (typeof url === 'string') {\n url = new URL(url);\n }\n if (typeof url.protocol === 'undefined') {\n return false;\n }\n //Only HTTP(S) links are previewable.\n if ((url.protocol !== 'http:') && (url.protocol !== 'https:')) {\n return false;\n }\n //Check against the list of allowed URLs.\n for (const allowedUrl of this.parsedAllowedUrls) {\n //Protocol and host must match. The path must start with the path\n //of the allowed URL (possibly without a trailing slash).\n if ((url.protocol === allowedUrl.protocol) && (url.host === allowedUrl.host)) {\n const allowedPath = allowedUrl.pathname.replace(/\\/$/, '');\n if (url.pathname.indexOf(allowedPath) === 0) {\n return true;\n }\n }\n }\n return false;\n }\n }\n AmeAdminCustomizerBase.AdminCustomizerBase = AdminCustomizerBase;\n})(AmeAdminCustomizerBase || (AmeAdminCustomizerBase = {}));\n//# sourceMappingURL=admin-customizer-base.js.map","import { AmeAcSection } from './ame-ac-section.js';\nimport { createComponentConfig } from '../../../pro-customizables/ko-components/control-base.js';\nclass AmeAcContentSection extends AmeAcSection {\n constructor(params, $element) {\n super(params, $element);\n if ((typeof params.parentSectionLevel === 'function') && ko.isObservable(params.parentSectionLevel)) {\n this.parentSectionLevel = params.parentSectionLevel;\n }\n else {\n this.parentSectionLevel = null;\n }\n this.contentSectionLevel = ko.pureComputed(() => {\n let parentLevel = 0;\n if (this.parentSectionLevel !== null) {\n parentLevel = this.parentSectionLevel();\n }\n return parentLevel + 1;\n });\n //Tell child sections about our section level.\n this.childComponents().forEach((child) => {\n if (child.name === 'ame-ac-content-section') {\n child.params.parentSectionLevel = this.contentSectionLevel;\n }\n });\n this.sectionLevelClass = ko.pureComputed(() => {\n const level = this.contentSectionLevel();\n return 'ame-ac-content-section-' + level;\n });\n }\n}\nexport default createComponentConfig(AmeAcContentSection, `\n\t<li class=\"ame-ac-control ame-ac-content-section\" data-bind=\"class: sectionLevelClass\">\n\t\t<h4 class=\"ame-ac-control-label ame-ac-content-section-title\" data-bind=\"text: title\"></h4>\t\n\t</li>\t\n\t<!-- ko foreach: childComponents -->\n\t\t<!-- ko component: $data --><!-- /ko -->\n\t<!-- /ko -->\t\n`);\n//# sourceMappingURL=ame-ac-content-section.js.map","import { ComponentBindingOptions, createComponentConfig, KoContainerViewModel } from '../../../pro-customizables/ko-components/control-base.js';\nimport { AmeCustomizable } from '../../../pro-customizables/assets/customizable.js';\nvar ControlGroup = AmeCustomizable.ControlGroup;\nclass AmeAcControlGroup extends KoContainerViewModel {\n constructor(params, $element) {\n var _a, _b;\n super(params, $element);\n this.labelFor = (_b = ((_a = this.uiElement) === null || _a === void 0 ? void 0 : _a.labelFor)) !== null && _b !== void 0 ? _b : null;\n this.titleDisabled = (typeof params.titleDisabled !== 'undefined') ? (!!params.titleDisabled) : false;\n }\n getExpectedUiElementType() {\n return ControlGroup;\n }\n mapChildToComponentBinding(child) {\n if (child.component) {\n return ComponentBindingOptions.fromElement(child);\n }\n return super.mapChildToComponentBinding(child);\n }\n}\nexport default createComponentConfig(AmeAcControlGroup, `\n\t<li class=\"ame-ac-control ame-ac-control-group\">\n\t\t<!-- ko if: title() && !titleDisabled -->\n\t\t\t<!-- ko if: labelFor -->\n\t\t\t<label class=\"ame-ac-control-label ame-ac-group-title\" \n\t\t\t\tdata-bind=\"text: title, attr: {for: labelFor}\"></label>\n\t\t\t<!-- /ko -->\n\t\t\t<!-- ko ifnot: labelFor -->\n\t\t\t<span class=\"ame-ac-control-label ame-ac-group-title\" \n\t\t\t\tdata-bind=\"text: title\"></span>\n\t\t\t<!-- /ko -->\n\t\t<!-- /ko -->\n\t\t<ul data-bind=\"foreach: childComponents\">\n\t\t\t<li class=\"ame-ac-control\">\n\t\t\t\t<!-- ko if: (\n\t\t\t\t\t$data.uiElement \n\t\t\t\t\t&& $data.uiElement.settingValidationErrors\n\t\t\t\t\t&& ($data.uiElement.settingValidationErrors().length > 0)\n\t\t\t\t) -->\n\t\t\t\t\t<ame-ac-validation-errors params='errors: $data.uiElement.settingValidationErrors'></ame-ac-validation-errors>\n\t\t\t\t<!-- /ko -->\n\t\t\t\t<!-- ko component: $data --><!-- /ko -->\n\t\t\t</li>\t\t\n\t\t</ul>\n\t</li>\n`);\n//# sourceMappingURL=ame-ac-control-group.js.map","import { createComponentConfig, KoControlViewModel } from '../../../pro-customizables/ko-components/control-base.js';\nimport { AmeCustomizable } from '../../../pro-customizables/assets/customizable.js';\nvar Control = AmeCustomizable.Control;\nclass MissingComponentError extends Error {\n constructor(uiElement) {\n super(`The UI element \"${uiElement.label}\" [${uiElement.id}] is missing a component name.`);\n this.uiElement = uiElement;\n }\n}\nclass AmeAcControl extends KoControlViewModel {\n constructor(params, $element) {\n super(params, $element);\n //uiElement is required for this component.\n if (!this.uiElement) {\n throw new Error('The uiElement parameter is required for AmeAcControl');\n }\n this.wrapperLabelEnabled = (this.uiElement.label !== '') && (!this.uiElement.includesOwnLabel);\n this.labelForId = this.uiElement.labelTargetId;\n if (!this.uiElement.component) {\n throw new MissingComponentError(this.uiElement);\n }\n }\n getExpectedUiElementType() {\n return Control;\n }\n}\nexport default createComponentConfig(AmeAcControl, `\n\t<li class=\"ame-ac-control\">\n\t\t<!-- ko if: wrapperLabelEnabled -->\n\t\t\t<!-- ko if: labelForId -->\n\t\t\t<label class=\"ame-ac-control-label\" data-bind=\"text: label, attr: {for: labelForId}\"></label>\n\t\t\t<!-- /ko -->\n\t\t\t<!-- ko ifnot: labelForId -->\n\t\t\t<span class=\"ame-ac-control-label\" data-bind=\"text: label\"></span>\n\t\t\t<!-- /ko -->\n\t\t<!-- /ko -->\n\t\t<!-- ko component: {name: uiElement.component, params: uiElement.getComponentParams()} --><!-- /ko -->\n\t</li>\n`);\n//# sourceMappingURL=ame-ac-control.js.map","import { createComponentConfig, KoContainerViewModel } from '../../../pro-customizables/ko-components/control-base.js';\nimport { AmeCustomizable } from '../../../pro-customizables/assets/customizable.js';\nvar Section = AmeCustomizable.Section;\nimport { AmeAcSection } from './ame-ac-section.js';\nclass AmeAcSectionLink extends KoContainerViewModel {\n constructor(params, $element) {\n super(params, $element);\n //uiElement is required for this component.\n if (!this.uiElement) {\n throw new Error('The uiElement parameter is required for AmeAcSectionLink');\n }\n this.targetElementId = AmeAcSection.getSectionElementId(this.uiElement);\n this.elementId = AmeAcSection.getSectionLinkElementId(this.uiElement);\n }\n getExpectedUiElementType() {\n return Section;\n }\n}\nexport default createComponentConfig(AmeAcSectionLink, `\n\t<li class=\"ame-ac-section-link\" data-bind=\"attr: {'data-target-id' : targetElementId, 'id': elementId}\">\n\t\t<h3 class=\"ame-ac-section-title\" data-bind=\"text: title\"></h3>\n\t</li>\n`);\n//# sourceMappingURL=ame-ac-section-link.js.map","import { ComponentBindingOptions, createComponentConfig, KoContainerViewModel } from '../../../pro-customizables/ko-components/control-base.js';\nimport { AmeCustomizable } from '../../../pro-customizables/assets/customizable.js';\nvar Section = AmeCustomizable.Section;\nvar Control = AmeCustomizable.Control;\nvar ControlGroup = AmeCustomizable.ControlGroup;\nexport class AmeAcSection extends KoContainerViewModel {\n constructor(params, $element) {\n super(params, $element);\n //Must have an uiElement.\n if (this.uiElement === null) {\n throw new Error('AmeAcSection must have an uiElement.');\n }\n this.elementId = AmeAcSection.getSectionElementId(this.uiElement);\n if ((typeof params.breadcrumbs !== 'undefined') && ko.isObservable(params.breadcrumbs)) {\n this.breadcrumbs = params.breadcrumbs;\n }\n else {\n this.breadcrumbs = null;\n }\n //To keep the header text alignment consistent when navigating between sections,\n //let's show something even if there are no breadcrumbs.\n const defaultEmptyBreadcrumbText = 'Admin Menu Editor Pro';\n //Let other modules change the default text.\n let filteredEmptyBreadcrumbText = null;\n if (wp && wp.hooks && wp.hooks.applyFilters) {\n filteredEmptyBreadcrumbText = wp.hooks.applyFilters('adminMenuEditor.ac.emptyBreadcrumbText', defaultEmptyBreadcrumbText);\n }\n const emptyBreadcrumbText = ((typeof filteredEmptyBreadcrumbText === 'string')\n ? filteredEmptyBreadcrumbText\n : defaultEmptyBreadcrumbText);\n this.breadcrumbText = ko.pureComputed(() => {\n if (this.breadcrumbs === null) {\n return emptyBreadcrumbText;\n }\n const breadcrumbs = this.breadcrumbs();\n if (breadcrumbs.length < 1) {\n return emptyBreadcrumbText;\n }\n let titles = breadcrumbs.map(crumb => crumb.title);\n //Show the root section differently, \"Admin Customizer\" is too long.\n //Not sure about what text to use here, could matching the Theme Customizer be confusing?\n //Alternatives: 🛠️🎨, use \\uFE0E to render the emoji without colors (only works for some).\n //Alternatives: ⋯ and …\n titles[0] = 'Customizing';\n //Due to space constraints, show only the last 2 breadcrumbs.\n if (titles.length > 2) {\n titles = titles.slice(titles.length - 2);\n }\n return titles.join(' \\u25B8 ');\n });\n }\n getExpectedUiElementType() {\n return Section;\n }\n mapChildToComponentBinding(child) {\n if (child instanceof Section) {\n if (child.preferredRole === 'content') {\n return ComponentBindingOptions.fromElement(child, 'ame-ac-content-section');\n }\n else {\n return ComponentBindingOptions.fromElement(child, 'ame-ac-section-link');\n }\n }\n else if (child instanceof ControlGroup) {\n return ComponentBindingOptions.fromElement(child, 'ame-ac-control-group');\n }\n else if ((child instanceof Control)\n && (['ame-ac-separator', 'ame-horizontal-separator'].indexOf(child.component) < 0)) {\n //Wrap each control in a control group if it's not already in one.\n //Separators are an exception because they're cosmetic and need different styling.\n const controlGroup = child.createControlGroup();\n return this.mapChildToComponentBinding(controlGroup);\n }\n else {\n return ComponentBindingOptions.fromElement(child);\n }\n }\n static getSectionElementId(section) {\n return AmeAcSection.generateSectionElementId(section, 'ame-ac-section-');\n }\n static getSectionLinkElementId(section) {\n return AmeAcSection.generateSectionElementId(section, 'ame-ac-slink-');\n }\n static generateSectionElementId(section, prefix) {\n if (section.id) {\n return prefix + section.id;\n }\n const slug = section.title.toLowerCase().replace(/[^a-z0-9]/g, '-');\n if (slug !== '') {\n return prefix + slug;\n }\n throw new Error('Cannot generate a section element ID because the section does not have an ID or a title.');\n }\n dispose() {\n super.dispose();\n this.childComponents.dispose();\n }\n}\nexport default createComponentConfig(AmeAcSection, `\n\t<ul class=\"ame-ac-section\" data-bind=\"attr: {id: elementId}\">\n\t\t<li class=\"ame-ac-section-meta\">\n\t\t\t<div class=\"ame-ac-section-header\">\n\t\t\t\t<button class=\"ame-ac-section-back-button\">\n\t\t\t\t\t<span class=\"screen-reader-text\">Back</span>\n\t\t\t\t</button>\n\t\t\t\t<h3 class=\"ame-ac-section-title\" data-bind=\"css: {'ame-ac-has-breadcrumbs': (breadcrumbText() !== '')}\">\n\t\t\t\t <!-- ko if: breadcrumbText -->\n\t\t\t\t\t\t<span class=\"ame-ac-section-breadcrumbs\" data-bind=\"text: breadcrumbText\"></span>\n\t\t\t\t\t<!-- /ko -->\n\t\t\t\t\t<span class=\"ame-ac-section-own-title\" data-bind=\"text: title\"></span>\t\t\t\t\n\t\t\t\t</h3>\n\t\t\t</div>\n\t\t</li>\n\t\t<!-- ko foreach: childComponents -->\n\t\t\t<!-- ko component: $data --><!-- /ko -->\n\t\t<!-- /ko -->\n\t</ul>\n`);\n//# sourceMappingURL=ame-ac-section.js.map","import { createComponentConfig, KoStandaloneControl } from '../../../pro-customizables/ko-components/control-base.js';\nclass AmeAcSeparator extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n }\n}\nexport default createComponentConfig(AmeAcSeparator, `\n\t<li class=\"ame-ac-control ame-ac-separator\"></li>\n`);\n//# sourceMappingURL=ame-ac-separator.js.map","import { createRendererComponentConfig, KoRendererViewModel } from '../../../pro-customizables/ko-components/control-base.js';\nimport { AmeCustomizable } from '../../../pro-customizables/assets/customizable.js';\nvar Section = AmeCustomizable.Section;\nclass AmeAcStructure extends KoRendererViewModel {\n constructor(params, $element) {\n var _a;\n super(params, $element);\n this.allNavigationSections = [];\n const rootSection = new Section({\n t: 'section',\n id: 'structure-root',\n title: (_a = this.structure.title) !== null && _a !== void 0 ? _a : 'Root',\n }, this.structure.children);\n //Recursively collect all navigable sections. Don't include content\n //sections: their parents will output them, not this component.\n function collectChildSections(section, accumulator = []) {\n if (section.preferredRole === 'navigation') {\n accumulator.push(section);\n }\n for (const child of section.children) {\n if (child instanceof Section) {\n collectChildSections(child, accumulator);\n }\n }\n return accumulator;\n }\n this.allNavigationSections = collectChildSections(rootSection);\n //Give the breadcrumb list to each section, if available.\n if (typeof params.breadcrumbs !== 'undefined') {\n for (const section of this.allNavigationSections) {\n section.componentParams.breadcrumbs = params.breadcrumbs;\n }\n }\n }\n}\nexport default createRendererComponentConfig(AmeAcStructure, `\n\t<!-- ko foreach: allNavigationSections -->\n\t\t<!-- ko component: {name: 'ame-ac-section', params: $data.getComponentParams()} --><!-- /ko -->\n\t<!-- /ko -->\n`);\n//# sourceMappingURL=ame-ac-structure.js.map","import { createComponentConfig, KoStandaloneControl } from '../../../pro-customizables/ko-components/control-base.js';\nclass AmeAcValidationErrors extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n if (typeof params.errors !== 'undefined') {\n if (Array.isArray(params.errors)) {\n this.errors = params.errors;\n }\n else if (ko.isObservable(params.errors)) {\n this.errors = params.errors;\n }\n else {\n throw new Error('The \"errors\" parameter must be an array or an observable array.');\n }\n }\n else {\n console.log('Params:', params);\n throw new Error('The \"errors\" parameter is required for the AmeAcValidationErrors component.');\n }\n }\n}\nexport default createComponentConfig(AmeAcValidationErrors, `\n\t<ul class=\"ame-ac-ve-list\" data-bind=\"foreach: errors\">\n\t\t<li class=\"notice notice-error ame-ac-validation-error\">\n\t\t\t<span class=\"ame-ac-ve-message\" data-bind=\"text: $data[1].message, attr: {title: $data[1].code}\"></span>\n\t\t</li>\n\t</ul>\n`);\n//# sourceMappingURL=ame-ac-validation-errors.js.map","'use strict';\nimport { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\nimport { LazyPopupSliderAdapter } from '../lazy-popup-slider-adapter.js';\nconst allDimensionKeys = [\n 'top', 'bottom', 'left', 'right',\n 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'\n];\nfunction isDimensionKey(key) {\n return allDimensionKeys.includes(key);\n}\nconst DefaultDimensionsInOrder = [\n ['top', 'Top'],\n ['bottom', 'Bottom'],\n ['left', 'Left'],\n ['right', 'Right'],\n];\nconst SideDimensions = ['top', 'bottom', 'left', 'right'];\nconst SymmetricDimensionMap = {\n 'vertical': ['top', 'bottom'],\n 'horizontal': ['left', 'right'],\n};\nfunction isSymmetricDimensionKey(key) {\n return SymmetricDimensionMap.hasOwnProperty(key);\n}\nlet nextId = 0;\nclass AmeBoxDimensions extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.inputIdPrefix = '_ame-box-dimensions-c-input-' + (nextId++);\n this.unitElementId = '_ame-box-dimensions-c-unit-' + (nextId++);\n this.wrapperAttributes = {};\n if ((typeof params.id === 'string') && (params.id !== '')) {\n this.wrapperAttributes['id'] = '_ame-box-dimensions-w-' + params.id;\n }\n if ((typeof params['dimensionNames'] !== 'undefined') && Array.isArray(params['dimensionNames'])) {\n this.dimensionsInOrder = params['dimensionNames'];\n }\n else {\n this.dimensionsInOrder = DefaultDimensionsInOrder;\n }\n //Make observable proxies for the individual dimension settings.\n const temp = {};\n for (const [dimensionKey, dimensionName] of this.dimensionsInOrder) {\n const setting = this.settings['value.' + dimensionKey];\n if (!setting || (typeof setting !== 'object')) {\n throw new Error(`Missing setting for the \"${dimensionName}\" side.`);\n }\n temp[dimensionKey] = ko.computed({\n read: () => {\n return setting.value();\n },\n write: (newValue) => {\n if (newValue === '') {\n newValue = null;\n }\n setting.value(newValue);\n },\n deferEvaluation: true,\n }).extend({ 'ameNumericInput': true });\n }\n this.dimensions = temp;\n //Similarly, make an observable for the unit setting.\n const unitSetting = this.settings['value.unit'];\n if (!unitSetting || (typeof unitSetting !== 'object')) {\n throw new Error('Missing setting for the unit.');\n }\n this.unitSetting = unitSetting;\n const defaultDropdownOptions = {\n options: [],\n optionsText: 'text',\n optionsValue: 'value'\n };\n if (params.unitDropdownOptions && (typeof params.unitDropdownOptions === 'object')) {\n const unitDropdownOptions = params.unitDropdownOptions;\n this.unitDropdownOptions = {\n options: unitDropdownOptions['options'] || defaultDropdownOptions.options,\n optionsText: unitDropdownOptions['optionsText'] || defaultDropdownOptions.optionsText,\n optionsValue: unitDropdownOptions['optionsValue'] || defaultDropdownOptions.optionsValue,\n };\n }\n else {\n this.unitDropdownOptions = defaultDropdownOptions;\n }\n this.isLinkActive = ko.observable(false);\n //Enable the link button by default if all dimensions are equal. Exception: null values.\n //Dimensions can have different defaults, so null doesn't necessarily mean that they\n //are actually equal.\n const firstKey = Object.keys(this.dimensions)[0];\n const firstValue = this.dimensions[firstKey]();\n if ((firstValue !== null) && (firstValue !== '')) {\n let areAllDimensionsEqual = true;\n for (const [dimensionKey] of this.dimensionsInOrder) {\n if (this.dimensions[dimensionKey]() !== firstValue) {\n areAllDimensionsEqual = false;\n break;\n }\n }\n this.isLinkActive(areAllDimensionsEqual);\n }\n //When \"link\" mode is enabled, keep all dimensions in sync.\n let isUpdatingAllDimensions = false; //Prevent infinite loops.\n const updateAllDimensions = (newValue) => {\n if (!isUpdatingAllDimensions && this.isLinkActive()) {\n isUpdatingAllDimensions = true;\n newValue = this.normalizeValue(newValue);\n for (const observable of Object.values(this.dimensions)) {\n observable(newValue);\n }\n isUpdatingAllDimensions = false;\n }\n };\n for (const dimensionKey of Object.keys(this.dimensions)) {\n this.dimensions[dimensionKey].subscribe(updateAllDimensions);\n }\n //In \"symmetric\" mode, the top/bottom and left/right dimensions are always equal.\n //The control will only show \"vertical\" and \"horizontal\" inputs.\n this.symmetricModeEnabled = ko.observable(this.decideSymmetricMode(params));\n //Create computed observables for the \"vertical\" and \"horizontal\" dimensions.\n this.symmetricValues = {};\n for (const name in SymmetricDimensionMap) {\n if (!isSymmetricDimensionKey(name) || !SymmetricDimensionMap.hasOwnProperty(name)) {\n continue;\n }\n const sides = SymmetricDimensionMap[name];\n this.symmetricValues[name] = ko.computed({\n read: () => {\n if (this.symmetricModeEnabled()) {\n return this.dimensions[sides[0]]();\n }\n else {\n return null;\n }\n },\n write: (newValue) => {\n if (this.symmetricModeEnabled()) {\n newValue = this.normalizeValue(newValue);\n for (const side of sides) {\n this.dimensions[side](newValue);\n }\n }\n },\n deferEvaluation: true\n }).extend({ 'ameNumericInput': true });\n }\n //The control displays a different set of inputs depending on the current mode.\n this.inputsInOrder = ko.pureComputed(() => {\n let result;\n if (this.symmetricModeEnabled()) {\n result = [\n ['vertical', 'Vertical'],\n ['horizontal', 'Horizontal'],\n ];\n }\n else {\n result = this.dimensionsInOrder;\n }\n return result;\n });\n let sliderOptions = {\n 'positionParentSelector': '.ame-single-box-dimension',\n 'verticalOffset': -2,\n };\n if (typeof params.popupSliderWithin === 'string') {\n sliderOptions.positionWithinClosest = params.popupSliderWithin;\n }\n this.sliderAdapter = new LazyPopupSliderAdapter(params.sliderRanges ? params.sliderRanges : null, '.ame-box-dimensions-control', 'input.ame-box-dimensions-input', sliderOptions);\n }\n get classes() {\n return ['ame-box-dimensions-control', ...super.classes];\n }\n //noinspection JSUnusedGlobalSymbols -- Used in the template.\n /**\n * Get an observable for a specific dimension or a pair of dimensions.\n *\n * Unfortunately, Knockout doesn't seem to support nested indexed accessors\n * like \"dimensions[$data[0]]\", so we have to use a method instead.\n */\n getInputObservable(key) {\n if (this.symmetricModeEnabled() && isSymmetricDimensionKey(key)) {\n return this.symmetricValues[key];\n }\n if (isDimensionKey(key)) {\n return this.dimensions[key];\n }\n throw new Error('Invalid input key for the current mode: ' + key);\n }\n getInputIdFor(key) {\n return this.inputIdPrefix + '-' + key;\n }\n // noinspection JSUnusedGlobalSymbols -- Used in the template.\n getInputAttributes(key) {\n return {\n id: this.getInputIdFor(key),\n 'data-unit-element-id': this.unitElementId,\n 'data-ame-box-dimension': key,\n };\n }\n // noinspection JSUnusedGlobalSymbols -- Used in the template.\n getSettingFor(key) {\n const settingName = 'value.' + key;\n if (settingName in this.settings) {\n return this.settings[settingName];\n }\n if (this.symmetricModeEnabled() && isSymmetricDimensionKey(key)) {\n for (const dimension of SymmetricDimensionMap[key]) {\n //Since both symmetric dimensions are always equal, we can use\n //either of the two settings.\n const settingName = 'value.' + dimension;\n if (settingName in this.settings) {\n return this.settings[dimension];\n }\n }\n }\n return null;\n }\n // noinspection JSUnusedGlobalSymbols -- Actually used in the template.\n toggleLink() {\n this.isLinkActive(!this.isLinkActive());\n //When enabling \"link\" mode, fill all inputs with the same value.\n //Use the first non-empty value.\n if (this.isLinkActive()) {\n let firstValue = null;\n for (const dimensionObservable of Object.values(this.dimensions)) {\n const value = dimensionObservable();\n if ((value !== null) && (value !== '')) {\n firstValue = value;\n break;\n }\n }\n if (firstValue !== null) {\n firstValue = this.normalizeValue(firstValue);\n for (const dimensionObservable of Object.values(this.dimensions)) {\n dimensionObservable(firstValue);\n }\n }\n }\n }\n normalizeValue(value) {\n if (value === null) {\n return null;\n }\n //Convert strings to numbers, and invalid strings to null.\n if (typeof value === 'string') {\n value = parseFloat(value);\n if (isNaN(value)) {\n return null;\n }\n }\n return value;\n }\n /**\n * Determine whether the control should be in \"symmetric\" mode.\n */\n decideSymmetricMode(componentParams) {\n //This mode is off by default and can be enabled by setting the \"symmetricMode\" parameter.\n let enableMode = (typeof componentParams['symmetricMode'] !== 'undefined')\n ? (!!componentParams['symmetricMode'])\n : false;\n if (!enableMode) {\n return false;\n }\n //Symmetric mode can't be enabled if the control doesn't have all side dimensions.\n const hasAllSideDimensions = SideDimensions.every((key) => {\n return (key in this.dimensions);\n });\n if (!hasAllSideDimensions) {\n return false;\n }\n //It also can only be enabled if top/bottom and left/right dimensions are equal.\n return ((this.dimensions['top']() === this.dimensions['bottom']())\n && (this.dimensions['left']() === this.dimensions['right']()));\n }\n}\nexport default createControlComponentConfig(AmeBoxDimensions, `\n\t<fieldset data-bind=\"class: classString, enable: isEnabled, style: styles, attr: wrapperAttributes\"\n\t data-ame-is-component=\"1\">\n\t\t<!-- ko foreach: inputsInOrder -->\n\t\t\t<div data-bind=\"class: ('ame-single-box-dimension ame-box-dimension-' + $data[0])\">\n\t\t\t\t<input type=\"text\" inputmode=\"numeric\" maxlength=\"20\" pattern=\"\\\\s*-?[0-9]+(?:[.,]\\\\d*)?\\\\s*\" \n\t\t\t\t\tdata-bind=\"value: $parent.getInputObservable($data[0]), valueUpdate: 'input',\n\t\t\t\t\tattr: $component.getInputAttributes($data[0]),\n\t\t\t\t\tclass: ('ame-small-number-input ame-box-dimensions-input ame-box-dimensions-input-' + $data[0]),\n\t\t\t\t\tenable: $component.isEnabled,\n\t\t\t\t\tclick: $component.sliderAdapter.handleKoClickEvent,\n\t\t\t\t\tameValidationErrorClass: $component.getSettingFor($data[0])\" />\t\t\t\t\n\t\t\t\t<label data-bind=\"attr: {'for': $component.getInputIdFor($data[0])}\" \n\t\t\t\t\tclass=\"ame-box-dimension-label\"><span\n\t\t\t\t\tdata-bind=\"text: $data[1]\" class=\"ame-box-dimension-label-text\"></span></label>\n\t\t\t</div>\n\t\t<!-- /ko -->\n\t\t<ame-unit-dropdown params=\"optionData: unitDropdownOptions, settings: {value: unitSetting},\n\t\t\tclasses: ['ame-box-dimensions-unit-selector'],\n\t\t\tid: unitElementId\"></ame-unit-dropdown>\n\t\t<button class=\"button button-secondary ame-box-dimensions-link-button hide-if-no-js\"\n\t\t\ttitle=\"Link values\" data-bind=\"enable: isEnabled, css: {'active': isLinkActive}, \n\t\t\t\tclick: $component.toggleLink.bind($component)\"><span class=\"dashicons dashicons-admin-links\"></span></button>\n\t</fieldset>\n`);\n//# sourceMappingURL=ame-box-dimensions.js.map","import { KoStandaloneControl } from '../control-base.js';\nexport class ChoiceControlOption {\n constructor(data) {\n this.value = data.value;\n this.label = data.label;\n this.description = data.description || '';\n this.enabled = (typeof data.enabled === 'undefined') || data.enabled;\n this.icon = data.icon || '';\n }\n}\nexport class AmeChoiceControl extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.options = ko.observableArray([]);\n if ((typeof params['options'] !== 'undefined') && Array.isArray(params.options)) {\n this.options(params.options.map((optionData) => new ChoiceControlOption(optionData)));\n }\n }\n}\n//# sourceMappingURL=ame-choice-control.js.map","'use strict';\nimport { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\n/**\n * Code editor control with syntax highlighting.\n *\n * This control uses the custom Knockout binding \"ameCodeMirror\" to do the heavy\n * lifting. The binding is defined in ko-extensions.ts.\n *\n * Note: The user can disable syntax highlighting. In that case, this control\n * should behave like a normal textarea.\n */\nclass AmeCodeEditor extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n if ((typeof params.editorSettings === 'object') && (params.editorSettings !== null)) {\n this.editorSettings = params.editorSettings;\n }\n else {\n this.editorSettings = false;\n }\n }\n}\nexport default createControlComponentConfig(AmeCodeEditor, `\n\t<div class=\"ame-code-editor-control-wrap\"> \n\t\t<textarea data-bind=\"attr: inputAttributes, value: valueProxy, \n\t\t\tclass: inputClassString, ameCodeMirror: editorSettings\" \n\t\t\tclass=\"large-text\" cols=\"50\" rows=\"10\"></textarea>\n\t</div>\n\t<!-- ko if: (description) -->\n\t\t<!-- ko component: {name: 'ame-sibling-description', params: {description: description}} --><!-- /ko -->\n\t<!-- /ko -->\n`);\n//# sourceMappingURL=ame-code-editor.js.map","import { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\n/**\n * A wrapper for the WordPress color picker.\n *\n * Note that the custom 'ameColorPicker' binding must be available when this component\n * is used. You must enqueue the 'ame-ko-extensions' script for this to work.\n */\nclass AmeColorPicker extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n }\n koDescendantsComplete(node) {\n //Make the color picker input visible. Its visibility is set to hidden by default.\n if (node.nodeType === Node.COMMENT_NODE) {\n //The component was bound to a comment node. The real element\n //should be the next non-comment sibling.\n let nextElement;\n do {\n nextElement = node.nextElementSibling;\n } while (nextElement && (nextElement.nodeType === Node.COMMENT_NODE));\n if (!nextElement) {\n return; //This should never happen.\n }\n node = nextElement;\n }\n if (!node || (node.nodeType !== Node.ELEMENT_NODE)) {\n return; //This should never happen.\n }\n const $picker = jQuery(node);\n //This should be a .wp-picker-container element that contains an input.\n const $input = $picker.find('input.ame-color-picker');\n if ($input.length > 0) {\n $input.css('visibility', 'visible');\n }\n }\n get classes() {\n return ['ame-color-picker', 'ame-color-picker-component', ...super.classes];\n }\n}\nexport default createControlComponentConfig(AmeColorPicker, `\n\t<input type=\"text\" style=\"visibility: hidden\" data-bind=\"ameColorPicker: valueProxy, \n\t\tclass: classString, attr: inputAttributes\">\n`);\n//# sourceMappingURL=ame-color-picker.js.map","/*\n * This utility module imports all the base Knockout components and exports\n * a function that can be used to register the components with Knockout.\n */\nimport ameBoxDimensions from './ame-box-dimensions/ame-box-dimensions.js';\nimport ameColorPicker from './ame-color-picker/ame-color-picker.js';\nimport ameFontStylePicker from './ame-font-style-picker/ame-font-style-picker.js';\nimport ameImageSelector from './ame-image-selector/ame-image-selector.js';\nimport ameNumberInput from './ame-number-input/ame-number-input.js';\nimport ameNestedDescription from './ame-nested-description/ame-nested-description.js';\nimport ameRadioButtonBar from './ame-radio-button-bar/ame-radio-button-bar.js';\nimport ameRadioGroup from './ame-radio-group/ame-radio-group.js';\nimport ameSelectBox from './ame-select-box/ame-select-box.js';\nimport ameSiblingDescription from './ame-sibling-description/ame-sibling-description.js';\nimport ameStaticHtml from './ame-static-html/ame-static-html.js';\nimport ameTextInput from './ame-text-input/ame-text-input.js';\nimport ameToggleCheckbox from './ame-toggle-checkbox/ame-toggle-checkbox.js';\nimport ameUnitDropdown from './ame-unit-dropdown/ame-unit-dropdown.js';\nimport ameWpEditor from './ame-wp-editor/ame-wp-editor.js';\nimport ameHorizontalSeparator from './ame-horizontal-separator/ame-horizontal-separator.js';\nimport ameCodeEditor from './ame-code-editor/ame-code-editor.js';\nlet componentsRegistered = false;\n/**\n * Register the base Knockout components that are part of AME.\n *\n * It's safe to call this function multiple times. It will only register the components once.\n */\nexport function registerBaseComponents() {\n if (componentsRegistered) {\n return;\n }\n ko.components.register('ame-box-dimensions', ameBoxDimensions);\n ko.components.register('ame-color-picker', ameColorPicker);\n ko.components.register('ame-font-style-picker', ameFontStylePicker);\n ko.components.register('ame-image-selector', ameImageSelector);\n ko.components.register('ame-number-input', ameNumberInput);\n ko.components.register('ame-nested-description', ameNestedDescription);\n ko.components.register('ame-radio-button-bar', ameRadioButtonBar);\n ko.components.register('ame-radio-group', ameRadioGroup);\n ko.components.register('ame-select-box', ameSelectBox);\n ko.components.register('ame-sibling-description', ameSiblingDescription);\n ko.components.register('ame-static-html', ameStaticHtml);\n ko.components.register('ame-text-input', ameTextInput);\n ko.components.register('ame-toggle-checkbox', ameToggleCheckbox);\n ko.components.register('ame-unit-dropdown', ameUnitDropdown);\n ko.components.register('ame-wp-editor', ameWpEditor);\n ko.components.register('ame-horizontal-separator', ameHorizontalSeparator);\n ko.components.register('ame-code-editor', ameCodeEditor);\n componentsRegistered = true;\n}\n//# sourceMappingURL=ame-components.js.map","import { KoComponentViewModel } from '../control-base.js';\n/**\n * Base class for description components.\n */\nexport class AmeDescriptionComponent extends KoComponentViewModel {\n constructor(params, $element) {\n super(params, $element);\n this.description = params.description || '';\n }\n}\n//# sourceMappingURL=ame-description.js.map","import { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\n//Note: Font style picker CSS is already included in the main 'controls.scss' file\n//and won't be duplicated or included here. Instead, load that stylesheet when\n//using any control components.\n/**\n * Font style options that can be selected in the picker component.\n *\n * Regrettably, these are duplicated from the PHP version of the control.\n * Once browsers support importing JSON files, we can move this to a separate\n * file and use that file in both places.\n */\nconst fontStyleOptions = {\n \"font-style\": [\n {\n \"value\": null,\n \"text\": \"Default font style\",\n \"label\": \"—\"\n },\n {\n \"value\": \"italic\",\n \"text\": \"Italic\",\n \"label\": \"<span class=\\\"dashicons dashicons-editor-italic\\\"></span>\"\n }\n ],\n \"text-transform\": [\n {\n \"value\": null,\n \"text\": \"Default letter case\",\n \"label\": \"—\"\n },\n {\n \"value\": \"uppercase\",\n \"text\": \"Uppercase\",\n \"label\": {\n 'text-transform': 'uppercase'\n }\n },\n {\n \"value\": \"lowercase\",\n \"text\": \"Lowercase\",\n \"label\": {\n 'text-transform': 'lowercase'\n }\n },\n {\n \"value\": \"capitalize\",\n \"text\": \"Capitalize each word\",\n \"label\": {\n 'text-transform': 'capitalize'\n }\n }\n ],\n \"font-variant\": [\n {\n \"value\": null,\n \"text\": \"Default font variant\",\n \"label\": \"—\"\n },\n {\n \"value\": \"small-caps\",\n \"text\": \"Small caps\",\n \"label\": {\n 'font-variant': 'small-caps'\n }\n }\n ],\n \"text-decoration\": [\n {\n \"value\": null,\n \"text\": \"Default text decoration\",\n \"label\": \"—\"\n },\n {\n \"value\": \"underline\",\n \"text\": \"Underline\",\n \"label\": \"<span class=\\\"dashicons dashicons-editor-underline\\\"></span>\"\n },\n {\n \"value\": \"line-through\",\n \"text\": \"Strikethrough\",\n \"label\": \"<span class=\\\"dashicons dashicons-editor-strikethrough\\\"></span>\"\n }\n ]\n};\n//Generate label HTML for options that don't have it yet.\nfunction makeFontSample(styles) {\n let styleString = '';\n for (const [property, value] of Object.entries(styles)) {\n styleString += `${property}: ${value};`;\n }\n return `<span class=\"ame-font-sample\" style=\"${styleString}\">ab</span>`;\n}\nlet flattenedOptions = [];\nfor (const [property, options] of Object.entries(fontStyleOptions)) {\n options.forEach((option) => {\n //Skip null values. They're used to indicate the default option,\n //and we don't need those in the Knockout version of this control.\n if (option.value === null) {\n return;\n }\n let labelString;\n if (typeof option.label === 'object') {\n labelString = makeFontSample(option.label);\n }\n else {\n labelString = option.label;\n }\n flattenedOptions.push({\n 'value': option.value,\n 'text': option.text || '',\n 'property': property,\n 'label': labelString\n });\n });\n}\nclass AmeFontStylePicker extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.options = flattenedOptions;\n }\n get classes() {\n return ['ame-font-style-control', ...super.classes];\n }\n // noinspection JSUnusedGlobalSymbols -- Used in the template, below.\n isOptionSelected(property, value) {\n if (this.settings.hasOwnProperty(property)) {\n return (this.settings[property].value() === value);\n }\n return false;\n }\n // noinspection JSUnusedGlobalSymbols -- Used in the template.\n toggleOption(property, value) {\n if (!this.settings.hasOwnProperty(property)) {\n return;\n }\n const targetSetting = this.settings[property];\n if (targetSetting.value() === value) {\n //When the user clicks on the currently selected option, reset it to the default.\n targetSetting.tryUpdate(null);\n }\n else {\n //Otherwise, set the new value.\n targetSetting.tryUpdate(value);\n }\n }\n}\n//Note: This weird spacing in the template string is intentional. It's used to\n//remove whitespace nodes from the DOM, which would otherwise slightly change\n//the layout of the control.\nexport default createControlComponentConfig(AmeFontStylePicker, `\n\t<fieldset data-ame-is-component=\"1\" data-bind=\"class: classString, style: styles\">\n\t\t<!-- \n\t\tko foreach: options \n\t\t--><label class=\"ame-font-style-control-choice\" data-bind=\"attr: {title: (text || '')}\"><!-- \n\t\t\tko if: text \n\t\t\t--><span class=\"screen-reader-text\" data-bind=\"text: text\"></span><!-- \n\t\t\t/ko \n\t\t--><span class=\"button button-secondary ame-font-style-control-choice-label\" \n\t\t\t\tdata-bind=\"html: label, css: { 'active': $component.isOptionSelected(property, value) },\n\t\t\t\tclick: $component.toggleOption.bind($component, property, value)\"></span></label><!-- \n\t\t/ko -->\n\t</fieldset>\n`);\n//# sourceMappingURL=ame-font-style-picker.js.map","import { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\nclass AmeHorizontalSeparator extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n }\n}\nexport default createControlComponentConfig(AmeHorizontalSeparator, `\n\t<div class=\"ame-horizontal-separator\"></div>\n`);\n//# sourceMappingURL=ame-horizontal-separator.js.map","'use strict';\nimport { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\n/**\n * Image selector control.\n *\n * This implementation hands off the work to the existing AmeImageSelectorApi.ImageSelector\n * class to avoid duplicating the effort. That class is not a module because it is also\n * used for the more progressive-enhancement-y PHP-rendered controls, so we can't import it.\n */\nclass AmeImageSelector extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.selectorInstance = null;\n //Verify that our dependencies are available.\n if (typeof AmeImageSelectorApi === 'undefined') {\n throw new Error('AmeImageSelectorApi is not available. Remember to enqueue \"ame-image-selector-control-v2\".');\n }\n if (typeof AmeImageSelectorApi.ImageSelector === 'undefined') {\n throw new Error('AmeImageSelectorApi.ImageSelector is not available. This is probably a bug.');\n }\n this.externalUrlsAllowed = !!params.externalUrlsAllowed;\n this.canSelectMedia = !!params.canSelectMedia;\n this.imageProxy = this.settings.value.value;\n }\n get classes() {\n return [\n 'ame-image-selector-v2',\n ...super.classes,\n ];\n }\n koDescendantsComplete() {\n const $container = this.findChild('.ame-image-selector-v2');\n if ($container.length === 0) {\n return;\n }\n this.selectorInstance = new AmeImageSelectorApi.ImageSelector($container, {\n externalUrlsAllowed: this.externalUrlsAllowed,\n canSelectMedia: this.canSelectMedia,\n }, this.imageProxy());\n }\n}\nexport default createControlComponentConfig(AmeImageSelector, `\n\t<div class=\"ame-image-selector-v2\" data-ame-is-component=\"1\" \n\t\tdata-bind=\"class: classString, ameObservableChangeEvents: { observable: imageProxy }\">\n\t\t<!-- The contents should be generated by the image selector API. -->\n\t</div>\n`);\n//# sourceMappingURL=ame-image-selector.js.map","import { createComponentConfig } from '../control-base.js';\nimport { AmeDescriptionComponent } from '../ame-description/ame-description.js';\n/**\n * A simple component that displays the description of a UI element.\n *\n * Like AmeSiblingDescription, but intended to be rendered inside\n * the parent control or container, not as a sibling.\n */\nclass AmeNestedDescription extends AmeDescriptionComponent {\n}\nexport default createComponentConfig(AmeNestedDescription, `\n\t<br><span class=\"description\" data-bind=\"html: description\"></span>\t\n`);\n//# sourceMappingURL=ame-nested-description.js.map","/// <reference path=\"../../../../customizables/assets/popup-slider.d.ts\" />\nimport { createControlComponentConfig, KoDependentControl } from '../control-base.js';\nimport { AmeCustomizable } from '../../assets/customizable.js';\nvar Control = AmeCustomizable.Control;\nexport class AmeNumberInput extends KoDependentControl {\n constructor(params, $element) {\n super(params, $element);\n this.sliderRanges = null;\n this.slider = null;\n this.numericValue = this.valueProxy.extend({ 'ameNumericInput': true });\n this.unitText = params.unitText || '';\n this.hasUnitDropdown = params.hasUnitDropdown || false;\n this.unitElementId = params.unitElementId || '';\n if (this.hasUnitDropdown && params.unitDropdownOptions) {\n this.unitDropdownOptions = {\n options: params.unitDropdownOptions.options || [],\n optionsText: params.unitDropdownOptions.optionsText || 'text',\n optionsValue: params.unitDropdownOptions.optionsValue || 'value'\n };\n }\n else {\n this.unitDropdownOptions = null;\n }\n this.min = params.min || null;\n this.max = params.max || null;\n this.step = params.step || null;\n if (params.sliderRanges) {\n this.sliderRanges = params.sliderRanges;\n }\n this.popupSliderWithin = (typeof params.popupSliderWithin === 'string') ? params.popupSliderWithin : null;\n this.inputClasses.unshift('ame-input-with-popup-slider', 'ame-number-input');\n }\n get classes() {\n const classes = ['ame-number-input-control'];\n if (this.sliderRanges !== null) {\n classes.push('ame-container-with-popup-slider');\n }\n classes.push(...super.classes);\n return classes;\n }\n get inputClasses() {\n const classes = ['ame-input-with-popup-slider', 'ame-number-input'];\n classes.push(...super.inputClasses);\n return classes;\n }\n getAdditionalInputAttributes() {\n let attributes = super.getAdditionalInputAttributes();\n if (this.min !== null) {\n attributes['min'] = this.min.toString();\n }\n if (this.max !== null) {\n attributes['max'] = this.max.toString();\n }\n if (this.step !== null) {\n attributes['step'] = this.step.toString();\n }\n if (this.unitElementId) {\n attributes['data-unit-element-id'] = this.unitElementId;\n }\n return attributes;\n }\n // noinspection JSUnusedGlobalSymbols -- Used in the Knockout template in this same file.\n showPopupSlider($data, event) {\n if ((this.sliderRanges === null) || (typeof AmePopupSlider === 'undefined')) {\n return;\n }\n //Some sanity checks.\n if (!event.target) {\n return;\n }\n const $input = jQuery(event.target);\n if ($input.is(':disabled') || !$input.is('input')) {\n return;\n }\n const $container = $input.closest('.ame-container-with-popup-slider');\n if ($container.length < 1) {\n return;\n }\n //Initialize the slider if it's not already initialized.\n if (!this.slider) {\n let sliderOptions = {};\n if (this.popupSliderWithin) {\n sliderOptions.positionWithinClosest = this.popupSliderWithin;\n }\n //In HTML, we would pass the range data as a \"data-slider-ranges\" attribute,\n //but here we can just set the data directly.\n $input.data('slider-ranges', this.sliderRanges);\n this.slider = AmePopupSlider.createSlider($container, sliderOptions);\n }\n this.slider.showForInput($input);\n }\n getExpectedUiElementType() {\n return Control;\n }\n}\nexport default createControlComponentConfig(AmeNumberInput, `\n\t<fieldset data-bind=\"class: classString, enable: isEnabled\">\n\t\t<div data-bind=\"class: (hasUnitDropdown ? 'ame-input-group' : '')\">\n\t\t\t<input type=\"text\" inputmode=\"numeric\" maxlength=\"20\" pattern=\"\\\\s*-?[0-9]+(?:[.,]\\\\d*)?\\\\s*\"\n\t\t\t\t data-bind=\"attr: inputAttributes, value: numericValue, valueUpdate: 'input', \n\t\t\t\t class: inputClassString, enable: isEnabled, click: showPopupSlider.bind($component),\n\t\t\t\t ameValidationErrorClass: settings.value\">\n\t\t\t\n\t\t\t<!-- ko if: hasUnitDropdown -->\n\t\t\t\t<ame-unit-dropdown params=\"optionData: unitDropdownOptions, settings: {value: settings.unit},\n\t\t\t\t\tclasses: ['ame-input-group-secondary', 'ame-number-input-unit'],\n\t\t\t\t\tid: unitElementId\"></ame-unit-dropdown>\n\t\t\t<!-- /ko -->\n\t\t\t<!-- ko if: (!hasUnitDropdown && unitText) -->\n\t\t\t\t<span class=\"ame-number-input-unit\" \n\t\t\t\t\t data-bind=\"text: unitText, attr: {id: unitElementId, 'data-number-unit': unitText}\"></span>\n\t\t\t<!-- /ko -->\n\t\t</div>\n\t</fieldset>\t\n`);\n//# sourceMappingURL=ame-number-input.js.map","'use strict';\nimport { createControlComponentConfig } from '../control-base.js';\nimport { AmeChoiceControl } from '../ame-choice-control/ame-choice-control.js';\nclass AmeRadioButtonBar extends AmeChoiceControl {\n constructor(params, $element) {\n super(params, $element);\n }\n get classes() {\n return ['ame-radio-button-bar-control', ...super.classes];\n }\n}\nexport default createControlComponentConfig(AmeRadioButtonBar, `\n\t<fieldset data-bind=\"class: classString, enable: isEnabled, style: styles\" data-ame-is-component=\"1\">\n\t\t<!-- ko foreach: options -->\n\t\t<label data-bind=\"attr: {title: description}\" class=\"ame-radio-bar-item\">\n\t\t\t<input type=\"radio\" data-bind=\"class: $component.inputClassString,\n\t\t\t\tchecked: $component.valueProxy, checkedValue: value, enable: $component.isEnabled,\n\t\t\t\tameObservableChangeEvents: true\">\n\t\t\t<span class=\"button ame-radio-bar-button\" data-bind=\"css: {'ame-rb-has-label' : label}\">\n\t\t\t\t<!-- ko if: (icon && (icon.indexOf('dashicons-') >= 0)) -->\n\t\t\t\t\t<span data-bind=\"class: 'dashicons ' + icon\"></span>\n\t\t\t\t<!-- /ko -->\n\t\t\t\t<!-- ko if: label -->\n\t\t\t\t\t<span class=\"ame-rb-label\" data-bind=\"text: label\"></span>\n\t\t\t\t<!-- /ko -->\n\t\t\t</span>\n\t\t</label>\n\t\t<!-- /ko -->\n\t</fieldset>\n`);\n//# sourceMappingURL=ame-radio-button-bar.js.map","'use strict';\nimport { createControlComponentConfig } from '../control-base.js';\nimport { AmeChoiceControl } from '../ame-choice-control/ame-choice-control.js';\n// noinspection JSUnusedGlobalSymbols -- Enum keys like \"Paragraph\" are used when serializing wrapStyle in PHP.\nvar WrapStyle;\n(function (WrapStyle) {\n WrapStyle[\"LineBreak\"] = \"br\";\n WrapStyle[\"Paragraph\"] = \"p\";\n WrapStyle[\"None\"] = \"\";\n})(WrapStyle || (WrapStyle = {}));\nfunction isWrapStyle(value) {\n if (typeof value !== 'string') {\n return false;\n }\n return (typeof WrapStyle[value] === 'string');\n}\nlet nextRadioGroupId = 1;\nclass AmeRadioGroup extends AmeChoiceControl {\n constructor(params, $element) {\n super(params, $element);\n this.wrapStyle = WrapStyle.None;\n this.childByValue = new Map();\n if ((typeof params['valueChildIndexes'] === 'object') && Array.isArray(params.valueChildIndexes)) {\n const children = ko.unwrap(this.inputChildren);\n for (const [value, index] of params.valueChildIndexes) {\n if (!children || !children[index]) {\n throw new Error('The \"' + this.label + '\" radio group has no children, but its valueChildIndexes'\n + ' requires child #' + index + ' to be associated with value \"' + value + '\".');\n }\n this.childByValue.set(value, children[index]);\n }\n }\n this.wrapStyle = isWrapStyle(params.wrapStyle) ? WrapStyle[params.wrapStyle] : WrapStyle.None;\n if (this.childByValue.size > 0) {\n this.wrapStyle = WrapStyle.None;\n }\n this.radioInputPrefix = (typeof params.radioInputPrefix === 'string')\n ? params.radioInputPrefix\n : ('ame-rg-input-' + nextRadioGroupId++ + '-');\n }\n get classes() {\n const result = ['ame-radio-group-component', ...super.classes];\n if (this.childByValue.size > 0) {\n result.push('ame-rg-has-nested-controls');\n }\n return result;\n }\n // noinspection JSUnusedGlobalSymbols -- Used in the template below.\n getChoiceChild(value) {\n return this.childByValue.get(value) || null;\n }\n // noinspection JSUnusedGlobalSymbols -- Used in the template.\n /**\n * Get the ID attribute for a radio input.\n *\n * Note: This must match the algorithm used by the PHP version of this control\n * to work correctly with the BorderStyleSelector control that adds style samples\n * to each choice and uses the ID to link them to the inputs (so that clicking\n * the sample selects the option).\n */\n getRadioInputId(choice) {\n let sanitizedValue = (choice.value !== null) ? choice.value.toString() : '';\n //Emulate the sanitize_key() function from WordPress core.\n sanitizedValue = sanitizedValue.toLowerCase().replace(/[^a-z0-9_\\-]/gi, '');\n return this.radioInputPrefix + sanitizedValue;\n }\n}\nconst choiceTemplate = `\n\t<label data-bind=\"class: 'ame-rg-option-label',\n\t\tcss: {'ame-rg-has-choice-child' : ($component.getChoiceChild(value) !== null)}\">\n\t\t<input type=\"radio\" data-bind=\"class: $component.inputClassString, \n\t\t\tchecked: $component.valueProxy, checkedValue: value, enable: $component.isEnabled,\n\t\t\tattr: {id: $component.getRadioInputId($data)}\">\n\t\t<span data-bind=\"html: label\"></span>\n\t\t<!-- ko if: description -->\n\t\t\t<!-- ko component: {name: 'ame-nested-description', params: {description: description}} --><!-- /ko -->\n\t\t<!-- /ko -->\n\t</label>\n`;\nexport default createControlComponentConfig(AmeRadioGroup, `\n\t<fieldset data-bind=\"class: classString, enable: isEnabled, style: styles\">\n\t\t<!-- ko foreach: options -->\n\t\t\t<!-- ko if: $component.wrapStyle === 'br' -->\n\t\t\t\t${choiceTemplate} <br>\n\t\t\t<!-- /ko -->\n\t\t\t<!-- ko if: $component.wrapStyle === 'p' -->\n\t\t\t\t<p>${choiceTemplate}</p>\n\t\t\t<!-- /ko -->\n\t\t\t<!-- ko if: $component.wrapStyle === '' -->\n\t\t\t\t${choiceTemplate}\n\t\t\t<!-- /ko -->\n\t\t\t<!-- ko with: $component.getChoiceChild(value) -->\n\t\t\t<span class=\"ame-rg-nested-control\" \n\t\t\t\tdata-bind=\"component: {name: component, params: getComponentParams()}\"></span>\n\t\t\t<!-- /ko -->\n\t\t<!-- /ko -->\n\t</fieldset>\n`);\n//# sourceMappingURL=ame-radio-group.js.map","import { AmeChoiceControl } from '../ame-choice-control/ame-choice-control.js';\nimport { createControlComponentConfig } from '../control-base.js';\nclass AmeSelectBox extends AmeChoiceControl {\n constructor(params, $element) {\n super(params, $element);\n }\n get classes() {\n return ['ame-select-box-control', ...super.classes];\n }\n}\nexport default createControlComponentConfig(AmeSelectBox, `\n\t<select data-bind=\"class: classString, value: valueProxy, options: options,\n\t\toptionsValue: 'value', optionsText: 'label', enable: isEnabled, attr: inputAttributes\"></select>\n\t<!-- ko if: (description) -->\n\t\t<!-- ko component: {name: 'ame-sibling-description', params: {description: description}} --><!-- /ko -->\n\t<!-- /ko -->\t\n`);\n//# sourceMappingURL=ame-select-box.js.map","import { createComponentConfig } from '../control-base.js';\nimport { AmeDescriptionComponent } from '../ame-description/ame-description.js';\n/**\n * A simple component that displays the description of a UI element.\n *\n * This should be rendered as a sibling of the UI element's component,\n * typically immediately after it.\n *\n * Caution: HTML is allowed in the description.\n */\nclass AmeSiblingDescription extends AmeDescriptionComponent {\n}\nexport default createComponentConfig(AmeSiblingDescription, `\n\t<p class=\"description\" data-bind=\"html: description\"></p>\t\n`);\n//# sourceMappingURL=ame-sibling-description.js.map","import { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\nclass AmeStaticHtml extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.containerType = 'span';\n this.htmlContent = (typeof params.html === 'string') ? params.html : '';\n if (typeof params.container === 'string') {\n this.containerType = params.container;\n }\n }\n}\n//Note: The HTML content has to be in a container element because Knockout doesn't allow\n//using the \"html\" binding with virtual elements.\nexport default createControlComponentConfig(AmeStaticHtml, `\n\t<!-- ko if: containerType === 'div' -->\n\t\t<div data-bind=\"html: htmlContent\"></div>\n\t<!-- /ko -->\n\t<!-- ko if: containerType === 'span' -->\n\t\t<span data-bind=\"html: htmlContent\"></span>\n\t<!-- /ko -->\n`);\n//# sourceMappingURL=ame-static-html.js.map","import { createControlComponentConfig, KoDependentControl } from '../control-base.js';\nexport class AmeTextInput extends KoDependentControl {\n constructor(params, $element) {\n super(params, $element);\n this.inputType = 'text';\n this.isCode = params.isCode || false;\n this.inputType = params.inputType || 'text';\n }\n get inputClasses() {\n const classes = ['regular-text'];\n if (this.isCode) {\n classes.push('code');\n }\n classes.push('ame-text-input-control', ...super.inputClasses);\n return classes;\n }\n getAdditionalInputAttributes() {\n return Object.assign({ 'type': this.inputType }, super.getAdditionalInputAttributes());\n }\n}\nexport default createControlComponentConfig(AmeTextInput, `\n\t<input data-bind=\"value: valueProxy, attr: inputAttributes, class: inputClassString\">\n\t<!-- ko if: (description) -->\n\t\t<!-- ko component: {name: 'ame-sibling-description', params: {description: description}} --><!-- /ko -->\n\t<!-- /ko -->\t\n`);\n//# sourceMappingURL=ame-text-input.js.map","import { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\nclass AmeToggleCheckbox extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.onValue = (typeof params.onValue !== 'undefined') ? params.onValue : true;\n this.offValue = (typeof params.offValue !== 'undefined') ? params.offValue : false;\n if (typeof this.settings['value'] === 'undefined') {\n this.isChecked = ko.pureComputed(() => false);\n }\n else {\n this.isChecked = ko.computed({\n read: () => {\n return this.settings.value.value() === ko.unwrap(this.onValue);\n },\n write: (newValue) => {\n this.settings.value.value(ko.unwrap(newValue ? this.onValue : this.offValue));\n },\n deferEvaluation: true\n });\n }\n }\n get classes() {\n return ['ame-toggle-checkbox-control', ...super.classes];\n }\n}\n//Unlike the HTML version of this control, the Knockout version doesn't have\n//a second, hidden checkbox. This is because the component is entirely JS-based\n//and doesn't need to be submitted as part of a form.\nexport default createControlComponentConfig(AmeToggleCheckbox, `\n\t<label data-bind=\"class: classString\">\n\t\t<input type=\"checkbox\" data-bind=\"checked: isChecked, attr: inputAttributes, \n\t\t\tclass: inputClassString, enable: isEnabled\">\n\t\t<span data-bind=\"text: label\"></span>\n\t\t<!-- ko if: (description) -->\n\t\t\t<!-- ko component: {name: 'ame-nested-description', params: {description: description}} --><!-- /ko -->\n\t\t<!-- /ko -->\n\t</label>\t\n`);\n//# sourceMappingURL=ame-toggle-checkbox.js.map","import { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\nexport class AmeUnitDropdown extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.dropdownData = params.optionData || {\n options: [],\n optionsText: 'text',\n optionsValue: 'value'\n };\n this.selectId = params.id || '';\n }\n}\nexport default createControlComponentConfig(AmeUnitDropdown, `\n\t<select data-bind=\"options: dropdownData.options, optionsText: dropdownData.optionsText, \n\t\toptionsValue: dropdownData.optionsValue, value: valueProxy, class: classString,\n\t\tattr: {id: selectId}\"></select>\n`);\n//# sourceMappingURL=ame-unit-dropdown.js.map","'use strict';\nimport { createControlComponentConfig, KoStandaloneControl } from '../control-base.js';\n//Note: Requires Lodash, but does not explicitly import it because this plugin\n//already uses Lodash as a global variable (wsAmeLodash) in many places. Code\n//that uses this component should make sure that Lodash is loaded.\nlet autoAssignedIdCounter = 0;\n/**\n * List of visual editor buttons that are visible in the \"teeny\" mode.\n *\n * Found in /wp-includes/class-wp-editor.php, the editor_settings() method.\n * The relevant code is around line #601 (as of WP 6.1.1).\n */\nconst TeenyButtons = [\n 'bold',\n 'italic',\n 'underline',\n 'blockquote',\n 'strikethrough',\n 'bullist',\n 'numlist',\n 'alignleft',\n 'aligncenter',\n 'alignright',\n 'undo',\n 'redo',\n 'link',\n 'fullscreen'\n];\n/**\n * List of Quicktags editor buttons that are visible by default.\n *\n * The default list of text editor buttons used by wp.editor.initialize()\n * doesn't match the defaults used by wp_editor() in PHP. Let's copy the list\n * from /includes/class-wp-editor.php.\n */\nconst DefaultQuicktagsButtons = [\n 'strong', 'em', 'link', 'block', 'del', 'ins', 'img', 'ul', 'ol', 'li', 'code', 'more', 'close'\n];\nclass AmeWpEditor extends KoStandaloneControl {\n constructor(params, $element) {\n super(params, $element);\n this.editorId = null;\n this.isWpEditorInitialized = false;\n const textSetting = this.settings.value;\n if (typeof textSetting === 'undefined') {\n throw new Error('Visual Editor control is missing the required setting');\n }\n this.rows = params.rows || 6;\n this.isTeeny = !!params.teeny;\n }\n getAdditionalInputAttributes() {\n return Object.assign({ rows: this.rows.toString() }, super.getAdditionalInputAttributes());\n }\n koDescendantsComplete() {\n const $textArea = this.findChild('textarea.ame-wp-editor-textarea');\n if ($textArea.length === 0) {\n return;\n }\n const currentValue = this.valueProxy();\n $textArea.val((currentValue === null) ? '' : currentValue.toString());\n //The textarea must have an ID for wp.editor.initialize() to work.\n {\n let editorId = $textArea.attr('id');\n if (!editorId) {\n editorId = 'ws-ame-wp-editor-aid-' + (autoAssignedIdCounter++);\n $textArea.attr('id', editorId);\n }\n this.editorId = editorId;\n }\n //Update the setting when the contents of the underlying textarea change.\n //This happens when the user selects the \"Text\" tab in the editor, or when\n //TinyMCE is unavailable (e.g. if the \"Disable the visual editor when writing\"\n //option is checked in the user's profile).\n $textArea.on('change input', this.throttleUpdates(() => $textArea.val()));\n let editorSettings = {\n tinymce: {\n wpautop: true\n },\n quicktags: {\n //The default list of text editor buttons used by wp.editor.initialize()\n //doesn't match the defaults used by wp_editor() in PHP. Let's copy the list\n //from /includes/class-wp-editor.php.\n buttons: DefaultQuicktagsButtons.join(','),\n },\n //Include the \"Add Media\" button.\n mediaButtons: true,\n };\n if (typeof window['tinymce'] === 'undefined') {\n //TinyMCE is disabled or not available.\n editorSettings.tinymce = false;\n }\n if (this.isTeeny && (typeof editorSettings.tinymce === 'object')) {\n editorSettings.tinymce.toolbar1 = TeenyButtons.join(',');\n editorSettings.tinymce.toolbar2 = '';\n }\n const $document = jQuery(document);\n const self = this;\n //After the editor finishes initializing, add an event listener to update\n //the setting when the contents of the visual editor change.\n $document.on('tinymce-editor-init', function addMceChangeListener(event, editor) {\n if (editor.id !== self.editorId) {\n return; //Not our editor.\n }\n //According to the TinyMCE documentation, the \"Change\" event is fired\n //when \"changes [...] cause an undo level to be added\". This could be\n //too frequent for our purposes, so we'll throttle the callback.\n editor.on('Change', self.throttleUpdates(() => editor.getContent()));\n $document.off('tinymce-editor-init', addMceChangeListener);\n });\n //Unfortunately, as of WP 6.2-beta, wp.editor.initialize() doesn't add\n //the \"wp-editor-container\" wrapper when only the Quicktags editor is used.\n //This means the editor won't be styled correctly. Let's fix that.\n $document.on('quicktags-init', function maybeAddEditorWrapper(event, editor) {\n if (!editor || (editor.id !== self.editorId)) {\n return;\n }\n if (editor.canvas) {\n const $textarea = jQuery(editor.canvas);\n const $wrapper = $textarea.closest('.wp-editor-container');\n if ($wrapper.length === 0) {\n //Also include the toolbar in the wrapper.\n const $toolbar = $textarea.prevAll('.quicktags-toolbar').first();\n $textarea.add($toolbar).wrapAll('<div class=\"wp-editor-container\"></div>');\n }\n }\n $document.off('quicktags-init', maybeAddEditorWrapper);\n });\n //Finally, initialize the editor.\n wp.editor.initialize($textArea.attr('id'), editorSettings);\n this.isWpEditorInitialized = true;\n }\n /**\n * Create a throttled function that updates the setting.\n *\n * There are multiple ways to get the contents of the editor (e.g. TinyMCE mode\n * vs a plain textarea), so using a utility function helps avoid code duplication.\n *\n * @param valueGetter\n * @protected\n */\n throttleUpdates(valueGetter) {\n const textSetting = this.settings.value;\n return wsAmeLodash.throttle(function () {\n textSetting.value(valueGetter());\n return void 0;\n }, 1000, { leading: true, trailing: true });\n }\n dispose() {\n //Destroy the editor. It's not clear whether this is necessary, but it's\n //probably a good idea to give WP a chance to clean up.\n if (this.isWpEditorInitialized && (this.editorId !== null)) {\n wp.editor.remove(this.editorId);\n this.isWpEditorInitialized = false;\n }\n super.dispose();\n }\n}\n//Note: The class of the textarea element is set directly instead of using a binding\n//because it must always have the \"wp-editor-area\" class for it to render correctly\n//(apparently, wp.editor.initialize() does not automatically add that class).\n//Knockout should not be able to remove the class.\nexport default createControlComponentConfig(AmeWpEditor, `\n\t<textarea data-bind=\"attr: inputAttributes\" class=\"wp-editor-area ame-wp-editor-textarea\" cols=\"40\"></textarea>\t\n`);\n//# sourceMappingURL=ame-wp-editor.js.map","import { AmeCustomizable } from '../assets/customizable.js';\nvar Setting = AmeCustomizable.Setting;\nvar InterfaceStructure = AmeCustomizable.InterfaceStructure;\nvar Control = AmeCustomizable.Control;\nexport class KoComponentViewModel {\n constructor(params, $element) {\n var _a;\n this.params = params;\n this.$element = $element;\n this.isBoundToComment = ($element[0]) && ($element[0].nodeType === Node.COMMENT_NODE);\n this.uiElement = null;\n const expectedType = this.getExpectedUiElementType();\n if (expectedType !== null) {\n if ((typeof params.uiElement !== 'undefined')\n && (params.uiElement instanceof expectedType)) {\n this.uiElement = params.uiElement;\n }\n else {\n throw new Error('uiElement is not a ' + expectedType.name + ' instance.');\n }\n }\n else if ((typeof params.uiElement !== 'undefined') && !(this instanceof KoStandaloneControl)) {\n console.warn('Unexpected \"uiElement\" parameter for ' + this.constructor.name\n + ' that did not expect an UI element. Did you forget to override getExpectedUiElementType() ?', params.uiElement);\n }\n if (typeof params.children !== 'undefined') {\n if (Array.isArray(params.children) || this.isObservableArray(params.children)) {\n this.inputChildren = params.children;\n }\n else {\n throw new Error('Invalid \"children\" parameter: expected an array or an observable array.');\n }\n }\n else {\n this.inputChildren = [];\n }\n this.customClasses = ((typeof params.classes === 'object') && Array.isArray(params.classes)) ? params.classes : [];\n this.customStyles = ((typeof params.styles === 'object') && (params.styles !== null)) ? params.styles : {};\n if (typeof params.enabled !== 'undefined') {\n if (ko.isObservable(params.enabled)) {\n this.isEnabled = params.enabled;\n }\n else {\n this.isEnabled = ko.pureComputed(() => !!params.enabled);\n }\n }\n else {\n this.isEnabled = ko.pureComputed(() => true);\n }\n //Get the description either from the \"description\" parameter or from the UI element.\n this.description = params.description\n ? ko.unwrap(params.description.toString())\n : (((_a = this.uiElement) === null || _a === void 0 ? void 0 : _a.description) || '');\n }\n dispose() {\n //Does nothing by default.\n }\n getExpectedUiElementType() {\n return null;\n }\n get classes() {\n return [].concat(this.customClasses);\n }\n // noinspection JSUnusedGlobalSymbols -- Used in Knockout templates.\n get classString() {\n return this.classes.join(' ');\n }\n get styles() {\n return Object.assign({}, this.customStyles);\n }\n findChild(selector, allowSiblingSearch = null) {\n if (allowSiblingSearch === null) {\n //Enable only if the component is bound to a comment (i.e. \"<!-- ko component: ... -->\").\n allowSiblingSearch = this.isBoundToComment;\n }\n if (this.isBoundToComment) {\n if (allowSiblingSearch) {\n return this.$element.nextAll(selector).first();\n }\n else {\n //We would never find anything because a comment node has no children.\n return jQuery();\n }\n }\n return this.$element.find(selector);\n }\n isObservableArray(value) {\n return (typeof value === 'object')\n && (value !== null)\n && (typeof value.slice === 'function')\n && (typeof value.indexOf === 'function')\n && (ko.isObservable(value));\n }\n}\nfunction makeCreateVmFunctionForComponent(ctor) {\n return function (params, componentInfo) {\n const $element = jQuery(componentInfo.element);\n return new ctor(params, $element);\n };\n}\nexport function createComponentConfig(ctor, templateString) {\n return {\n viewModel: {\n createViewModel: makeCreateVmFunctionForComponent(ctor),\n },\n template: templateString,\n };\n}\n//endregion\n//region Container\nexport class ComponentBindingOptions {\n // noinspection JSUnusedGlobalSymbols -- the uiElement property is used in the KO template of AC control groups.\n constructor(name, params, uiElement) {\n this.name = name;\n this.params = params;\n this.uiElement = uiElement;\n if (name === '') {\n throw new Error('Component name cannot be empty.');\n }\n }\n static fromElement(element, overrideComponentName = null) {\n if (!element.component && (overrideComponentName === null)) {\n throw new Error(`Cannot create component binding options for UI element \"${element.id}\" without a component name.`);\n }\n return new ComponentBindingOptions(overrideComponentName || element.component, element.getComponentParams(), element);\n }\n}\nexport class KoContainerViewModel extends KoComponentViewModel {\n constructor(params, $element) {\n if (typeof params.children === 'undefined') {\n throw new Error('Missing \"children\" parameter.');\n }\n super(params, $element);\n this.title = ko.pureComputed(() => {\n if (typeof params.title !== 'undefined') {\n let title = ko.unwrap(params.title);\n if ((title !== null) && (typeof title !== 'undefined')) {\n return title.toString();\n }\n }\n if (this.uiElement) {\n return this.uiElement.title;\n }\n return '';\n });\n this.childComponents = ko.pureComputed(() => {\n const result = ko.unwrap(this.inputChildren)\n .map(child => this.mapChildToComponentBinding(child))\n .filter(binding => binding !== null);\n //TypeScript does not recognize that the filter() call above removes\n //all null values, so we need an explicit cast.\n return result;\n });\n }\n mapChildToComponentBinding(child) {\n //Does not map any children by default.\n return null;\n }\n dispose() {\n super.dispose();\n this.childComponents.dispose();\n }\n}\n//endregion\n//region Control\nexport class KoControlViewModel extends KoComponentViewModel {\n constructor(params, $element) {\n var _a;\n super(params, $element);\n this.settings =\n ((typeof params.settings === 'object') && isSettingMap(params.settings))\n ? params.settings\n : {};\n if (typeof this.settings.value !== 'undefined') {\n this.valueProxy = this.settings.value.value;\n }\n else {\n this.valueProxy = ko.pureComputed(() => {\n console.error('Missing \"value\" setting for a control component.', this.settings, params);\n return '';\n });\n }\n //Input ID will be provided by the server if applicable.\n this.primaryInputId = (typeof params.primaryInputId === 'string') ? params.primaryInputId : null;\n this.inputAttributes = ko.pureComputed(() => {\n var _a;\n const attributes = ((_a = this.uiElement) === null || _a === void 0 ? void 0 : _a.inputAttributes) || {};\n const inputId = this.getPrimaryInputId();\n if ((inputId !== null) && (inputId !== '')) {\n attributes.id = inputId;\n }\n //Note: The \"name\" field is not used because these controls are entirely JS-driven.\n const additionalAttributes = this.getAdditionalInputAttributes();\n for (const key in additionalAttributes) {\n if (!additionalAttributes.hasOwnProperty(key)) {\n continue;\n }\n attributes[key] = additionalAttributes[key];\n }\n return attributes;\n });\n if ((typeof params.label !== 'undefined') && (params.label !== null)) {\n const unwrappedLabel = ko.unwrap(params.label);\n this.label = (typeof unwrappedLabel === 'undefined') ? '' : unwrappedLabel.toString();\n }\n else {\n this.label = ((_a = this.uiElement) === null || _a === void 0 ? void 0 : _a.label) || '';\n }\n }\n get inputClasses() {\n var _a;\n return ((_a = this.uiElement) === null || _a === void 0 ? void 0 : _a.inputClasses) || [];\n }\n // noinspection JSUnusedGlobalSymbols -- Used in Knockout templates.\n get inputClassString() {\n return this.inputClasses.join(' ');\n }\n getAdditionalInputAttributes() {\n return {};\n }\n getPrimaryInputId() {\n return this.primaryInputId;\n }\n}\nfunction isSettingMap(value) {\n if (value === null) {\n return false;\n }\n if (typeof value !== 'object') {\n return false;\n }\n const valueAsRecord = value;\n for (const key in valueAsRecord) {\n if (!valueAsRecord.hasOwnProperty(key)) {\n continue;\n }\n if (!(valueAsRecord[key] instanceof Setting)) {\n return false;\n }\n }\n return true;\n}\n/**\n * A control that doesn't use or need a UI element instance, but can still have\n * settings and other parameters typically associated with controls.\n */\nexport class KoStandaloneControl extends KoControlViewModel {\n}\n/**\n * A control that requires a UI element of the \"Control\" class.\n */\nexport class KoDependentControl extends KoControlViewModel {\n getExpectedUiElementType() {\n return Control;\n }\n}\nexport function createControlComponentConfig(ctor, templateString) {\n return {\n viewModel: {\n createViewModel: makeCreateVmFunctionForComponent(ctor),\n },\n template: templateString,\n };\n}\n//endregion\n//region Renderer\nexport class KoRendererViewModel extends KoComponentViewModel {\n constructor(params, $element) {\n super(params, $element);\n if ((typeof params.structure !== 'object') || !(params.structure instanceof InterfaceStructure)) {\n throw new Error('Invalid interface structure for a renderer component.');\n }\n this.structure = params.structure;\n }\n}\nexport function createRendererComponentConfig(ctor, templateString) {\n return {\n viewModel: {\n createViewModel: makeCreateVmFunctionForComponent(ctor),\n },\n template: templateString,\n };\n}\n//endregion\n//# sourceMappingURL=control-base.js.map","/// <reference path=\"../../../customizables/assets/popup-slider.d.ts\" />\n/**\n * This is a wrapper for the popup slider that initializes the slider on first use.\n * It's useful for Knockout components.\n */\nexport class LazyPopupSliderAdapter {\n constructor(sliderRanges, containerSelector = '.ame-container-with-popup-slider', inputSelector = 'input', sliderOptions = {}) {\n this.sliderRanges = sliderRanges;\n this.containerSelector = containerSelector;\n this.inputSelector = inputSelector;\n this.sliderOptions = sliderOptions;\n this.slider = null;\n if (!sliderOptions.hasOwnProperty('ranges')) {\n sliderOptions.ranges = sliderRanges;\n }\n this.handleKoClickEvent = ($data, event) => {\n //Verify that this is one of the inputs we're interested in.\n //Also, disabled inputs should not trigger the slider.\n if (event.target === null) {\n return;\n }\n const $input = jQuery(event.target);\n if ($input.is(':disabled') || !$input.is(this.inputSelector)) {\n return;\n }\n //Short-circuit if the slider is already initialized.\n if (this.slider) {\n this.slider.showForInput($input);\n return;\n }\n //Some sanity checks.\n if (typeof AmePopupSlider === 'undefined') {\n return;\n }\n const $container = $input.closest(this.containerSelector);\n if ($container.length < 1) {\n return;\n }\n this.initSlider($container);\n if (this.slider !== null) {\n //TS doesn't realize that this.initSlider() will initialize the slider.\n this.slider.showForInput($input);\n }\n };\n }\n /**\n * Initialize the slider if it's not already initialized.\n */\n initSlider($container) {\n if (this.slider) {\n return;\n }\n //In HTML, we would pass the range data as a \"data-slider-ranges\" attribute,\n //but here they are passed via the \"ranges\" option (see the constructor).\n this.slider = AmePopupSlider.createSlider($container, this.sliderOptions);\n }\n}\n//# sourceMappingURL=lazy-popup-slider-adapter.js.map"],"names":[],"sourceRoot":""}