@mulanjs/mulanjs 1.0.1-dev.20260227175607 → 1.0.1-dev.20260227191521
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler/dom-compiler.js +13 -6
- package/dist/compiler/ssr-compiler.js +13 -3
- package/dist/core/reactive.js +30 -2
- package/dist/index.js +1 -1
- package/dist/mulan.esm.js +102 -7
- package/dist/mulan.esm.js.map +1 -1
- package/dist/mulan.js +104 -8
- package/dist/mulan.js.map +1 -1
- package/dist/security/sanitizer.js +72 -4
- package/dist/types/core/reactive.d.ts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/security/sanitizer.d.ts +17 -0
- package/package.json +1 -1
- package/src/compiler/dom-compiler.ts +13 -6
- package/src/compiler/ssr-compiler.ts +13 -3
package/dist/mulan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mulan.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;ACVa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB,GAAG,mBAAmB;AAC7C,mBAAmB,mBAAO,CAAC,GAAY;AACvC,gBAAgB,mBAAO,CAAC,GAAS;AACjC,mBAAmB,mBAAO,CAAC,GAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4GAA4G,kBAAkB;AAC9H;AACA;AACA;AACA;AACA,qFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,WAAW,GAAG,sBAAsB;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,sBAAsB,cAAc,UAAU;AAC5F;AACA;AACA,8CAA8C,yBAAyB,kBAAkB,UAAU;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,GAAG;AACjC;AACA;AACA,wDAAwD,UAAU;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,UAAU;AACxF;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,iFAAiF,UAAU;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,GAAG;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,GAAG;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA,wBAAwB,oBAAoB;AAC5C;AACA;AACA,2BAA2B,0CAA0C;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,0BAA0B;AACtD;AACA;AACA;AACA;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,uCAAuC,0CAA0C;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,oBAAoB;AAChD;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,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,oCAAoC,UAAU;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;;;;;;;ACvWV;AACb;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA,0CAA0C,4BAA4B;AACtE,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe,GAAG,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,iBAAiB,GAAG,mBAAmB;AACvH,aAAa,mBAAO,CAAC,GAAiB;AACtC,kBAAkB,mBAAO,CAAC,EAAkB;AAC5C,+CAA8C,EAAE,qCAAqC,mCAAmC,EAAC;AACzH,6CAA4C,EAAE,qCAAqC,mCAAmC,EAAC;AACvH,mDAAkD,EAAE,qCAAqC,uCAAuC,EAAC;AACjI,aAAa,mBAAO,CAAC,GAAiB;AACtC,cAAc,mBAAO,CAAC,GAAgB;AACtC,4CAA2C,EAAE,qCAAqC,4BAA4B,EAAC;AAC/G,0CAAyC,EAAE,qCAAqC,4BAA4B,EAAC;AAC7G,cAAc,mBAAO,CAAC,GAAe;AACrC,2CAA0C,EAAE,qCAAqC,2BAA2B,EAAC;AAC7G,aAAa,mBAAO,CAAC,GAAsB;AAC3C,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAAgB;AACrC,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAA2B;AAChD,aAAa,mBAAO,CAAC,GAA4B;AACjD,aAAa,mBAAO,CAAC,GAAY;AACjC;AACA,mBAAmB,mBAAO,CAAC,GAAiB;AAC5C,oBAAoB,mBAAO,CAAC,EAAkB;AAC9C,gBAAgB,mBAAO,CAAC,GAAgB;AACxC,gBAAgB,mBAAO,CAAC,GAAe;AACvC,oBAAoB,mBAAO,CAAC,GAAsB;AAClD,2BAA2B,mBAAO,CAAC,GAAc;AACjD,2BAA2B,mBAAO,CAAC,GAAc;AACjD,mBAAmB,mBAAO,CAAC,GAAiB;AAC5C,6BAA6B,mBAAO,CAAC,GAAgB;AACrD,2BAA2B,mBAAO,CAAC,GAAc;AACjD,kCAAkC,mBAAO,CAAC,GAA4B;AACtE,oGAAoG;AACpG,uOAAuO,qDAAqD;AAC5R;AACA;AACA,qCAAqC,IAAI,oBAAoB,mBAAmB,kBAAkB,kBAAkB,mBAAmB;AACvI,KAAK;AACL,sCAAsC,IAAI,oBAAoB,mBAAmB,kBAAkB,kBAAkB,mBAAmB;AACxI,KAAK;AACL,uCAAuC,IAAI,oBAAoB,mBAAmB,kBAAkB,kBAAkB,mBAAmB;AACzI,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;AC9FF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,sBAAsB,GAAG,kBAAkB,GAAG,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,0BAA0B,GAAG,0BAA0B;AACjb,mBAAmB,mBAAO,CAAC,GAAY;AACvC,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,qBAAqB;AAC3D;AACA,eAAe;AACf;AACA,8CAA8C,kBAAkB;AAChE;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,2BAA2B,sDAAsD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,6BAA6B,0BAA0B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,+EAA+E,cAAc,oCAAoC;AACjI;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,8CAA8C,gBAAgB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,kFAAkF;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,qBAAqB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C,4BAA4B,sBAAsB;AAClD;AACA;AACA,qBAAqB,oDAAoD;AACzE,uBAAuB;AACvB;AACA;AACA,iBAAiB;;;;;;;;AC1YJ;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe,GAAG,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,YAAY,4CAA4C;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD,uDAAuD;AACvD,mCAAmC,oBAAoB,SAAS;AAChE,iCAAiC,mCAAmC,mBAAmB,qBAAqB,IAAI;AAChH,yCAAyC,mBAAmB,gCAAgC,IAAI;AAChG,2BAA2B;AAC3B;AACA,0CAA0C,gCAAgC;AAC1E;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,oCAAoC;AAC5D;AACA,gCAAgC,yBAAyB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iCAAiC;AAClE;AACA,KAAK;AACL;AACA,eAAe;;;;;;;;AC3FF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB,gBAAgB,mBAAO,CAAC,GAAS;AACjC,mBAAmB,mBAAO,CAAC,GAAY;AACvC;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E,IAAI;AAC/E;AACA;AACA;AACA;AACA,6FAA6F,iBAAiB;AAC9G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,IAAI;AACnE;AACA,KAAK;AACL;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,kBAAkB;;;;;;;;AC5DL;AACb;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,WAAW,GAAG,gBAAgB,GAAG,cAAc,GAAG,cAAc,GAAG,gBAAgB,GAAG,mBAAmB;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;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,cAAc;AACd;AACA,4CAA4C;AAC5C;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,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA,iCAAiC;AACjC;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,8FAA8F,aAAa;AAC3G;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;;;;;;;;AC1LE;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,4BAA4B,cAAc;AAC1C;AACA,mBAAmB,kBAAkB,gBAAgB;AACrD,uBAAuB,qBAAqB;AAC5C,0BAA0B,oBAAoB,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,YAAY;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,4BAA4B,YAAY,wBAAwB;AAChE,4BAA4B,aAAa,4BAA4B,MAAM;AAC3E,4CAA4C;AAC5C;AACA,6CAA6C,mBAAmB;AAChE;AACA,iBAAiB;AACjB;AACA,2CAA2C,iBAAiB,IAAI,iBAAiB,IAAI,QAAQ;AAC7F,SAAS;AACT;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;;;;;;;ACnHa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe;AACf,mBAAmB,mBAAO,CAAC,GAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,eAAe;;;;;;;;AC7CF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,gCAAgC;AAChC,gCAAgC;AAChC,kCAAkC;AAClC,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA,oCAAoC,aAAa,YAAY,YAAY,WAAW,mBAAmB,gBAAgB;AACvH;AACA;AACA;AACA;AACA,yDAAyD,GAAG;AAC5D,mBAAmB,IAAI,KAAK,EAAE,IAAI,IAAI;AACtC;AACA,mBAAmB;AACnB,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,gBAAgB;;;;;;;;ACvDH;AACb;AACA,4BAA4B,+DAA+D,iBAAiB;AAC5G;AACA,oCAAoC,MAAM,+BAA+B,YAAY;AACrF,mCAAmC,MAAM,mCAAmC,YAAY;AACxF,gCAAgC;AAChC;AACA,KAAK;AACL;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB,GAAG,gBAAgB;AACvC,mBAAmB,mBAAO,CAAC,GAAkB;AAC7C,oBAAoB,mBAAO,CAAC,GAAuB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,yCAAyC,UAAU;AACnD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,yBAAyB;AACzB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,MAAM;AAChE;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB,gBAAgB,SAAS,GAAG;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,kBAAkB,KAAK,KAAK;AAC5F;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,MAAM;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA,2EAA2E,aAAa;AACxF;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,KAAK;AACrE;AACA;AACA;AACA;AACA;AACA,qEAAqE,KAAK;AAC1E;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;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,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;;;;;;;;AC5Qa;AACb;AACA,4BAA4B,+DAA+D,iBAAiB;AAC5G;AACA,oCAAoC,MAAM,+BAA+B,YAAY;AACrF,mCAAmC,MAAM,mCAAmC,YAAY;AACxF,gCAAgC;AAChC;AACA,KAAK;AACL;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB,GAAG,gBAAgB;AACtC,mBAAmB,mBAAO,CAAC,GAAY;AACvC,uCAAuC,eAAe;AACtD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,qBAAqB,oBAAoB;AACzC,0BAA0B,yBAAyB;AACnD,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA,gBAAgB;AAChB;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,qBAAqB,oBAAoB;AACzC,0BAA0B,yBAAyB;AACnD,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA,mBAAmB;;;;;;;;AC7EN;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,4BAA4B;AAC5B,mBAAmB,mBAAO,CAAC,GAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,cAAc;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,EAAE;AAC1D;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,4BAA4B,iBAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;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,gCAAgC,IAAI,eAAe,MAAM;AACzD;AACA;AACA;AACA;AACA,iDAAiD,OAAO,eAAe,SAAS;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,KAAK;AAClC,8BAA8B,KAAK;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,YAAY,cAAc,WAAW;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wBAAwB;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,2BAA2B,UAAU,WAAW;AAChD,2BAA2B,aAAa,WAAW;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;;;;;;;;ACjQa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gBAAgB,GAAG,eAAe,GAAG,cAAc;AACnD;AACA;AACA;AACA;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,2DAA2D,UAAU;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,GAAG,MAAM,GAAG;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,SAAS;AACT;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,4BAA4B;AAC5B,4BAA4B;AAC5B,8BAA8B;AAC9B,8BAA8B;AAC9B;AACA,gBAAgB;;;;;;;;ACzHH;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,sBAAsB;AACtB;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,qBAAqB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,cAAc,IAAI,sBAAsB;AAC3G,2CAA2C,cAAc,IAAI,KAAK,EAAE,YAAY;AAChF;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;;;;;;;;ACjDT;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gBAAgB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,kBAAkB,GAAG,sBAAsB;AAC3N,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,kCAAkC;AAChF,6CAA6C,kCAAkC;AAC/E;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,YAAY,qBAAqB;AACxF;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,6BAA6B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,yCAAyC;AACzC;AACA;AACA,yCAAyC;AACzC,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,gDAAgD;AAChD;AACA,+BAA+B;AAC/B;AACA,yCAAyC;AACzC;AACA;AACA;AACA,mDAAmD,YAAY,qBAAqB;AACpF;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAW;AAC/B;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA,uCAAuC;AACvC,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,mDAAmD,YAAY,qBAAqB;AACpF;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;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;AACA;AACA;AACA;AACA;AACA,gBAAgB;;;;;;;UCzWhB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://Mulan/webpack/universalModuleDefinition","webpack://Mulan/./src/core/component.ts","webpack://Mulan/./src/index.ts","webpack://Mulan/./src/core/hooks.ts","webpack://Mulan/./src/core/surge.ts","webpack://Mulan/./src/core/vault.ts","webpack://Mulan/./src/core/reactive.ts","webpack://Mulan/./src/components/infinity-list.ts","webpack://Mulan/./src/store/index.ts","webpack://Mulan/./src/security/sanitizer.ts","webpack://Mulan/./src/router/index.ts","webpack://Mulan/./src/core/query.ts","webpack://Mulan/./src/components/bloch-sphere.ts","webpack://Mulan/./src/core/renderer.ts","webpack://Mulan/./src/core/ssr.ts","webpack://Mulan/./src/core/quantum.ts","webpack://Mulan/webpack/bootstrap","webpack://Mulan/webpack/before-startup","webpack://Mulan/webpack/startup","webpack://Mulan/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Mulan\"] = factory();\n\telse\n\t\troot[\"Mulan\"] = factory();\n})(this, () => {\nreturn ","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.defineComponent = exports.MuComponent = void 0;\nconst renderer_1 = require(\"./renderer\");\nconst hooks_1 = require(\"./hooks\");\nconst reactive_1 = require(\"./reactive\");\n// Or a simple component that returns an object of state/methods used by template? \n// For Mulan 2.0, let's say functional component returns a template string render function explicitly.\nclass MuComponent {\n constructor(container) {\n this._hooks = {};\n this._effects = [];\n this._domEffects = [];\n this._isDestroyed = false;\n this._isResuming = false; // Quantum Resumability Flag\n this._resumeRoot = null;\n this._propsQueue = [];\n this._eventQueue = [];\n // --- MulanJS List Reconciliation Engine (No-VDOM) ---\n // Cache to store generated DOM rows by mu-key\n this._listCaches = new Map();\n // --- MulanJS Conditional Engine (No-VDOM) ---\n // Cache to store conditionally toggled blocks\n this._ifCaches = new Map();\n this.container = container;\n this.state = {};\n this.$uid = 'mu_' + Math.random().toString(36).substr(2, 9);\n // MULAN INSIGHT: Quantum Resumability Detection\n if (typeof window !== 'undefined' && container) {\n const rootAttr = container.getAttribute('data-mu-root');\n const stateScript = container.querySelector('script[type=\"mulan/state\"]');\n if (rootAttr || stateScript) {\n console.log(`%c[Mulan Quantum]%c Resuming component from server state...`, \"color: #00ffcc; font-weight: bold;\", \"\");\n this._isResuming = true;\n this.$uid = rootAttr || this.$uid;\n if (stateScript) {\n try {\n const serverState = JSON.parse(stateScript.textContent || '{}');\n // Inject server state into this instance\n Object.assign(this, serverState);\n }\n catch (e) {\n console.error(\"[Mulan Quantum] Failed to parse server state:\", e);\n }\n }\n }\n }\n // MULAN INSIGHT: Global Registry for Debugging\n if (typeof window !== 'undefined') {\n const global = window;\n global.__MULAN_INSIGHT__ = global.__MULAN_INSIGHT__ || { components: new Map() };\n global.__MULAN_INSIGHT__.components.set(this.$uid, this);\n }\n // Setup context for hooks\n (0, hooks_1.setCurrentInstance)(this);\n this.setup();\n (0, hooks_1.setCurrentInstance)(null);\n }\n // Optional setup method for class components wanting to use hooks\n setup() { }\n onMount() {\n var _a, _c;\n // Mulan Cycle: Init\n (_a = this._hooks.onMuInit) === null || _a === void 0 ? void 0 : _a.forEach(fn => fn());\n // Mulan Cycle: Mount (Simulated immediately after init for now in this version)\n (_c = this._hooks.onMuMount) === null || _c === void 0 ? void 0 : _c.forEach(fn => fn());\n }\n onUpdate() { }\n onDestroy() {\n var _a, _c;\n if (this._isDestroyed)\n return;\n this._isDestroyed = true;\n console.log(`[Mulan Cycle] Destroying component ${this.$uid} (${this.constructor.name})`);\n // MULAN INSIGHT: Cleanup\n if (typeof window !== 'undefined') {\n const global = window;\n (_a = global.__MULAN_INSIGHT__) === null || _a === void 0 ? void 0 : _a.components.delete(this.$uid);\n }\n // Mulan Cycle: Stop all effects to prevent leaks\n console.log(`[Mulan Cycle] Stopping ${this._effects.length} effects for ${this.$uid}`);\n this._effects.forEach(stop => stop());\n this._effects = [];\n console.log(`[Mulan Cycle] Stopping ${this._domEffects.length} DOM effects for ${this.$uid}`);\n this._domEffects.forEach(stop => stop());\n this._domEffects = [];\n // Mulan Cycle: Destroy hooks\n (_c = this._hooks.onMuDestroy) === null || _c === void 0 ? void 0 : _c.forEach(fn => fn());\n }\n // Helper for compiler to register property bindings\n _b(id, prop, value) {\n this._propsQueue.push([id, prop, value]);\n return \"\";\n }\n // Helper for compiler to register event bindings\n _e(id, type, handler) {\n this._eventQueue.push([id, type, handler]);\n return \"\";\n }\n // Manual binding helper for template literals\n bind(handler, type = 'click') {\n const id = 'ev_' + Math.random().toString(36).substr(2, 9);\n this._e(id, type, handler);\n return `data-mu-id=\"${id}\"`;\n }\n mount() {\n console.log(`[Mulan Cycle] Mounting component ${this.$uid}`);\n if (this._isResuming) {\n // Quantum Resumability: Skip initial render, just attach effects to existing DOM\n console.log(`[Mulan Quantum] Skipping initial render, recovering DOM nodes...`);\n this._resume();\n }\n else {\n // Standard Hydration/Mount\n const stop = (0, reactive_1.effect)(() => {\n console.log(`[Mulan Reactivity] Triggering macro-update for ${this.$uid}`);\n this.update();\n });\n this._effects.push(stop);\n }\n this.onMount();\n }\n /**\n * Internal method to execute the resumability pass.\n * Overridden by compiler-generated code.\n */\n _resume() {\n // Clear queues\n this._propsQueue = [];\n this._eventQueue = [];\n // Call the template with resumption context\n // In a real implementation, the compiler will inject 'recovery' instructions\n this._recoveryMode = true;\n this.template();\n this._recoveryMode = false;\n // Flush bindings (events/props) to existing nodes\n this.flushProps();\n this.flushEvents();\n }\n // New helper for the compiler to register a fine-grained DOM property effect\n _bindEffect(fn, targetNode) {\n const stop = (0, reactive_1.effect)(fn, targetNode);\n this._domEffects.push(stop);\n return stop;\n }\n update() {\n if (this._isDestroyed) {\n console.warn(`[Mulan Warning] Update called on destroyed component ${this.$uid}. Blocking render.`);\n return;\n }\n // Clear queues before render\n this._propsQueue = [];\n this._eventQueue = [];\n const template = this.template();\n // Render HTML\n (0, renderer_1.render)(template, this.container);\n // Flush Side Effects\n this.flushProps();\n this.flushEvents();\n this.onUpdate();\n }\n flushProps() {\n for (const [id, prop, value] of this._propsQueue) {\n const el = this.container.querySelector(`[data-mu-id=\"${id}\"]`);\n if (el) {\n // @ts-ignore\n el[prop] = value;\n }\n }\n this._propsQueue = [];\n }\n flushEvents() {\n for (const [id, type, handler] of this._eventQueue) {\n const el = this.container.querySelector(`[data-mu-id=\"${id}\"]`);\n if (el) {\n // Bind handler to this component instance to ensure 'this' works in methods\n el.addEventListener(type, handler.bind(this));\n }\n }\n this._eventQueue = [];\n }\n /**\n * Reconciles a list of bound data to an existing DOM parent segment.\n * @param listId Unique ID for this specific mu-for directive Block\n * @param container The DOM Element or Fragment where children are attached\n * @param array The current state array\n * @param keyProp The property to extract from each item to use as a unique key (e.g. 'id')\n * @param renderRow A function that takes an item and returns a new { fragment, effects }\n */\n _reconcileList(listId, anchorToken, array, keyProp, renderRow) {\n if (!this._listCaches.has(listId)) {\n this._listCaches.set(listId, new Map());\n }\n const cache = this._listCaches.get(listId);\n const newKeys = new Set();\n const parent = anchorToken.parentNode;\n if (!parent)\n return;\n // 1. Array Iteration: Match against cache or Create\n // Use a DocumentFragment to batch new node insertions natively\n const collectorFrag = document.createDocumentFragment();\n const newOrderNodes = [];\n const newOrderKeys = [];\n let requiresSwap = false;\n let lastCachedIndex = -1;\n for (let i = 0; i < array.length; i++) {\n const item = array[i];\n const key = keyProp ? item[keyProp] : i; // fallback to index if no key\n newKeys.add(key);\n newOrderKeys.push(key);\n let cached = cache.get(key);\n if (!cached) {\n // Not in cache, Render a brand new row structure\n const { fragment, effects } = renderRow(item, i);\n // Track actual DOM nodes\n const createdNodes = Array.from(fragment.childNodes);\n cached = { nodes: createdNodes, effects, index: i }; // Store index for fast swap detection\n cache.set(key, cached);\n // Batch append to our in-memory fragment!\n // This eliminates thousands of live DOM reflows on creation.\n collectorFrag.appendChild(fragment);\n newOrderNodes.push(...createdNodes);\n }\n else {\n // Exists in cache\n // Batch append to the in-memory array for index tracking\n newOrderNodes.push(...cached.nodes);\n // Fast-Path Swap Detection: If the cached index is physically out of numerical sequence,\n // we know the array order was unsynchronized and needs reconciliation.\n if (cached.index < lastCachedIndex) {\n requiresSwap = true;\n }\n cached.index = i;\n lastCachedIndex = i;\n }\n }\n // 2. Fragment Batch Insertion (O(1) Live DOM Reflow for Creations)\n if (collectorFrag.childNodes.length > 0) {\n parent.insertBefore(collectorFrag, anchorToken.nextSibling);\n }\n // 3. Bidirectional Swap Sync (O(K) isolated shifts instead of O(N) cascades)\n if (requiresSwap) {\n let currentSibling = anchorToken.nextSibling;\n // We iterate through our guaranteed physical newOrderNodes list\n for (let j = 0; j < newOrderNodes.length; j++) {\n const targetNode = newOrderNodes[j];\n if (targetNode !== currentSibling) {\n // The physical live DOM is out of sync. Move targetNode to where it belongs immediately.\n parent.insertBefore(targetNode, currentSibling);\n }\n else {\n // Node is correctly positioned, simply advance the sliding logical pointer\n currentSibling = currentSibling.nextSibling;\n }\n }\n }\n // 4. Cleanup Phase: Rapidly detach unmounted nodes\n if (cache.size > newKeys.size) {\n for (const [key, cached] of cache.entries()) {\n if (!newKeys.has(key)) {\n // Remove from DOM\n cached.nodes.forEach((node) => {\n if (node.parentNode === parent) {\n parent.removeChild(node);\n }\n });\n // Stop any targeted effects tied to these nodes\n cached.effects.forEach((stop) => stop());\n // Delete from cache tracking\n cache.delete(key);\n }\n }\n }\n }\n /**\n * Reconciles a conditional block (mu-if) to an existing DOM parent segment.\n */\n _reconcileIf(ifId, anchorToken, condition, renderBlock) {\n if (!this._ifCaches.has(ifId)) {\n this._ifCaches.set(ifId, { isMounted: false, nodes: [], effects: [] });\n }\n let cached = this._ifCaches.get(ifId);\n if (condition) {\n // Should be mounted\n if (!cached.isMounted) {\n // We need to render and mount it\n let nodesToMount;\n if (cached.nodes.length === 0) {\n // First time render\n const { fragment, effects } = renderBlock();\n nodesToMount = Array.from(fragment.childNodes);\n cached.nodes = nodesToMount;\n cached.effects = effects;\n }\n else {\n // Re-mounting previously cached nodes\n nodesToMount = cached.nodes;\n }\n cached.isMounted = true;\n const parent = anchorToken.parentNode;\n if (!parent)\n return;\n const targetSibling = anchorToken.nextSibling;\n nodesToMount.forEach(node => {\n parent.insertBefore(node, targetSibling);\n });\n }\n }\n else {\n // Should NOT be mounted\n if (cached.isMounted) {\n // Unmount nodes but keep them in cache\n cached.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n cached.isMounted = false;\n // Note: We deliberately do NOT destroy the effects here, they stay active in memory!\n }\n }\n }\n}\nexports.MuComponent = MuComponent;\n// Helper to create functional components wrapped in the class system\n// Helper to create functional components wrapped in the class system\n// Supports both () => render and { setup() } signatures\nfunction defineComponent(optionsOrSetup) {\n return class UniversalComponent extends MuComponent {\n constructor(container) {\n super(container);\n // setup() is called by super constructor\n }\n setup() {\n let setupResult;\n if (typeof optionsOrSetup === 'function') {\n // It's a setup function returning render fn\n setupResult = optionsOrSetup.call(this);\n }\n else if (typeof optionsOrSetup === 'object' && optionsOrSetup.setup) {\n // It's an options object with setup()\n setupResult = optionsOrSetup.setup.call(this);\n }\n // Handle result\n if (typeof setupResult === 'function') {\n // It's a render function\n this.template = setupResult;\n }\n else if (setupResult && typeof setupResult === 'object') {\n // It's bindings\n Object.assign(this, setupResult);\n // We assume template is assigned to prototype by compiler\n }\n }\n template() {\n return '';\n }\n };\n}\nexports.defineComponent = defineComponent;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuStore = exports.Router = exports.MuRouter = exports.defineComponent = exports.Component = exports.MuComponent = void 0;\n__exportStar(require(\"./core/reactive\"), exports);\nvar component_1 = require(\"./core/component\");\nObject.defineProperty(exports, \"MuComponent\", { enumerable: true, get: function () { return component_1.MuComponent; } });\nObject.defineProperty(exports, \"Component\", { enumerable: true, get: function () { return component_1.MuComponent; } });\nObject.defineProperty(exports, \"defineComponent\", { enumerable: true, get: function () { return component_1.defineComponent; } });\n__exportStar(require(\"./core/renderer\"), exports);\nvar index_1 = require(\"./router/index\");\nObject.defineProperty(exports, \"MuRouter\", { enumerable: true, get: function () { return index_1.MuRouter; } });\nObject.defineProperty(exports, \"Router\", { enumerable: true, get: function () { return index_1.MuRouter; } });\nvar index_2 = require(\"./store/index\");\nObject.defineProperty(exports, \"MuStore\", { enumerable: true, get: function () { return index_2.MuStore; } });\n__exportStar(require(\"./security/sanitizer\"), exports);\n__exportStar(require(\"./core/hooks\"), exports);\n__exportStar(require(\"./core/query\"), exports);\n__exportStar(require(\"./core/vault\"), exports);\n__exportStar(require(\"./core/quantum\"), exports);\n__exportStar(require(\"./core/surge\"), exports);\n__exportStar(require(\"./components/bloch-sphere\"), exports);\n__exportStar(require(\"./components/infinity-list\"), exports);\n__exportStar(require(\"./core/ssr\"), exports);\n// Global Mulan Object for non-module usage\nconst reactive_1 = require(\"./core/reactive\");\nconst component_2 = require(\"./core/component\");\nconst index_3 = require(\"./router/index\");\nconst index_4 = require(\"./store/index\");\nconst sanitizer_1 = require(\"./security/sanitizer\");\nconst Hooks = __importStar(require(\"./core/hooks\"));\nconst Query = __importStar(require(\"./core/query\"));\nconst renderer_1 = require(\"./core/renderer\");\nconst Quantum = __importStar(require(\"./core/quantum\"));\nconst Surge = __importStar(require(\"./core/surge\"));\nconst InfinityList = __importStar(require(\"./components/infinity-list\"));\nconst Mulan = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ reactive: reactive_1.reactive,\n effect: reactive_1.effect, Component: component_2.MuComponent, defineComponent: component_2.defineComponent, Router: index_3.MuRouter, createRouter: index_3.createRouter, Store: index_4.MuStore, Security: sanitizer_1.Security }, Hooks), Query), Quantum), Surge), InfinityList), { render: renderer_1.render, \n // MULAN INSIGHT: Branded Logging\n log: (msg, ...args) => {\n console.log(`%c[MulanJS]%c ${msg}`, \"color: #ff3e00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;\", \"\", ...args);\n }, warn: (msg, ...args) => {\n console.warn(`%c[MulanJS]%c ${msg}`, \"color: #ffcc00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;\", \"\", ...args);\n }, error: (msg, ...args) => {\n console.error(`%c[MulanJS]%c ${msg}`, \"color: #ff0000; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;\", \"\", ...args);\n } });\n// Security: Freeze the object to prevent runtime tampering\nObject.freeze(Mulan);\nObject.freeze(Mulan.Security);\n// MULAN INSIGHT: Initialize Global Registry\nif (typeof window !== 'undefined') {\n window.__MULAN_INSIGHT__ = window.__MULAN_INSIGHT__ || { components: new Map() };\n // MULAN INSIGHT: HMR Support\n window.__MULAN_REFRESH__ = () => {\n var _a;\n const components = (_a = window.__MULAN_INSIGHT__) === null || _a === void 0 ? void 0 : _a.components;\n if (components) {\n components.forEach((comp) => {\n if (comp && typeof comp.update === 'function') {\n // Force refresh\n comp.update();\n }\n });\n }\n };\n}\nif (typeof window !== 'undefined') {\n window.Mulan = Mulan;\n}\nexports.default = Mulan;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.muHistory = exports.onMuPanic = exports.muThrottled = exports.muDebounced = exports.onMuVisibility = exports.muSuspense = exports.muVault = exports.muPulse = exports.muGeom = exports.onMuVoice = exports.onMuShake = exports.onMuResume = exports.onMuIdle = exports.onMuDestroy = exports.onMuMount = exports.onMuInit = exports.muEffect = exports.muMemo = exports.muState = exports.getCurrentInstance = exports.setCurrentInstance = void 0;\nconst reactive_1 = require(\"./reactive\");\nconst vault_1 = require(\"./vault\");\n// Global context to track the current component instance\nlet currentInstance = null;\nfunction setCurrentInstance(instance) {\n currentInstance = instance;\n}\nexports.setCurrentInstance = setCurrentInstance;\nfunction getCurrentInstance() {\n return currentInstance;\n}\nexports.getCurrentInstance = getCurrentInstance;\n// --- Mulan Unique Reactivity Hooks ---\nfunction muState(initialValue) {\n if (typeof initialValue === 'object' && initialValue !== null) {\n return (0, reactive_1.reactive)(initialValue);\n }\n // Core reactive state container for primitives\n return (0, reactive_1.reactive)({ value: initialValue });\n}\nexports.muState = muState;\nfunction muMemo(computeFn) {\n const signal = (0, reactive_1.reactive)({ value: undefined });\n const stop = (0, reactive_1.effect)(() => {\n signal.value = computeFn();\n });\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._effects)\n instance._effects = [];\n instance._effects.push(stop);\n }\n return signal;\n}\nexports.muMemo = muMemo;\nfunction muEffect(fn) {\n const stop = (0, reactive_1.effect)(fn);\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._effects)\n instance._effects = [];\n instance._effects.push(stop);\n }\n}\nexports.muEffect = muEffect;\n// --- The \"Mulan Cycle\" (Lifecycle) ---\nfunction onMuInit(fn) {\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._hooks)\n instance._hooks = {};\n if (!instance._hooks.onMuInit)\n instance._hooks.onMuInit = [];\n instance._hooks.onMuInit.push(fn);\n }\n else {\n console.warn('onMuInit called outside of component setup context.');\n }\n}\nexports.onMuInit = onMuInit;\nfunction onMuMount(fn) {\n // New hook for when component is actually in DOM (simulated for now via update)\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._hooks)\n instance._hooks = {};\n if (!instance._hooks.onMuMount)\n instance._hooks.onMuMount = [];\n instance._hooks.onMuMount.push(fn);\n }\n}\nexports.onMuMount = onMuMount;\nfunction onMuDestroy(fn) {\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._hooks)\n instance._hooks = {};\n if (!instance._hooks.onMuDestroy)\n instance._hooks.onMuDestroy = [];\n instance._hooks.onMuDestroy.push(fn);\n }\n}\nexports.onMuDestroy = onMuDestroy;\n/**\n * onMuIdle - The \"Environment Life\" Hook.\n * Executes heavy logic ONLY when the browser is taking a nap (idle).\n */\nfunction onMuIdle(fn) {\n const instance = getCurrentInstance();\n // Polyfill for Safari/Old Browsers\n const requestIdleCallback = window.requestIdleCallback || function (cb) {\n return setTimeout(() => {\n cb({\n didTimeout: false,\n timeRemaining: function () { return 50; }\n });\n }, 1);\n };\n const cancelIdleCallback = window.cancelIdleCallback || function (id) {\n clearTimeout(id);\n };\n const idleId = requestIdleCallback(() => {\n fn();\n });\n // Auto-cleanup if component dies before idle time\n if (instance) {\n onMuDestroy(() => {\n cancelIdleCallback(idleId);\n });\n }\n}\nexports.onMuIdle = onMuIdle;\n/**\n * onMuResume - The \"Tab Life\" Hook.\n * Executes when the user switches BACK to this tab.\n * Perfect for refreshing data or resuming animations to save battery.\n */\nfunction onMuResume(fn) {\n const handler = () => {\n if (document.visibilityState === 'visible') {\n fn();\n }\n };\n document.addEventListener('visibilitychange', handler);\n onMuDestroy(() => document.removeEventListener('visibilitychange', handler));\n}\nexports.onMuResume = onMuResume;\n/**\n * onMuShake - The \"Physical Life\" Hook.\n * Executes when the device is shaken.\n * Usage: Undo, Refresh, or \"Rage Quit\" easter eggs.\n */\nfunction onMuShake(fn) {\n // Threshold for shake detection\n const threshold = 15;\n let lastX = 0, lastY = 0, lastZ = 0;\n let lastTime = 0;\n const handler = (e) => {\n const current = e.accelerationIncludingGravity;\n if (!current)\n return;\n const time = Date.now();\n if ((time - lastTime) > 100) {\n const diffTime = time - lastTime;\n lastTime = time;\n const x = current.x || 0;\n const y = current.y || 0;\n const z = current.z || 0;\n const speed = Math.abs(x + y + z - lastX - lastY - lastZ) / diffTime * 10000;\n if (speed > threshold) {\n fn();\n }\n lastX = x;\n lastY = y;\n lastZ = z;\n }\n };\n if (window.DeviceMotionEvent) {\n window.addEventListener('devicemotion', handler);\n onMuDestroy(() => window.removeEventListener('devicemotion', handler));\n }\n else {\n console.warn(\"[MulanJS] Device Motion not supported on this device.\");\n }\n}\nexports.onMuShake = onMuShake;\n/**\n * onMuVoice - The \"Sound Life\" Hook.\n * Executes when a specific word is spoken.\n * @param command The word to listen for (e.g., \"save\", \"next\")\n * @param fn The action to take\n */\nfunction onMuVoice(command, fn) {\n const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\n if (!SpeechRecognition) {\n console.warn(\"[MulanJS] Voice Control (Web Speech API) not supported in this browser.\");\n return;\n }\n const recognition = new SpeechRecognition();\n recognition.continuous = true;\n recognition.lang = 'en-US';\n recognition.interimResults = false;\n recognition.onresult = (event) => {\n const last = event.results.length - 1;\n const spoken = event.results[last][0].transcript.trim().toLowerCase();\n console.log(`[Mulan Voice] Heard: \"${spoken}\"`);\n if (spoken.includes(command.toLowerCase())) {\n fn();\n }\n };\n recognition.start();\n // Auto-restart if it stops (Continuous listening)\n recognition.onend = () => {\n // Simple check to see if we should still be listening\n // In a real app we might want more control\n // recognition.start(); \n };\n onMuDestroy(() => {\n recognition.stop();\n });\n}\nexports.onMuVoice = onMuVoice;\n// --- \"Outside The Box\" Hooks (Mulan Exclusives) ---\n/**\n * muGeom - Tracks window or element dimensions reactively.\n */\nfunction muGeom() {\n const dims = muState({ width: window.innerWidth, height: window.innerHeight });\n const handler = () => {\n dims.width = window.innerWidth;\n dims.height = window.innerHeight;\n };\n window.addEventListener('resize', handler);\n // Auto-cleanup\n onMuDestroy(() => {\n window.removeEventListener('resize', handler);\n });\n return dims;\n}\nexports.muGeom = muGeom;\n/**\n * muPulse - Reactive network status.\n */\nfunction muPulse() {\n const status = muState({ online: navigator.onLine });\n const setOnline = () => status.online = true;\n const setOffline = () => status.online = false;\n window.addEventListener('online', setOnline);\n window.addEventListener('offline', setOffline);\n onMuDestroy(() => {\n window.removeEventListener('online', setOnline);\n window.removeEventListener('offline', setOffline);\n });\n return status;\n}\nexports.muPulse = muPulse;\n/**\n * muVault - Secure reactive LocalStorage wrapper.\n * Powered by the Iron Fortress persistent primitive.\n */\nfunction muVault(key, initial, options = {}) {\n return (0, vault_1.persistent)(key, initial, Object.assign(Object.assign({}, options), { onCleanup: (fn) => onMuDestroy(fn) }));\n}\nexports.muVault = muVault;\n// --- Next-Gen MulanJS Hooks ---\n/**\n * muSuspense - The Asynchronous Barrier.\n * Natively handles async state (loading/data/error) without wrapper components.\n */\nfunction muSuspense(promiseFn) {\n const state = muState({\n loading: true,\n data: null,\n error: null\n });\n // Execute immediately safely\n promiseFn()\n .then(res => {\n state.data = res;\n state.loading = false;\n })\n .catch(err => {\n state.error = err;\n state.loading = false;\n });\n return state;\n}\nexports.muSuspense = muSuspense;\n/**\n * onMuVisibility - The Intersection Observer Hook.\n * Triggers when the component enters/leaves the viewport.\n */\nfunction onMuVisibility(callback, options = { threshold: 0.1 }) {\n const instance = getCurrentInstance();\n // We defer observation to mount phase to ensure DOM exists\n onMuMount(() => {\n if (!instance || !instance.container)\n return;\n const observer = new IntersectionObserver((entries) => {\n entries.forEach(entry => {\n callback(entry.isIntersecting);\n });\n }, options);\n observer.observe(instance.container);\n onMuDestroy(() => {\n observer.disconnect();\n });\n });\n}\nexports.onMuVisibility = onMuVisibility;\n/**\n * muDebounced - High-performance debouncing built directly into a reactive signal.\n */\nfunction muDebounced(initialValue, delayMs) {\n const state = muState(initialValue);\n let timeoutId;\n return {\n get value() {\n return state.value;\n },\n set value(newVal) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n state.value = newVal;\n }, delayMs);\n }\n };\n}\nexports.muDebounced = muDebounced;\n/**\n * muThrottled - High-performance throttling built directly into a reactive signal.\n */\nfunction muThrottled(initialValue, delayMs) {\n const state = muState(initialValue);\n let lastRan = 0;\n return {\n get value() {\n return state.value;\n },\n set value(newVal) {\n const now = Date.now();\n if (now - lastRan >= delayMs) {\n state.value = newVal;\n lastRan = now;\n }\n }\n };\n}\nexports.muThrottled = muThrottled;\n/**\n * onMuPanic - The Iron Fortress Error Boundary.\n * Catches unhandled exceptions within the component scope.\n */\nfunction onMuPanic(fallbackFn) {\n const instance = getCurrentInstance();\n const handler = (event) => {\n // Broad catch - in a full implementation, we'd inspect the stack trace \n // to isolate if it originated from `instance` specifically.\n // For Mulan 2.0 MVP, we execute the fallback.\n const error = event instanceof ErrorEvent ? event.error : event.reason;\n console.error(`[Iron Fortress] Component ${(instance === null || instance === void 0 ? void 0 : instance.$uid) || 'Unknown'} Panic:`, error);\n fallbackFn(error);\n // Prevent default browser crash if handled\n event.preventDefault();\n };\n window.addEventListener('error', handler);\n window.addEventListener('unhandledrejection', handler);\n onMuDestroy(() => {\n window.removeEventListener('error', handler);\n window.removeEventListener('unhandledrejection', handler);\n });\n}\nexports.onMuPanic = onMuPanic;\n/**\n * muHistory - State with built-in Undo/Redo tracking.\n */\nfunction muHistory(initialValue) {\n const state = muState(initialValue);\n // Explicit wrapper object because muState treats bare arrays dynamically\n const historyTracker = muState({ log: [initialValue] });\n const pointer = muState(0);\n const updateValue = (newVal) => {\n // If we are back in history and make a NEW change, we drop the 'future'\n if (pointer.value < historyTracker.log.length - 1) {\n historyTracker.log = historyTracker.log.slice(0, pointer.value + 1);\n }\n historyTracker.log.push(newVal);\n pointer.value = historyTracker.log.length - 1;\n state.value = newVal;\n };\n const undo = () => {\n if (pointer.value > 0) {\n pointer.value--;\n state.value = historyTracker.log[pointer.value];\n }\n };\n const redo = () => {\n if (pointer.value < historyTracker.log.length - 1) {\n pointer.value++;\n state.value = historyTracker.log[pointer.value];\n }\n };\n return {\n get value() { return state.value; },\n set value(newVal) { updateValue(newVal); },\n undo,\n redo,\n get past() { return historyTracker.log.slice(0, pointer.value); },\n get future() { return historyTracker.log.slice(pointer.value + 1); }\n };\n}\nexports.muHistory = muHistory;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.muSurge = exports.muBurst = void 0;\n/**\n * muBurst - Adaptive Non-blocking Iterator\n * Processes large arrays in batches within a frame budget (typically 8-16ms)\n * to keep the UI responsive while executing at near-native loop speeds.\n */\nfunction muBurst(array, callback, options = {}) {\n const { chunkSize = 1000, timeout = 8, onProgress } = options;\n return new Promise((resolve) => {\n let index = 0;\n const total = array.length;\n function process() {\n const start = performance.now();\n // Tight loop for high-speed processing\n while (index < total && (performance.now() - start) < timeout) {\n // Process in smaller bursts to allow more frequent time checks if needed\n const endBurst = Math.min(index + chunkSize, total);\n for (; index < endBurst; index++) {\n callback(array[index], index);\n }\n }\n if (onProgress) {\n onProgress((index / total) * 100);\n }\n if (index < total) {\n requestAnimationFrame(process);\n }\n else {\n resolve();\n }\n }\n process();\n });\n}\nexports.muBurst = muBurst;\n/**\n * muSurge - Truly Parallel Execution\n * Distributes work across CPU cores using Web Workers.\n * Logic must be serializable.\n */\nfunction muSurge(array, taskFn, onProgress) {\n const n = navigator.hardwareConcurrency || 4;\n const chunkSize = Math.ceil(array.length / n);\n const results = new Array(array.length);\n let completedChunks = 0;\n let completedItems = 0;\n // Convert function to string if it isn't already\n const fnStr = typeof taskFn === 'function' ? taskFn.toString() : taskFn;\n const workerPart1 = `const taskFn = ${fnStr};`;\n const workerPart2 = `self.onmessage = function(e) {`;\n const workerPart3 = ` const { chunk, startIndex } = e.data;`;\n const workerPart4 = ` try { const results = chunk.map(taskFn); self.postMessage({ results, startIndex }); }`;\n const workerPart5 = ` catch (err) { self.postMessage({ error: err.message, startIndex }); }`;\n const workerPart6 = `};`;\n const workerCode = [workerPart1, workerPart2, workerPart3, workerPart4, workerPart5, workerPart6].join('\\n');\n const blob = new Blob([workerCode], { type: 'application/javascript' });\n const workerUrl = URL.createObjectURL(blob);\n return new Promise((resolve) => {\n if (array.length === 0)\n return resolve([]);\n for (let i = 0; i < n; i++) {\n const start = i * chunkSize;\n const end = Math.min(start + chunkSize, array.length);\n if (start >= end) {\n completedChunks++;\n continue;\n }\n const chunk = array.slice(start, end);\n const worker = new Worker(workerUrl);\n worker.onmessage = (e) => {\n const { results: chunkResults, startIndex } = e.data;\n // Merge results back into main array\n for (let j = 0; j < chunkResults.length; j++) {\n results[startIndex + j] = chunkResults[j];\n }\n completedChunks++;\n completedItems += chunkResults.length;\n if (onProgress)\n onProgress((completedItems / array.length) * 100);\n worker.terminate();\n if (completedChunks === n) {\n URL.revokeObjectURL(workerUrl);\n resolve(results);\n }\n };\n worker.postMessage({ chunk, startIndex: start, fnStr });\n }\n });\n}\nexports.muSurge = muSurge;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.persistent = void 0;\nconst hooks_1 = require(\"./hooks\");\nconst reactive_1 = require(\"./reactive\");\n/**\n * Mulan Vault: The World's First Native Persistent State Primitive.\n */\nfunction persistent(key, initialValue, options = {}) {\n const storage = options.storage || window.localStorage;\n // 1. Load from Storage\n const stored = storage.getItem(key);\n let startVal = initialValue;\n if (stored) {\n try {\n startVal = JSON.parse(stored);\n }\n catch (e) {\n console.warn(`[Mulan Vault] Corrupt persistent data for key \"${key}\", resetting.`);\n }\n }\n // 2. Create Reactive State (Follow muState pattern for consistency)\n const isObject = typeof startVal === 'object' && startVal !== null;\n const state = isObject ? (0, reactive_1.reactive)(startVal) : (0, reactive_1.reactive)({ value: startVal });\n // 3. Auto-Save on Change\n (0, hooks_1.muEffect)(() => {\n try {\n const payload = isObject ? state : state.value;\n const toSave = JSON.stringify(payload);\n // Non-obfuscated persistence to satisfy security audits\n storage.setItem(key, toSave);\n }\n catch (e) {\n console.error(`[Mulan Vault] Failed to save key \"${key}\"`);\n }\n });\n // 4. Sync across Tabs\n const sync = (e) => {\n if (e.key === key && e.newValue) {\n try {\n const newVal = JSON.parse(e.newValue);\n if (isObject) {\n Object.assign(state, newVal);\n }\n else {\n state.value = newVal;\n }\n }\n catch (e) { }\n }\n };\n window.addEventListener('storage', sync);\n // Explicit cleanup if provided by the environment (e.g. Mulan Hooks)\n if (options.onCleanup) {\n options.onCleanup(() => {\n window.removeEventListener('storage', sync);\n });\n }\n return state;\n}\nexports.persistent = persistent;\n","\"use strict\";\n// MulanJS 2.0: Signal-Powered Reactivity Engine\n// \"Compatible Surface, World-Class Engine\"\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ref = exports.reactive = exports.effect = exports.Signal = exports.nextTick = exports.queueEffect = void 0;\nlet activeEffect = null;\nlet activeEffectRunner = null;\nconst targetMap = new WeakMap();\n// --- Mulan Quantum Scheduler (Time-Slicing) ---\n// Assign unique IDs to effects for basic topological sorting (lower IDs run first)\nlet effectIdCounter = 0;\nconst pendingEffects = new Set();\nlet isScheduling = false;\nconst TIME_BUDGET = 8; // 8ms frame budget for 60FPS lock\nfunction runScheduler() {\n if (pendingEffects.size === 0) {\n isScheduling = false;\n return;\n }\n const start = typeof performance !== 'undefined' ? performance.now() : Date.now();\n // Convert to array and sort to ensure parent effects run before children (Topological Push-Pull approximation)\n const sortedEffects = Array.from(pendingEffects).sort((a, b) => {\n return (a._id || 0) - (b._id || 0);\n });\n for (const fn of sortedEffects) {\n pendingEffects.delete(fn);\n fn();\n const now = typeof performance !== 'undefined' ? performance.now() : Date.now();\n if (now - start > TIME_BUDGET) {\n break; // Yield to browser\n }\n }\n if (pendingEffects.size > 0) {\n if (typeof MessageChannel !== 'undefined') {\n const channel = new MessageChannel();\n channel.port1.onmessage = runScheduler;\n channel.port2.postMessage(null);\n }\n else {\n setTimeout(runScheduler, 0);\n }\n }\n else {\n isScheduling = false;\n }\n}\nfunction queueEffect(fn) {\n pendingEffects.add(fn);\n if (!isScheduling) {\n isScheduling = true;\n if (typeof Promise !== 'undefined') {\n Promise.resolve().then(runScheduler);\n }\n else {\n setTimeout(runScheduler, 0);\n }\n }\n}\nexports.queueEffect = queueEffect;\nfunction nextTick() {\n return Promise.resolve();\n}\nexports.nextTick = nextTick;\n// --- Signal Core (The Engine) ---\nclass Signal {\n constructor(initialValue) {\n this._subscribers = new Set();\n this._value = initialValue;\n }\n get value() {\n if (activeEffectRunner) {\n this._subscribers.add(activeEffectRunner.run);\n }\n return this._value;\n }\n set value(newValue) {\n if (newValue !== this._value) {\n this._value = newValue;\n this.notify();\n }\n }\n notify() {\n this._subscribers.forEach(fn => {\n if (fn._sync) {\n fn();\n }\n else {\n queueEffect(fn);\n }\n });\n }\n}\nexports.Signal = Signal;\n// --- Compatibility Layer (The Surface) ---\nfunction effect(fn, targetNode, options = {}) {\n let stopped = false;\n const id = ++effectIdCounter;\n const run = () => {\n if (stopped)\n return;\n const prevRunner = activeEffectRunner;\n activeEffectRunner = { run, node: targetNode, id };\n try {\n fn();\n }\n finally {\n activeEffectRunner = prevRunner;\n }\n };\n // Attach ID for topological sorting\n run._id = id;\n run._sync = options.sync;\n run();\n return () => {\n stopped = true;\n pendingEffects.delete(run);\n };\n}\nexports.effect = effect;\nfunction track(target, key) {\n if (activeEffectRunner) {\n let depsMap = targetMap.get(target);\n if (!depsMap) {\n targetMap.set(target, (depsMap = new Map()));\n }\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, (dep = new Set()));\n }\n dep.add(activeEffectRunner.run);\n }\n}\nfunction trigger(target, key) {\n const depsMap = targetMap.get(target);\n if (!depsMap)\n return;\n const dep = depsMap.get(key);\n if (dep) {\n dep.forEach((fn) => {\n if (fn._sync) {\n fn(); // Run synchronously if explicitly requested (e.g. for muMemo)\n }\n else {\n queueEffect(fn); // Push to Quantum Scheduler\n }\n });\n }\n}\n/**\n * Creates a reactive proxy object (Vue-compatible).\n * Now optimized to respect Mulan Cycle.\n */\nfunction reactive(target) {\n return new Proxy(target, {\n get(obj, prop, receiver) {\n // IRON FORTRESS: Prototype Pollution Protection (Read)\n if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {\n return undefined;\n }\n track(obj, prop);\n const val = Reflect.get(obj, prop, receiver);\n if (val !== null && typeof val === 'object') {\n return reactive(val);\n }\n return val;\n },\n set(obj, prop, value, receiver) {\n // IRON FORTRESS: Prototype Pollution Protection\n if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {\n console.warn(`[Iron Fortress] Blocked attempt to modify dangerous property: ${String(prop)}`);\n return false;\n }\n const result = Reflect.set(obj, prop, value, receiver);\n trigger(obj, prop);\n return result;\n },\n });\n}\nexports.reactive = reactive;\n/**\n * Creates a standalone reactive reference.\n * Backed by the Mulan Signal Engine.\n */\nfunction ref(value) {\n return new Signal(value);\n}\nexports.ref = ref;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuInfinity = void 0;\nconst MuInfinityBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {\n};\nclass MuInfinity extends MuInfinityBase {\n constructor() {\n super();\n this._items = [];\n this._itemHeight = 50; // Default height\n this._template = '';\n this.attachShadow({ mode: 'open' });\n // Structure:\n // :host { overflow-y: auto; display: block; height: 100%; }\n // .spacer { height: totalHeight; position: relative; }\n // .content { position: absolute; top: padding; width: 100%; }\n this.shadowRoot.innerHTML = `\r\n <style>\r\n :host {\r\n display: block;\r\n overflow-y: auto;\r\n height: 100%;\r\n position: relative;\r\n }\r\n .spacer {\r\n position: relative;\r\n width: 100%;\r\n }\r\n .content {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n }\r\n </style>\r\n <div class=\"spacer\">\r\n <div class=\"content\"></div>\r\n </div>\r\n `;\n this.container = this.shadowRoot.host; // The host itself scrolls\n this.spacer = this.shadowRoot.querySelector('.spacer');\n this.content = this.shadowRoot.querySelector('.content');\n this.onScroll = this.onScroll.bind(this);\n }\n static get observedAttributes() {\n return ['item-height'];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'item-height') {\n this._itemHeight = parseInt(newValue, 10) || 50;\n this.renderVisible();\n }\n }\n connectedCallback() {\n // Find the template provided by the user (Support both standard and branded tags)\n const templateTag = this.querySelector('template') || this.querySelector('mu-template');\n if (templateTag) {\n this._template = templateTag.innerHTML;\n }\n this.addEventListener('scroll', this.onScroll);\n // Wait for next frame to get initial height if not set\n requestAnimationFrame(() => this.renderVisible());\n }\n disconnectedCallback() {\n this.removeEventListener('scroll', this.onScroll);\n }\n set items(value) {\n this._items = value;\n this.renderVisible();\n }\n get items() { return this._items; }\n onScroll() {\n requestAnimationFrame(() => this.renderVisible());\n }\n renderVisible() {\n if (!this._items.length)\n return;\n const scrollTop = this.scrollTop;\n const hostHeight = this.clientHeight || 400; // Default fallback if not sized\n const totalHeight = this._items.length * this._itemHeight;\n this.spacer.style.height = `${totalHeight}px`;\n // Windowing Math\n const startIndex = Math.floor(scrollTop / this._itemHeight);\n const buffer = 5;\n const visibleCount = Math.ceil(hostHeight / this._itemHeight);\n const renderStart = Math.max(0, startIndex - buffer);\n const renderEnd = Math.min(this._items.length, startIndex + visibleCount + buffer);\n const startOffset = renderStart * this._itemHeight;\n this.content.style.transform = `translateY(${startOffset}px)`;\n // Render specific slice\n const visibleItems = this._items.slice(renderStart, renderEnd);\n // Simple string replacement template engine for the demo\n // In a real Mulan compilation, this would be an optimized ASTR render\n let html = '';\n visibleItems.forEach((item, index) => {\n const absoluteIndex = renderStart + index;\n // Basic mustache replacement {{ item.prop }}\n let rowHtml = this._template\n .replace(/{{\\s*item\\s*}}/g, String(item)) // {{ item }}\n .replace(/{{\\s*index\\s*}}/g, String(absoluteIndex)); // {{ index }}\n // Handle object properties: {{ item.name }}\n if (typeof item === 'object' && item !== null) {\n rowHtml = rowHtml.replace(/{{\\s*item\\.(\\w+)\\s*}}/g, (_, prop) => {\n return String(item[prop] || '');\n });\n }\n html += `<div style=\"height: ${this._itemHeight}px; overflow: hidden;\">${rowHtml}</div>`;\n });\n this.content.innerHTML = html;\n }\n}\nexports.MuInfinity = MuInfinity;\n// Register\nif (typeof customElements !== 'undefined' && !customElements.get('mu-infinity')) {\n customElements.define('mu-infinity', MuInfinity);\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuStore = void 0;\nconst reactive_1 = require(\"../core/reactive\");\nclass MuStore {\n constructor(initialState, options) {\n this.subscribers = [];\n // Load from local storage if persist is true\n let loadedState = initialState;\n if (options === null || options === void 0 ? void 0 : options.persist) {\n const key = options.key || 'mulan-store';\n try {\n const stored = localStorage.getItem(key);\n if (stored) {\n loadedState = Object.assign(Object.assign({}, initialState), JSON.parse(stored));\n }\n }\n catch (e) {\n console.error(\"Failed to load state\", e);\n }\n // Auto-save effect\n (0, reactive_1.effect)(() => {\n localStorage.setItem(key, JSON.stringify(this.state));\n });\n }\n this.state = (0, reactive_1.reactive)(loadedState);\n }\n // Subscribe to changes\n subscribe(fn) {\n this.subscribers.push(fn);\n (0, reactive_1.effect)(() => {\n fn(this.state);\n });\n }\n // Action dispatcher pattern\n dispatch(action) {\n const result = action(this.state);\n if (result instanceof Promise) {\n result.then(() => {\n // Optional: Notify subscribers of async completion if needed manually?\n // But reactive() handles updates automatically.\n });\n }\n }\n}\nexports.MuStore = MuStore;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Security = void 0;\nclass Security {\n /**\n * IRON FORTRESS PROTOCOL\n * Strictly escapes all HTML entities to prevent XSS.\n * Use `mu-raw` attribute in templates to bypass this for trusted content.\n */\n static sanitize(input) {\n // 1. Basic entity encoding\n let secure = input\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n // 2. Remove dangerous events (extra layer if encoding fails)\n const dangerousEvents = ['onload', 'onclick', 'onerror', 'onmouseover', 'onfocus'];\n dangerousEvents.forEach(event => {\n const regex = new RegExp(event, 'gi');\n secure = secure.replace(regex, 'data-blocked-' + event);\n });\n return secure;\n }\n /**\n * Generates a strict Content Security Policy header value.\n * @param options Configuration for allowed sources\n */\n static generateCSP(options = {}) {\n const scriptSrc = [\"'self'\", ...(options.scriptSrc || [])].join(\" \");\n const styleSrc = [\"'self'\", \"'unsafe-inline'\", ...(options.styleSrc || [])].join(\" \");\n return `default-src 'self'; script-src ${scriptSrc}; style-src ${styleSrc}; object-src 'none'; base-uri 'self';`;\n }\n static validateUrl(url) {\n // Basic URL validation\n const pattern = new RegExp('^(https?:\\\\/\\\\/)?' + // protocol\n '((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|' + // domain name\n '((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))' + // OR ip (v4) address\n '(\\\\:\\\\d+)?(\\\\/[-a-z\\\\d%_.~+]*)*' + // port and path\n '(\\\\?[;&a-z\\\\d%_.~+=-]*)?' + // query string\n '(\\\\#[-a-z\\\\d_]*)?$', 'i'); // fragment locator\n return !!pattern.test(url);\n }\n /**\n * Prevents XSS by sanitizing common input fields on blur.\n * Can be used as a utility in forms.\n */\n static preventXSS(inputElement) {\n inputElement.addEventListener('blur', (e) => {\n const target = e.target;\n target.value = Security.sanitize(target.value);\n });\n }\n}\nexports.Security = Security;\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createRouter = exports.MuRouter = void 0;\nconst renderer_1 = require(\"../core/renderer\");\nconst sanitizer_1 = require(\"../security/sanitizer\");\nclass MuRouter {\n constructor(routes, rootContainer = null) {\n this.currentPath = '';\n this.currentComponent = null;\n this.lastRouteId = 0;\n this.routes = routes;\n this.rootContainer = rootContainer;\n this.isServer = rootContainer === null; // If no container, assume server/headless mode\n if (!this.isServer) {\n window.addEventListener('hashchange', this.handleRoute.bind(this));\n this.handleRoute(); // Initial load\n }\n }\n // SSR Method: Simulate a route visit on the server\n serverLookup(path) {\n return __awaiter(this, void 0, void 0, function* () {\n this.currentPath = path;\n const { route, params } = this.matchRoute(path);\n if (route) {\n // Run guards/resolvers here if needed\n let componentToRender = route.component;\n // Support Lazy Loading\n if (typeof componentToRender === 'function' && !componentToRender.prototype) {\n const module = yield componentToRender();\n componentToRender = module.default || module;\n }\n if (typeof componentToRender === 'function') {\n // Class component SSR\n // We need a dummy container for the component to \"render\" into its own buffer\n // For simplicity in this string-based framework, we mock the container\n const mockContainer = { innerHTML: '' };\n const instance = new componentToRender(mockContainer);\n if (instance.setParams)\n instance.setParams(params);\n // Manually trigger mount logic without DOM effects if possible, or just template()\n // Ideally, we just want the template string.\n return instance.template();\n }\n else {\n return componentToRender;\n }\n }\n return '<!-- 404 -->';\n });\n }\n matchRoute(hash) {\n // Simple exact match first\n let route = this.routes.find((r) => r.path === hash);\n if (route)\n return { route, params: {} };\n // Regex match for params e.g. /user/:id\n for (const r of this.routes) {\n const paramNames = [];\n const regexPath = r.path.replace(/:([^/]+)/g, (_, key) => {\n paramNames.push(key);\n return '([^/]+)';\n });\n const match = new RegExp(`^${regexPath}$`).exec(hash);\n if (match) {\n const params = {};\n paramNames.forEach((name, i) => {\n // SECURE: Automatically sanitize all route parameters\n params[name] = sanitizer_1.Security.sanitize(match[i + 1]);\n });\n return { route: r, params };\n }\n }\n return { route: undefined, params: {} };\n }\n handleRoute() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.isServer)\n return;\n const currentRouteId = ++this.lastRouteId;\n const hash = window.location.hash.slice(1) || '/';\n const { route, params } = this.matchRoute(hash);\n // Security Check: Validate URL to prevent malicious hash injection\n if (hash !== '/' && !sanitizer_1.Security.validateUrl('http://dummy.com' + hash)) {\n console.error(\"Security Alert: Malformed URL detected.\");\n return;\n }\n // Navigation Guard (Middleware)\n if (route === null || route === void 0 ? void 0 : route.beforeEnter) {\n yield new Promise((resolve) => {\n route.beforeEnter(hash, this.currentPath, (allow) => {\n if (allow)\n resolve();\n else {\n console.warn(`Navigation to ${hash} blocked by guard.`);\n // Ideally redirect or stay, here we just stop processing\n throw new Error('Navigation Blocked');\n }\n });\n }).catch(() => { return; }); // Stop execution if blocked\n }\n this.currentPath = hash;\n if (route) {\n if (route.title) {\n document.title = route.title;\n }\n else if (route.meta && route.meta.title) {\n // Fallback to meta.title if used\n document.title = route.meta.title;\n }\n if (this.rootContainer) {\n // Mulan Cycle: Destroy previous component before rendering new one\n if (this.currentComponent) {\n console.log(`[Router] Navigation from ${this.currentPath} to ${hash}. Destroying previous component.`);\n if (this.currentComponent.onDestroy) {\n this.currentComponent.onDestroy();\n }\n }\n this.rootContainer.innerHTML = ''; // Clear previous content\n }\n let componentToRender = route.component;\n // Support Lazy Loading\n if (typeof componentToRender === 'function' && !componentToRender.prototype) {\n try {\n const module = yield componentToRender();\n if (currentRouteId !== this.lastRouteId) {\n console.log(`[Router] Navigation to ${hash} interrupted by newer navigation. Abandoning.`);\n return;\n }\n componentToRender = module.default || module;\n }\n catch (e) {\n console.error(\"Failed to lazy load component\", e);\n return;\n }\n }\n if (typeof componentToRender === 'function') {\n // It's a class component\n if (this.rootContainer) {\n const instance = new componentToRender(this.rootContainer);\n this.currentComponent = instance;\n // Inject params if the component accepts them\n if (instance.setParams) {\n instance.setParams(params);\n }\n instance.mount();\n }\n }\n else if (typeof componentToRender === 'object' && componentToRender.template) {\n // Object Component (Simple SFC without script or Options API)\n const html = componentToRender.template();\n if (this.rootContainer)\n (0, renderer_1.render)(html, this.rootContainer);\n this.currentComponent = null;\n }\n else {\n // Simple HTML string/template\n if (this.rootContainer)\n (0, renderer_1.render)(componentToRender, this.rootContainer);\n this.currentComponent = null; // String templates don't have lifecycle instances\n }\n }\n else {\n if (this.rootContainer)\n (0, renderer_1.render)('<div style=\"text-align:center; padding:50px;\"><h1>404</h1><p>Page Not Found</p></div>', this.rootContainer);\n }\n });\n }\n // [Chronos] Prefetch a route's component code in the background\n prefetch(path) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.isServer)\n return;\n const { route } = this.matchRoute(path);\n if (route) {\n let componentToRender = route.component;\n // Check if it's a lazy-loaded function that hasn't been resolved yet\n if (typeof componentToRender === 'function' && !componentToRender.prototype) {\n // If it's already a resolved module (from previous prefetch), componentToRender might be the result.\n // But typically in our simple implementation, route.component stays as the function until we replace it.\n // To avoid double-fetching, we can check if it has a specific flag or property. \n // For this implementation, we'll just run it and let the browser cache the module request (standard ES Module behavior).\n try {\n // console.log(`[Chronos] Prefetching ${path}...`);\n yield componentToRender();\n // We don't need to do anything with the result here. \n // The browser's module cache will handle the speedup when the user actually navigates.\n }\n catch (e) {\n console.warn(`[Chronos] Failed to prefetch ${path}`, e);\n }\n }\n }\n });\n }\n navigate(path) {\n if (this.isServer) {\n this.currentPath = path;\n }\n else {\n window.location.hash = path;\n }\n }\n}\nexports.MuRouter = MuRouter;\n// --- Factory for Easy Usage ---\nconst createRouter = (options) => {\n // Expose the router instance globally for <mu-link> to access\n const router = new MuRouter(options.routes, options.rootContainer);\n if (typeof window !== 'undefined') {\n window.__MULAN_ROUTER__ = router;\n }\n return router;\n};\nexports.createRouter = createRouter;\n// --- Web Component: <mu-link> ---\n// Usage: <mu-link to=\"/about\">About Us</mu-link>\nconst MuLinkBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {\n};\nif (typeof window !== 'undefined' && !customElements.get('mu-link')) {\n class MuLink extends MuLinkBase {\n constructor() {\n super();\n this.addEventListener('click', (e) => {\n e.preventDefault();\n const to = this.getAttribute('to');\n if (to) {\n // Update Hash for SPA Navigation\n window.location.hash = to;\n }\n });\n // [Chronos] Intelligent Pre-fetching\n this.addEventListener('mouseenter', () => {\n const to = this.getAttribute('to');\n if (to) {\n const router = window.__MULAN_ROUTER__;\n if (router && typeof router.prefetch === 'function') {\n router.prefetch(to);\n }\n }\n });\n // [Chronos] Also prefetch on focus for keyboard users\n this.addEventListener('focus', () => {\n const to = this.getAttribute('to');\n if (to) {\n const router = window.__MULAN_ROUTER__;\n if (router && typeof router.prefetch === 'function') {\n router.prefetch(to);\n }\n }\n });\n }\n connectedCallback() {\n this.style.cursor = 'pointer';\n this.style.color = 'var(--primary, #9C27B0)'; // Default to brand color if available\n this.style.textDecoration = 'none';\n }\n static get observedAttributes() { return ['to']; }\n }\n customElements.define('mu-link', MuLink);\n}\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.useMutation = exports.useQuery = void 0;\nconst reactive_1 = require(\"./reactive\");\nfunction useQuery(queryFn, options = { enabled: true }) {\n const state = (0, reactive_1.reactive)({\n data: null,\n isLoading: false,\n error: null\n });\n const execute = () => __awaiter(this, void 0, void 0, function* () {\n state.isLoading = true;\n state.error = null;\n try {\n const result = yield queryFn();\n state.data = result;\n }\n catch (err) {\n state.error = err;\n }\n finally {\n state.isLoading = false;\n }\n });\n if (options.enabled) {\n // Run automatically\n (0, reactive_1.effect)(() => {\n // Basic effect wrapper to allow reactivity if queryFn relies on signals\n execute();\n });\n }\n return {\n get data() { return state.data; },\n get isLoading() { return state.isLoading; },\n get error() { return state.error; },\n refetch: execute\n };\n}\nexports.useQuery = useQuery;\nfunction useMutation(mutationFn) {\n const state = (0, reactive_1.reactive)({\n data: null,\n isLoading: false,\n error: null\n });\n const mutate = (args) => __awaiter(this, void 0, void 0, function* () {\n state.isLoading = true;\n state.error = null;\n try {\n const result = yield mutationFn(args);\n state.data = result;\n return result;\n }\n catch (err) {\n state.error = err;\n throw err;\n }\n finally {\n state.isLoading = false;\n }\n });\n return {\n get data() { return state.data; },\n get isLoading() { return state.isLoading; },\n get error() { return state.error; },\n mutate\n };\n}\nexports.useMutation = useMutation;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuBlochSphereElement = void 0;\nconst reactive_1 = require(\"../core/reactive\");\nconst MuBlochBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {\n};\nclass MuBlochSphereElement extends MuBlochBase {\n static get observedAttributes() {\n return ['size'];\n }\n constructor() {\n super();\n this._arrow = null;\n this._container = null;\n this._disposeEffect = null;\n this.attachShadow({ mode: 'open' });\n }\n connectedCallback() {\n this.render();\n }\n disconnectedCallback() {\n if (this._disposeEffect) {\n this._disposeEffect();\n this._disposeEffect = null;\n }\n }\n // Property setter for 'qubit' (passed as .qubit=\"${q}\" in Mulan)\n set qubit(val) {\n this._qubit = val;\n this.initReactivity();\n }\n get qubit() {\n return this._qubit;\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'size' && this._container) {\n this._container.style.width = newValue + 'px';\n this._container.style.height = newValue + 'px';\n }\n }\n initReactivity() {\n if (this._disposeEffect)\n this._disposeEffect();\n if (!this._qubit)\n return;\n // MulanJS Effect: Run whenever the qubit state changes\n this._disposeEffect = (0, reactive_1.effect)(() => {\n const state = this._qubit.value; // Access reactive proxy\n if (!state || !state.amplitudes)\n return;\n // Assume Single Qubit for Visualizer (Index 0 if passed a register)\n // If passed a register, we visualize the first qubit's logical projection (partial trace simplified)\n // Or assume input IS a specific qubit projection?\n // For simplified demo, we assume the register is size 1 OR we visualize Q0 of the register.\n const amps = state.amplitudes;\n // Support 1-qubit visualization from N-qubit register requires partial trace.\n // For now, let's assume the user passes a 1-qubit register OR we visualize index 0.\n // |psi> = a|0> + b|1>\n // a = amps[0] (re, im)\n // b = amps[1] (re, im)\n // Dealing with multi-qubit registers (naive projection for visualization):\n // We sum up probabilities for 0xxxx vs 1xxxx to get Z-axis.\n // This is \"marginal probability\".\n let p0 = 0;\n let p1 = 0;\n // Calculate Probabilities\n for (let i = 0; i < amps.length; i++) {\n const mag = amps[i].re * amps[i].re + amps[i].im * amps[i].im;\n if ((i & 1) === 0)\n p0 += mag;\n else\n p1 += mag;\n }\n // Theta from Z-projection\n // P0 = cos^2(theta/2) -> theta = 2 * acos(sqrt(P0))\n const theta = 2 * Math.acos(Math.min(1, Math.sqrt(p0)));\n // Phi?\n // Phase is relative phase between |0> and |1>.\n // We can look at the phase of the '1' component relative to '0'.\n // Simple approach: Look at amps[1] phase vs amps[0] phase.\n // But with entanglement, pure state phase is tricky.\n // Let's implement full density matrix if needed, but for now:\n // naive: atan2(amps[1].im, amps[1].re) - atan2(amps[0].im, amps[0].re)\n // We use the first pair (0 and 1) as proxy if multiple.\n const a0 = amps[0];\n const a1 = amps[1]; // Valid for N>=1\n const phase0 = Math.atan2(a0.im, a0.re);\n const phase1 = Math.atan2(a1.im, a1.re);\n let phi = phase1 - phase0;\n // Update Arrow\n this.updateArrow(theta, phi);\n });\n }\n updateArrow(theta, phi) {\n if (!this._arrow)\n return;\n // Convert Quantum Coords (Theta, Phi) to CSS Transforms\n // Theta 0 = Top (|0>)\n // Theta PI = Bottom (|1>)\n // Theta PI/2 = Equator\n // CSS Rotate sequence:\n // 1. Start pointing UP (Y or Z axis in CSS?)\n // Let's say Arrow starts pointing UP (Y-).\n // Rotate Z by Phi (Azimuth)\n // Rotate X by Theta (Polar) - No, that's not standard Euler.\n // Standard Physics:\n // Z is Up (in Bloch), but CSS 3D Y is usually 'Down' or 'Up'.\n // Let's Map:\n // Bloch Z+ (|0>) -> CSS Y- (Top)\n // Bloch Z- (|1>) -> CSS Y+ (Bottom)\n // Bloch X+ (|+>) -> CSS Z+ (Front)\n // Transform:\n // rotateY(phi) ? No, phi rotates around Z-axis (Vertical).\n // theta rotates from Z-axis down.\n // CSS:\n // rotateY(phi) -> Rotates around Vertical axis.\n // rotateZ(theta) -> Rotates \"down\" from up?\n // Let's simplify:\n // transform: rotateY(${phi}rad) rotateZ(${theta}rad)\n // Note: CSS rotations order matters.\n const degTheta = theta * (180 / Math.PI);\n const degPhi = phi * (180 / Math.PI);\n // Adjustment for visual alignment\n this._arrow.style.transform = `rotateY(${degPhi}deg) rotateZ(${degTheta}deg)`;\n // Color based on state\n const isSuperposition = Math.abs(theta - Math.PI / 2) < 0.1;\n this._arrow.style.backgroundColor = isSuperposition ? '#00ffff' : '#ff00ff';\n }\n render() {\n if (!this.shadowRoot)\n return;\n const size = this.getAttribute('size') || '200';\n this.shadowRoot.innerHTML = `\r\n <style>\r\n :host {\r\n display: inline-block;\r\n perspective: 1000px;\r\n }\r\n .sphere-container {\r\n width: ${size}px;\r\n height: ${size}px;\r\n position: relative;\r\n transform-style: preserve-3d;\r\n margin: 0 auto;\r\n }\r\n .sphere {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n border: 1px solid rgba(255, 255, 255, 0.2);\r\n position: absolute;\r\n background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.8));\r\n box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);\r\n transform: rotateX(15deg) rotateY(15deg); /* Initial tilt for view */\r\n }\r\n /* Equator Ring */\r\n .equator {\r\n position: absolute;\r\n top: 50%;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n border: 1px dashed rgba(255, 255, 255, 0.3);\r\n border-radius: 50%;\r\n transform: rotateX(90deg);\r\n pointer-events: none;\r\n }\r\n /* Axis Lines */\r\n .axis {\r\n position: absolute;\r\n background: rgba(255, 255, 255, 0.1);\r\n }\r\n .z-axis { width: 2px; height: 100%; left: 50%; top: 0; }\r\n \r\n /* The Quantum Arrow */\r\n .arrow-container {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n width: 0;\r\n height: 0;\r\n transform-style: preserve-3d;\r\n transform: rotateX(15deg) rotateY(15deg); /* Match sphere tilt */\r\n }\r\n \r\n .arrow-pivot {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 4px;\r\n height: 50%; /* Length of radius */\r\n /* Pivot logic: we want to rotate around the center point */\r\n /* CSS Default transform-origin is 50% 50% */\r\n /* We construct the arrow such that it points UP from center */\r\n }\r\n \r\n .arrow-rod {\r\n width: 4px;\r\n height: ${parseInt(size) / 2 - 10}px;\r\n background: #ff00ff;\r\n position: absolute;\r\n bottom: 0;\r\n left: -2px;\r\n transform-origin: bottom center;\r\n transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;\r\n border-radius: 2px;\r\n box-shadow: 0 0 10px currentColor;\r\n }\r\n \r\n .arrow-head {\r\n width: 0; \r\n height: 0; \r\n border-left: 6px solid transparent;\r\n border-right: 6px solid transparent;\r\n border-bottom: 12px solid #ff00ff;\r\n position: absolute;\r\n top: -10px;\r\n left: -6px;\r\n }\r\n \r\n .label {\r\n position: absolute;\r\n color: #aaa;\r\n font-family: monospace;\r\n font-size: 10px;\r\n }\r\n .label-0 { top: 5px; left: 50%; transform: translateX(-50%); }\r\n .label-1 { bottom: 5px; left: 50%; transform: translateX(-50%); }\r\n </style>\r\n \r\n <div class=\"sphere-container\">\r\n <div class=\"sphere\">\r\n <div class=\"equator\"></div>\r\n <div class=\"axis z-axis\"></div>\r\n <div class=\"label label-0\">|0></div>\r\n <div class=\"label label-1\">|1></div>\r\n </div>\r\n \r\n <div class=\"arrow-container\">\r\n <!-- The rod is the actual rotating element -->\r\n <div class=\"arrow-rod\">\r\n <div class=\"arrow-head\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n `;\n this._container = this.shadowRoot.querySelector('.sphere-container');\n this._arrow = this.shadowRoot.querySelector('.arrow-rod');\n // Re-init reactivity if qubit was set before render\n if (this._qubit)\n this.initReactivity();\n }\n}\nexports.MuBlochSphereElement = MuBlochSphereElement;\n// Register the custom element\nif (typeof customElements !== 'undefined' && !customElements.get('mu-bloch-sphere')) {\n customElements.define('mu-bloch-sphere', MuBlochSphereElement);\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sanitize = exports.hydrate = exports.render = void 0;\nfunction render(template, container) {\n // Focus Preservation (The \"Mulan Glance\" Technique)\n let focusedId = null;\n let selectionStart = null;\n let selectionEnd = null;\n let preservedValue = null;\n if (document.activeElement && container.contains(document.activeElement)) {\n const el = document.activeElement;\n if (el.hasAttribute('data-mu-id')) {\n focusedId = el.getAttribute('data-mu-id');\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n selectionStart = el.selectionStart;\n selectionEnd = el.selectionEnd;\n preservedValue = el.value;\n }\n }\n }\n // [Anima] 1. Pre-Update: Snapshot positions of animated elements\n const animationSnapshots = new Map();\n // Only query if we might have animations to save perf\n if (typeof template === 'string' && template.includes('mu-animate')) {\n const animatedEls = container.querySelectorAll('[mu-animate]');\n animatedEls.forEach(el => {\n const key = el.getAttribute('mu-key') || el.id;\n if (key) {\n animationSnapshots.set(key, el.getBoundingClientRect());\n }\n });\n }\n if (typeof template === 'string') {\n container.innerHTML = template;\n }\n else {\n container.innerHTML = '';\n container.appendChild(template);\n }\n // Restore Focus and Value\n if (focusedId) {\n const el = container.querySelector(`[data-mu-id=\"${focusedId}\"]`);\n if (el) {\n // Restore value first to ensure cursor positioning works correctly\n if (preservedValue !== null && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement)) {\n el.value = preservedValue;\n }\n el.focus();\n if ((el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) && selectionStart !== null) {\n try {\n el.setSelectionRange(selectionStart, selectionEnd);\n }\n catch (e) {\n // input types that don't support selection (e.g. number/email) might throw\n }\n }\n }\n }\n // [Anima] 2. Post-Update: FLIP (First, Last, Invert, Play)\n if (animationSnapshots.size > 0) {\n const newAnimatedEls = container.querySelectorAll('[mu-animate]');\n newAnimatedEls.forEach(el => {\n const key = el.getAttribute('mu-key') || el.id;\n if (key && animationSnapshots.has(key)) {\n const oldRect = animationSnapshots.get(key);\n const newRect = el.getBoundingClientRect();\n const dx = oldRect.left - newRect.left;\n const dy = oldRect.top - newRect.top;\n // Only animate if moved\n if (dx !== 0 || dy !== 0) {\n const htmlEl = el;\n // INVERT: Move it back to where it was instantly\n htmlEl.style.transform = `translate(${dx}px, ${dy}px)`;\n htmlEl.style.transition = 'none';\n // PLAY: Animate to zero (new position)\n requestAnimationFrame(() => {\n // Force reflow\n // void htmlEl.offsetWidth; \n htmlEl.style.transition = 'transform 500ms cubic-bezier(0.25, 0.8, 0.25, 1)';\n htmlEl.style.transform = '';\n });\n }\n }\n });\n }\n}\nexports.render = render;\nfunction hydrate(template, container) {\n // In a string-based framework, hydration is often just \"take over\".\n // For now, we'll verify if the server content matches (simple check)\n // and then assume control. In a more advanced version, we'd attach listeners without re-rendering.\n if (typeof template === 'string') {\n if (container.innerHTML.trim() !== template.trim()) {\n console.warn('Hydration Mismatch: Server rendered content differs from Client.');\n container.innerHTML = template; // Fallback to full render\n }\n else {\n // console.log('Hydration Successful.');\n }\n }\n else {\n container.innerHTML = '';\n container.appendChild(template);\n }\n // Future: Attach event listeners here if we had a mechanism for it.\n}\nexports.hydrate = hydrate;\nfunction sanitize(str) {\n // Check if we are in a browser environment\n if (typeof document !== 'undefined') {\n const temp = document.createElement('div');\n temp.textContent = str;\n return temp.innerHTML;\n }\n // Simple SSR fallback sanitizer (rudimentary)\n return str.replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\nexports.sanitize = sanitize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.renderToString = void 0;\n/**\n * Renders a Mulan component to a static HTML string with a resumability envelope.\n */\nfunction renderToString(ComponentClass, props = {}) {\n // 1. Initialize component in a virtual container (not used for DOM)\n // On server, we mock the container or just pass a dummy object\n const dummyContainer = {\n querySelector: () => null,\n querySelectorAll: () => [],\n appendChild: () => { },\n removeChild: () => { },\n getAttribute: () => null\n };\n const instance = new ComponentClass(dummyContainer);\n // Pass props\n Object.assign(instance, props);\n // 2. Render to HTML\n if (typeof instance.renderToString !== 'function') {\n throw new Error(`Component ${ComponentClass.name} was not compiled for SSR.`);\n }\n const html = instance.renderToString();\n // 3. Extract State for Resumability\n // We only want to serialize data that was exposed in setup()\n // For now, we'll serialize any property on the instance that isn't internal\n const state = {};\n for (const key in instance) {\n if (key.startsWith('_') || key === 'container' || key === 'state' || typeof instance[key] === 'function')\n continue;\n const value = instance[key];\n // Handle signals specifically\n if (value && typeof value === 'object' && 'value' in value) {\n state[key] = value.value;\n }\n else {\n state[key] = value;\n }\n }\n // 4. Construct Resumability Envelope\n const stateScript = `<script type=\"mulan/state\" data-mu-uid=\"${instance.$uid}\">${JSON.stringify(state)}</script>`;\n const envelope = `<div data-mu-root=\"${instance.$uid}\">${html}${stateScript}</div>`;\n return {\n html,\n state,\n envelope\n };\n}\nexports.renderToString = renderToString;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.muSwitch = exports.muControl = exports.muParallel = exports.muMeasure = exports.muTeleport = exports.muEntangle = exports.muSearch = exports.muGate = exports.muQubit = exports.muRegister = exports.activeControls = void 0;\nconst hooks_1 = require(\"./hooks\");\n/**\n * Mulan Quantum (ASTR-Q+) Core\n * Advanced Simulation Engine for multi-qubit registers and entanglement.\n */\n// -- GLOBAL CONTEXT FOR QUANTUM CONTROL --\n// Defined at top to ensure visibility for muGate\nexports.activeControls = [];\n/**\n * Creates a quantum register of size n.\n * State vector will have 2^n amplitudes.\n */\nfunction muRegister(n) {\n const numStates = Math.pow(2, n);\n const amplitudes = new Array(numStates).fill(0).map((_, i) => ({\n re: i === 0 ? 1 : 0,\n im: 0\n }));\n return (0, hooks_1.muState)({\n value: {\n size: n,\n amplitudes\n }\n });\n}\nexports.muRegister = muRegister;\n/**\n * Backward compatible muQubit (Single Qubit Register)\n */\nfunction muQubit(initial = 0) {\n const q = muRegister(1);\n if (initial === 1) {\n muGate(q, 'X', 0);\n }\n // Add compatibility properties for Phase 1 components\n // These properties are getters that dynamically access the amplitudes array\n Object.defineProperty(q.value, 'alpha', { get: () => q.value.amplitudes[0] });\n Object.defineProperty(q.value, 'beta', { get: () => q.value.amplitudes[1] });\n return q;\n}\nexports.muQubit = muQubit;\n/**\n * Internal helper to update register state while maintaining compatibility\n */\nfunction updateState(reg, newState) {\n if (newState.size === 1) {\n // Re-inject compatibility getters for muQubit users\n Object.defineProperty(newState, 'alpha', {\n get: () => newState.amplitudes[0],\n configurable: true,\n enumerable: true\n });\n Object.defineProperty(newState, 'beta', {\n get: () => newState.amplitudes[1],\n configurable: true,\n enumerable: true\n });\n }\n reg.value = newState;\n}\nfunction muGate(reg, type, target = 0, control) {\n const state = reg.value;\n const n = state.size;\n const amplitudes = state.amplitudes;\n const newAmps = amplitudes.map(a => (Object.assign({}, a)));\n // Prepare Effective Control (Explicit Arguments + Global Context)\n const effectiveControl = [...(control === undefined ? [] : (Array.isArray(control) ? control : [control])), ...exports.activeControls];\n // Helper: Check if all control bits are 1\n const checkControl = (index, ctrl) => {\n if (ctrl === undefined || (Array.isArray(ctrl) && ctrl.length === 0))\n return true;\n const ctrls = Array.isArray(ctrl) ? ctrl : [ctrl];\n return ctrls.every(c => ((index >> c) & 1) === 1);\n };\n // SWAP Gate (Unique case: affects 2 targets)\n if (type === 'SWAP') {\n const t1 = target;\n const t2 = control; // SWAP uses control arg as second target \n // Iterate only half to avoid double swapping\n for (let i = 0; i < amplitudes.length; i++) {\n // Check active controls for SWAP too\n if (exports.activeControls.length > 0 && !checkControl(i, exports.activeControls))\n continue;\n const bit1 = (i >> t1) & 1;\n const bit2 = (i >> t2) & 1;\n if (bit1 !== bit2) {\n // Determine the swap partner index\n // If i has (0,1), partner has (1,0) at those positions\n const partner = i ^ (1 << t1) ^ (1 << t2);\n if (i < partner) {\n const temp = newAmps[i];\n newAmps[i] = newAmps[partner];\n newAmps[partner] = temp;\n }\n }\n }\n updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));\n return;\n }\n // Standard Single-Qubit & Controlled Gates\n if (type === 'H') {\n const s = 1 / Math.sqrt(2);\n const processed = new Set();\n for (let i = 0; i < state.amplitudes.length; i++) {\n if (processed.has(i))\n continue;\n // Check Controls first\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));\n const a = state.amplitudes[i];\n const b = state.amplitudes[pairedIndex];\n if (targetBit === 0) {\n newAmps[i] = { re: s * (a.re + b.re), im: s * (a.im + b.im) };\n newAmps[pairedIndex] = { re: s * (a.re - b.re), im: s * (a.im - b.im) };\n }\n else {\n newAmps[pairedIndex] = { re: s * (b.re + a.re), im: s * (b.im + a.im) };\n newAmps[i] = { re: s * (b.re - a.re), im: s * (b.im - a.im) };\n }\n processed.add(i);\n processed.add(pairedIndex);\n }\n }\n else if (type === 'X' || type === 'CNOT') {\n // CNOT is just Controlled-X\n for (let i = 0; i < amplitudes.length; i++) {\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));\n if (i < pairedIndex) {\n const temp = newAmps[i];\n newAmps[i] = newAmps[pairedIndex];\n newAmps[pairedIndex] = temp;\n }\n }\n }\n else if (type === 'Z' || type === 'CZ') {\n // Z and CZ are Phase Flips\n for (let i = 0; i < amplitudes.length; i++) {\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n // Z Gate acts on |1>\n if (targetBit === 1) {\n newAmps[i] = { re: -amplitudes[i].re, im: -amplitudes[i].im };\n }\n }\n }\n else if (type === 'Y') {\n // Y: |0> -> i|1>, |1> -> -i|0>\n for (let i = 0; i < amplitudes.length; i++) {\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));\n if (i < pairedIndex) {\n // We process pairs (i, pairedIndex) where i has 0 at target, paired has 1\n const a = newAmps[i]; // Coeff of |0>\n const b = newAmps[pairedIndex]; // Coeff of |1>\n // New |0> = -i * Old |1>\n newAmps[i] = { re: b.im, im: -b.re };\n // New |1> = i * Old |0>\n newAmps[pairedIndex] = { re: -a.im, im: a.re };\n }\n }\n }\n updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));\n}\nexports.muGate = muGate;\n/**\n * Mulan Search Logic (Grover's Operator)\n * Automatically constructs a multi-controlled Phase Flip (Z) for a specific target state.\n * This is the core of the \"Quantum Switch\" or \"Quantum Search\" capability.\n * @param reg Quantum Register\n * @param targetState The integer state to \"search\" and mark (e.g. 2 for |10>)\n */\nfunction muSearch(reg, targetState) {\n const n = reg.value.size;\n const controls = [];\n // 1. Identify which bits are 0 and need wrapping with X gates\n // Logic: To mark |010>, we want C-C-Z to trigger on 111.\n // So we apply X to bits that are 0, then C-C-Z, then X again.\n // We treat the last bit as the 'target' for the Z gate, rest as controls\n const targetQubit = n - 1;\n for (let i = 0; i < n; i++) {\n const bit = (targetState >> i) & 1;\n if (i === targetQubit) {\n // If target bit logic requires 0, we flip it to 1 for the Z gate to work\n if (bit === 0)\n muGate(reg, 'X', i);\n }\n else {\n controls.push(i);\n if (bit === 0)\n muGate(reg, 'X', i);\n }\n }\n // 2. Apply Multi-Controlled Z\n muGate(reg, 'Z', targetQubit, controls);\n // 3. Uncompute (Restore 0s)\n for (let i = 0; i < n; i++) {\n const bit = (targetState >> i) & 1;\n if (bit === 0)\n muGate(reg, 'X', i);\n }\n // --- GROVER DIFFUSER (Amplification) ---\n // This flips the probability amplitudes around the mean, boosting the target state.\n // 1. Apply H to all\n for (let i = 0; i < n; i++)\n muGate(reg, 'H', i);\n // 2. Apply X to all\n for (let i = 0; i < n; i++)\n muGate(reg, 'X', i);\n // 3. Multi-Controlled Z (Reflection about |0...0>)\n // We want to flip phase of |11...1> state after X transformation (which corresponds to |00...0> original)\n // Target is last qubit, controls are 0 to n-2\n const diffControls = [];\n for (let i = 0; i < n - 1; i++)\n diffControls.push(i);\n muGate(reg, 'Z', n - 1, diffControls);\n // 4. Uncompute X\n for (let i = 0; i < n; i++)\n muGate(reg, 'X', i);\n // 5. Uncompute H\n for (let i = 0; i < n; i++)\n muGate(reg, 'H', i);\n}\nexports.muSearch = muSearch;\nfunction muEntangle(reg, i, j) {\n muGate(reg, 'H', i);\n muGate(reg, 'CNOT', j, i);\n}\nexports.muEntangle = muEntangle;\n/**\n * Quantum Teleportation Protocol\n * Transfers the state of `msgIdx` to `targetIdx` using `ancillaIdx` as a resource.\n * @param reg Register\n * @param msgIdx The qubit containing the state to teleport (Alice)\n * @param ancillaIdx The helper qubit (Alice's half of entanglement)\n * @param targetIdx The destination qubit (Bob)\n */\nfunction muTeleport(reg, msgIdx, ancillaIdx, targetIdx) {\n // 1. Create Bell Pair (Entanglement) between Ancilla and Target\n // Represents the shared link between Alice and Bob\n muEntangle(reg, ancillaIdx, targetIdx);\n // 2. Bell Measurement on Message + Ancilla (Alice's side)\n muGate(reg, 'CNOT', ancillaIdx, msgIdx); // Control: msg, Target: ancilla\n muGate(reg, 'H', msgIdx);\n // 3. Measure Alice's qubits (This collapses them)\n const m1 = muMeasure(reg, msgIdx); // Measures \"Z\" component\n const m2 = muMeasure(reg, ancillaIdx); // Measures \"X\" component\n // 4. Classical Communication & Correction (Bob's side)\n // Apply corrections to Target based on measurements\n if (m2 === 1)\n muGate(reg, 'X', targetIdx);\n if (m1 === 1)\n muGate(reg, 'Z', targetIdx);\n}\nexports.muTeleport = muTeleport;\n/**\n * Measures a specific qubit in the register, collapsing the superposition.\n * @param reg Quantum Register\n * @param target Index of qubit to measure\n * @returns 0 or 1\n */\nfunction muMeasure(reg, target = 0) {\n const state = reg.value;\n const amplitudes = state.amplitudes;\n let prob0 = 0;\n // 1. Calculate Probability of |0>\n for (let i = 0; i < amplitudes.length; i++) {\n if (((i >> target) & 1) === 0) {\n const a = amplitudes[i];\n prob0 += (a.re * a.re) + (a.im * a.im);\n }\n }\n // 2. Determine Outcome\n const result = Math.random() < prob0 ? 0 : 1;\n const resultProb = result === 0 ? prob0 : (1 - prob0);\n const normFactor = resultProb > 0 ? (1 / Math.sqrt(resultProb)) : 0;\n // 3. Collapse the State (Wavefunction Collapse)\n const newAmps = amplitudes.map((a, i) => {\n const bit = (i >> target) & 1;\n if (bit !== result) {\n return { re: 0, im: 0 };\n }\n else {\n return { re: a.re * normFactor, im: a.im * normFactor };\n }\n });\n // We need to call updateState to ensure reactivity if specialized getters exist\n // But since this file has updateState internal, we can just call it.\n // However, the internal updateState function needs to be in scope. \n // It is defined at line 60. So we are good.\n updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));\n return result;\n}\nexports.muMeasure = muMeasure;\n/**\n * Quantum Loop: Parallel Execution\n * Applies a gate to multiple qubits \"simultaneously\" (in simulation steps).\n * Ideal for initialization (Hadamard Transform) or global operations.\n * @param reg Quantum Register\n * @param qubits Array of qubit indices\n * @param gate Gate type to apply (e.g. 'H', 'X')\n */\nfunction muParallel(reg, qubits, gate) {\n if (gate === 'SWAP') {\n throw new Error(\"SWAP cannot be applied in parallel (requires pairs).\");\n }\n // In a real quantum computer, these happen at t=0.\n // Here, we loop, but logical time is constant.\n qubits.forEach(q => muGate(reg, gate, q));\n}\nexports.muParallel = muParallel;\n/**\n * Applies a block of operations controlled by specific qubits.\n * Enables \"Quantum If/Else\".\n */\nfunction muControl(reg, controlQubit, inverse, block) {\n // 1. Setup Context\n if (inverse) {\n muGate(reg, 'X', controlQubit); // Flip 0 to 1 to activate\n }\n exports.activeControls.push(controlQubit);\n try {\n block();\n }\n finally {\n exports.activeControls.pop();\n // Uncompute (Restore 0)\n if (inverse) {\n muGate(reg, 'X', controlQubit);\n }\n }\n}\nexports.muControl = muControl;\n/**\n * Quantum Switch: conditional Logic on Superposition\n * Executes different logic branches based on the state of control qubits.\n * Because the register can be in a superposition of states (e.g. |0> + |1>),\n * MULTIPLE branches can execute effectively simultaneously on different subspaces.\n *\n * @param reg Quantum Register\n * @param controlQubit The qubit controlling the switch (Single control for v1)\n * @param cases Object mapping state (0 or 1) to a function executing quantum operations\n */\nfunction muSwitch(reg, controlQubit, cases) {\n if (cases[0]) {\n muControl(reg, controlQubit, true, cases[0]);\n }\n if (cases[1]) {\n muControl(reg, controlQubit, false, cases[1]);\n }\n}\nexports.muSwitch = muSwitch;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(156);\n",""],"names":[],"ignoreList":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"mulan.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;ACVa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,uBAAuB,GAAG,mBAAmB;AAC7C,mBAAmB,mBAAO,CAAC,GAAY;AACvC,gBAAgB,mBAAO,CAAC,GAAS;AACjC,mBAAmB,mBAAO,CAAC,GAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4GAA4G,kBAAkB;AAC9H;AACA;AACA;AACA;AACA,qFAAqF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,WAAW,GAAG,sBAAsB;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,sBAAsB,cAAc,UAAU;AAC5F;AACA;AACA,8CAA8C,yBAAyB,kBAAkB,UAAU;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,GAAG;AACjC;AACA;AACA,wDAAwD,UAAU;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,UAAU;AACxF;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,iFAAiF,UAAU;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,GAAG;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,GAAG;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA,wBAAwB,oBAAoB;AAC5C;AACA;AACA,2BAA2B,0CAA0C;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,0BAA0B;AACtD;AACA;AACA;AACA;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,uCAAuC,0CAA0C;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,oBAAoB;AAChD;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,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA,oCAAoC,UAAU;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;;;;;;;ACvWV;AACb;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA,0CAA0C,4BAA4B;AACtE,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe,GAAG,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,iBAAiB,GAAG,mBAAmB;AACvH,aAAa,mBAAO,CAAC,GAAiB;AACtC,kBAAkB,mBAAO,CAAC,EAAkB;AAC5C,+CAA8C,EAAE,qCAAqC,mCAAmC,EAAC;AACzH,6CAA4C,EAAE,qCAAqC,mCAAmC,EAAC;AACvH,mDAAkD,EAAE,qCAAqC,uCAAuC,EAAC;AACjI,aAAa,mBAAO,CAAC,GAAiB;AACtC,cAAc,mBAAO,CAAC,GAAgB;AACtC,4CAA2C,EAAE,qCAAqC,4BAA4B,EAAC;AAC/G,0CAAyC,EAAE,qCAAqC,4BAA4B,EAAC;AAC7G,cAAc,mBAAO,CAAC,GAAe;AACrC,2CAA0C,EAAE,qCAAqC,2BAA2B,EAAC;AAC7G,aAAa,mBAAO,CAAC,GAAsB;AAC3C,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAAgB;AACrC,aAAa,mBAAO,CAAC,GAAc;AACnC,aAAa,mBAAO,CAAC,GAA2B;AAChD,aAAa,mBAAO,CAAC,GAA4B;AACjD,aAAa,mBAAO,CAAC,GAAY;AACjC;AACA,mBAAmB,mBAAO,CAAC,GAAiB;AAC5C,oBAAoB,mBAAO,CAAC,EAAkB;AAC9C,gBAAgB,mBAAO,CAAC,GAAgB;AACxC,gBAAgB,mBAAO,CAAC,GAAe;AACvC,oBAAoB,mBAAO,CAAC,GAAsB;AAClD,2BAA2B,mBAAO,CAAC,GAAc;AACjD,2BAA2B,mBAAO,CAAC,GAAc;AACjD,mBAAmB,mBAAO,CAAC,GAAiB;AAC5C,6BAA6B,mBAAO,CAAC,GAAgB;AACrD,2BAA2B,mBAAO,CAAC,GAAc;AACjD,kCAAkC,mBAAO,CAAC,GAA4B;AACtE,oGAAoG;AACpG,6QAA6Q,qDAAqD;AAClU;AACA;AACA,qCAAqC,IAAI,oBAAoB,mBAAmB,kBAAkB,kBAAkB,mBAAmB;AACvI,KAAK;AACL,sCAAsC,IAAI,oBAAoB,mBAAmB,kBAAkB,kBAAkB,mBAAmB;AACxI,KAAK;AACL,uCAAuC,IAAI,oBAAoB,mBAAmB,kBAAkB,kBAAkB,mBAAmB;AACzI,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;AC9FF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,sBAAsB,GAAG,kBAAkB,GAAG,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,0BAA0B,GAAG,0BAA0B;AACjb,mBAAmB,mBAAO,CAAC,GAAY;AACvC,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,qBAAqB;AAC3D;AACA,eAAe;AACf;AACA,8CAA8C,kBAAkB;AAChE;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,2BAA2B,sDAAsD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,6BAA6B,0BAA0B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,+EAA+E,cAAc,oCAAoC;AACjI;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,8CAA8C,gBAAgB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,kFAAkF;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,qBAAqB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C,4BAA4B,sBAAsB;AAClD;AACA;AACA,qBAAqB,oDAAoD;AACzE,uBAAuB;AACvB;AACA;AACA,iBAAiB;;;;;;;;AC1YJ;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe,GAAG,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,YAAY,4CAA4C;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD,uDAAuD;AACvD,mCAAmC,oBAAoB,SAAS;AAChE,iCAAiC,mCAAmC,mBAAmB,qBAAqB,IAAI;AAChH,yCAAyC,mBAAmB,gCAAgC,IAAI;AAChG,2BAA2B;AAC3B;AACA,0CAA0C,gCAAgC;AAC1E;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,oCAAoC;AAC5D;AACA,gCAAgC,yBAAyB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iCAAiC;AAClE;AACA,KAAK;AACL;AACA,eAAe;;;;;;;;AC3FF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB,gBAAgB,mBAAO,CAAC,GAAS;AACjC,mBAAmB,mBAAO,CAAC,GAAY;AACvC;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E,IAAI;AAC/E;AACA;AACA;AACA;AACA,6FAA6F,iBAAiB;AAC9G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,IAAI;AACnE;AACA,KAAK;AACL;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,kBAAkB;;;;;;;;AC5DL;AACb;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,WAAW,GAAG,gBAAgB,GAAG,cAAc,GAAG,cAAc,GAAG,gBAAgB,GAAG,mBAAmB;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;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,cAAc;AACd;AACA,4CAA4C;AAC5C;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,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA,iCAAiC;AACjC;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,SAAS;AACT;AACA;AACA;AACA,8FAA8F,aAAa;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;;;;;;;;ACtNE;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,4BAA4B,cAAc;AAC1C;AACA,mBAAmB,kBAAkB,gBAAgB;AACrD,uBAAuB,qBAAqB;AAC5C,0BAA0B,oBAAoB,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,YAAY;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,4BAA4B,YAAY,wBAAwB;AAChE,4BAA4B,aAAa,4BAA4B,MAAM;AAC3E,4CAA4C;AAC5C;AACA,6CAA6C,mBAAmB;AAChE;AACA,iBAAiB;AACjB;AACA,2CAA2C,iBAAiB,IAAI,iBAAiB,IAAI,QAAQ;AAC7F,SAAS;AACT;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;;;;;;;ACnHa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe;AACf,mBAAmB,mBAAO,CAAC,GAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,eAAe;;;;;;;;AC7CF;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB,GAAG,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,gCAAgC;AAChC,gCAAgC;AAChC,kCAAkC;AAClC,kCAAkC;AAClC;AACA;AACA;AACA,2CAA2C,MAAM;AACjD;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,UAAU;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA,oCAAoC,aAAa,YAAY,YAAY,WAAW,mBAAmB,gBAAgB;AACvH;AACA;AACA;AACA;AACA,yDAAyD,GAAG;AAC5D,mBAAmB,IAAI,KAAK,EAAE,IAAI,IAAI;AACtC;AACA,mBAAmB;AACnB,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,mBAAmB,mBAAO,CAAC,GAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,UAAU;AACjD;AACA;AACA;AACA;AACA;AACA,6DAA6D,UAAU;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;;;;;;;;AC3HN;AACb;AACA,4BAA4B,+DAA+D,iBAAiB;AAC5G;AACA,oCAAoC,MAAM,+BAA+B,YAAY;AACrF,mCAAmC,MAAM,mCAAmC,YAAY;AACxF,gCAAgC;AAChC;AACA,KAAK;AACL;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB,GAAG,gBAAgB;AACvC,mBAAmB,mBAAO,CAAC,GAAkB;AAC7C,oBAAoB,mBAAO,CAAC,GAAuB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,yCAAyC,UAAU;AACnD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,yBAAyB;AACzB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,MAAM;AAChE;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB,gBAAgB,SAAS,GAAG;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,kBAAkB,KAAK,KAAK;AAC5F;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,MAAM;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA,2EAA2E,aAAa;AACxF;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,KAAK;AACrE;AACA;AACA;AACA;AACA;AACA,qEAAqE,KAAK;AAC1E;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;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,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;;;;;;;;AC5Qa;AACb;AACA,4BAA4B,+DAA+D,iBAAiB;AAC5G;AACA,oCAAoC,MAAM,+BAA+B,YAAY;AACrF,mCAAmC,MAAM,mCAAmC,YAAY;AACxF,gCAAgC;AAChC;AACA,KAAK;AACL;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB,GAAG,gBAAgB;AACtC,mBAAmB,mBAAO,CAAC,GAAY;AACvC,uCAAuC,eAAe;AACtD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,qBAAqB,oBAAoB;AACzC,0BAA0B,yBAAyB;AACnD,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA,gBAAgB;AAChB;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,qBAAqB,oBAAoB;AACzC,0BAA0B,yBAAyB;AACnD,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA,mBAAmB;;;;;;;;AC7EN;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,4BAA4B;AAC5B,mBAAmB,mBAAO,CAAC,GAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,cAAc;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,EAAE;AAC1D;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,4BAA4B,iBAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;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,gCAAgC,IAAI,eAAe,MAAM;AACzD;AACA;AACA;AACA;AACA,iDAAiD,OAAO,eAAe,SAAS;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,KAAK;AAClC,8BAA8B,KAAK;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,YAAY,cAAc,WAAW;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wBAAwB;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,2BAA2B,UAAU,WAAW;AAChD,2BAA2B,aAAa,WAAW;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;;;;;;;;ACjQa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gBAAgB,GAAG,eAAe,GAAG,cAAc;AACnD;AACA;AACA;AACA;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,2DAA2D,UAAU;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,GAAG,MAAM,GAAG;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,SAAS;AACT;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,4BAA4B;AAC5B,4BAA4B;AAC5B,8BAA8B;AAC9B,8BAA8B;AAC9B;AACA,gBAAgB;;;;;;;;ACzHH;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,sBAAsB;AACtB;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,qBAAqB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,cAAc,IAAI,sBAAsB;AAC3G,2CAA2C,cAAc,IAAI,KAAK,EAAE,YAAY;AAChF;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;;;;;;;;ACjDT;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gBAAgB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,kBAAkB,GAAG,sBAAsB;AAC3N,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,kCAAkC;AAChF,6CAA6C,kCAAkC;AAC/E;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,YAAY,qBAAqB;AACxF;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,6BAA6B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,yCAAyC;AACzC;AACA;AACA,yCAAyC;AACzC,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,gDAAgD;AAChD;AACA,+BAA+B;AAC/B;AACA,yCAAyC;AACzC;AACA;AACA;AACA,mDAAmD,YAAY,qBAAqB;AACpF;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAW;AAC/B;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA,uCAAuC;AACvC,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,mDAAmD,YAAY,qBAAqB;AACpF;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;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;AACA;AACA;AACA;AACA;AACA,gBAAgB;;;;;;;UCzWhB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://Mulan/webpack/universalModuleDefinition","webpack://Mulan/./src/core/component.ts","webpack://Mulan/./src/index.ts","webpack://Mulan/./src/core/hooks.ts","webpack://Mulan/./src/core/surge.ts","webpack://Mulan/./src/core/vault.ts","webpack://Mulan/./src/core/reactive.ts","webpack://Mulan/./src/components/infinity-list.ts","webpack://Mulan/./src/store/index.ts","webpack://Mulan/./src/security/sanitizer.ts","webpack://Mulan/./src/router/index.ts","webpack://Mulan/./src/core/query.ts","webpack://Mulan/./src/components/bloch-sphere.ts","webpack://Mulan/./src/core/renderer.ts","webpack://Mulan/./src/core/ssr.ts","webpack://Mulan/./src/core/quantum.ts","webpack://Mulan/webpack/bootstrap","webpack://Mulan/webpack/before-startup","webpack://Mulan/webpack/startup","webpack://Mulan/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Mulan\"] = factory();\n\telse\n\t\troot[\"Mulan\"] = factory();\n})(this, () => {\nreturn ","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.defineComponent = exports.MuComponent = void 0;\nconst renderer_1 = require(\"./renderer\");\nconst hooks_1 = require(\"./hooks\");\nconst reactive_1 = require(\"./reactive\");\n// Or a simple component that returns an object of state/methods used by template? \n// For Mulan 2.0, let's say functional component returns a template string render function explicitly.\nclass MuComponent {\n constructor(container) {\n this._hooks = {};\n this._effects = [];\n this._domEffects = [];\n this._isDestroyed = false;\n this._isResuming = false; // Quantum Resumability Flag\n this._resumeRoot = null;\n this._propsQueue = [];\n this._eventQueue = [];\n // --- MulanJS List Reconciliation Engine (No-VDOM) ---\n // Cache to store generated DOM rows by mu-key\n this._listCaches = new Map();\n // --- MulanJS Conditional Engine (No-VDOM) ---\n // Cache to store conditionally toggled blocks\n this._ifCaches = new Map();\n this.container = container;\n this.state = {};\n this.$uid = 'mu_' + Math.random().toString(36).substr(2, 9);\n // MULAN INSIGHT: Quantum Resumability Detection\n if (typeof window !== 'undefined' && container) {\n const rootAttr = container.getAttribute('data-mu-root');\n const stateScript = container.querySelector('script[type=\"mulan/state\"]');\n if (rootAttr || stateScript) {\n console.log(`%c[Mulan Quantum]%c Resuming component from server state...`, \"color: #00ffcc; font-weight: bold;\", \"\");\n this._isResuming = true;\n this.$uid = rootAttr || this.$uid;\n if (stateScript) {\n try {\n const serverState = JSON.parse(stateScript.textContent || '{}');\n // Inject server state into this instance\n Object.assign(this, serverState);\n }\n catch (e) {\n console.error(\"[Mulan Quantum] Failed to parse server state:\", e);\n }\n }\n }\n }\n // MULAN INSIGHT: Global Registry for Debugging\n if (typeof window !== 'undefined') {\n const global = window;\n global.__MULAN_INSIGHT__ = global.__MULAN_INSIGHT__ || { components: new Map() };\n global.__MULAN_INSIGHT__.components.set(this.$uid, this);\n }\n // Setup context for hooks\n (0, hooks_1.setCurrentInstance)(this);\n this.setup();\n (0, hooks_1.setCurrentInstance)(null);\n }\n // Optional setup method for class components wanting to use hooks\n setup() { }\n onMount() {\n var _a, _c;\n // Mulan Cycle: Init\n (_a = this._hooks.onMuInit) === null || _a === void 0 ? void 0 : _a.forEach(fn => fn());\n // Mulan Cycle: Mount (Simulated immediately after init for now in this version)\n (_c = this._hooks.onMuMount) === null || _c === void 0 ? void 0 : _c.forEach(fn => fn());\n }\n onUpdate() { }\n onDestroy() {\n var _a, _c;\n if (this._isDestroyed)\n return;\n this._isDestroyed = true;\n console.log(`[Mulan Cycle] Destroying component ${this.$uid} (${this.constructor.name})`);\n // MULAN INSIGHT: Cleanup\n if (typeof window !== 'undefined') {\n const global = window;\n (_a = global.__MULAN_INSIGHT__) === null || _a === void 0 ? void 0 : _a.components.delete(this.$uid);\n }\n // Mulan Cycle: Stop all effects to prevent leaks\n console.log(`[Mulan Cycle] Stopping ${this._effects.length} effects for ${this.$uid}`);\n this._effects.forEach(stop => stop());\n this._effects = [];\n console.log(`[Mulan Cycle] Stopping ${this._domEffects.length} DOM effects for ${this.$uid}`);\n this._domEffects.forEach(stop => stop());\n this._domEffects = [];\n // Mulan Cycle: Destroy hooks\n (_c = this._hooks.onMuDestroy) === null || _c === void 0 ? void 0 : _c.forEach(fn => fn());\n }\n // Helper for compiler to register property bindings\n _b(id, prop, value) {\n this._propsQueue.push([id, prop, value]);\n return \"\";\n }\n // Helper for compiler to register event bindings\n _e(id, type, handler) {\n this._eventQueue.push([id, type, handler]);\n return \"\";\n }\n // Manual binding helper for template literals\n bind(handler, type = 'click') {\n const id = 'ev_' + Math.random().toString(36).substr(2, 9);\n this._e(id, type, handler);\n return `data-mu-id=\"${id}\"`;\n }\n mount() {\n console.log(`[Mulan Cycle] Mounting component ${this.$uid}`);\n if (this._isResuming) {\n // Quantum Resumability: Skip initial render, just attach effects to existing DOM\n console.log(`[Mulan Quantum] Skipping initial render, recovering DOM nodes...`);\n this._resume();\n }\n else {\n // Standard Hydration/Mount\n const stop = (0, reactive_1.effect)(() => {\n console.log(`[Mulan Reactivity] Triggering macro-update for ${this.$uid}`);\n this.update();\n });\n this._effects.push(stop);\n }\n this.onMount();\n }\n /**\n * Internal method to execute the resumability pass.\n * Overridden by compiler-generated code.\n */\n _resume() {\n // Clear queues\n this._propsQueue = [];\n this._eventQueue = [];\n // Call the template with resumption context\n // In a real implementation, the compiler will inject 'recovery' instructions\n this._recoveryMode = true;\n this.template();\n this._recoveryMode = false;\n // Flush bindings (events/props) to existing nodes\n this.flushProps();\n this.flushEvents();\n }\n // New helper for the compiler to register a fine-grained DOM property effect\n _bindEffect(fn, targetNode) {\n const stop = (0, reactive_1.effect)(fn, targetNode);\n this._domEffects.push(stop);\n return stop;\n }\n update() {\n if (this._isDestroyed) {\n console.warn(`[Mulan Warning] Update called on destroyed component ${this.$uid}. Blocking render.`);\n return;\n }\n // Clear queues before render\n this._propsQueue = [];\n this._eventQueue = [];\n const template = this.template();\n // Render HTML\n (0, renderer_1.render)(template, this.container);\n // Flush Side Effects\n this.flushProps();\n this.flushEvents();\n this.onUpdate();\n }\n flushProps() {\n for (const [id, prop, value] of this._propsQueue) {\n const el = this.container.querySelector(`[data-mu-id=\"${id}\"]`);\n if (el) {\n // @ts-ignore\n el[prop] = value;\n }\n }\n this._propsQueue = [];\n }\n flushEvents() {\n for (const [id, type, handler] of this._eventQueue) {\n const el = this.container.querySelector(`[data-mu-id=\"${id}\"]`);\n if (el) {\n // Bind handler to this component instance to ensure 'this' works in methods\n el.addEventListener(type, handler.bind(this));\n }\n }\n this._eventQueue = [];\n }\n /**\n * Reconciles a list of bound data to an existing DOM parent segment.\n * @param listId Unique ID for this specific mu-for directive Block\n * @param container The DOM Element or Fragment where children are attached\n * @param array The current state array\n * @param keyProp The property to extract from each item to use as a unique key (e.g. 'id')\n * @param renderRow A function that takes an item and returns a new { fragment, effects }\n */\n _reconcileList(listId, anchorToken, array, keyProp, renderRow) {\n if (!this._listCaches.has(listId)) {\n this._listCaches.set(listId, new Map());\n }\n const cache = this._listCaches.get(listId);\n const newKeys = new Set();\n const parent = anchorToken.parentNode;\n if (!parent)\n return;\n // 1. Array Iteration: Match against cache or Create\n // Use a DocumentFragment to batch new node insertions natively\n const collectorFrag = document.createDocumentFragment();\n const newOrderNodes = [];\n const newOrderKeys = [];\n let requiresSwap = false;\n let lastCachedIndex = -1;\n for (let i = 0; i < array.length; i++) {\n const item = array[i];\n const key = keyProp ? item[keyProp] : i; // fallback to index if no key\n newKeys.add(key);\n newOrderKeys.push(key);\n let cached = cache.get(key);\n if (!cached) {\n // Not in cache, Render a brand new row structure\n const { fragment, effects } = renderRow(item, i);\n // Track actual DOM nodes\n const createdNodes = Array.from(fragment.childNodes);\n cached = { nodes: createdNodes, effects, index: i }; // Store index for fast swap detection\n cache.set(key, cached);\n // Batch append to our in-memory fragment!\n // This eliminates thousands of live DOM reflows on creation.\n collectorFrag.appendChild(fragment);\n newOrderNodes.push(...createdNodes);\n }\n else {\n // Exists in cache\n // Batch append to the in-memory array for index tracking\n newOrderNodes.push(...cached.nodes);\n // Fast-Path Swap Detection: If the cached index is physically out of numerical sequence,\n // we know the array order was unsynchronized and needs reconciliation.\n if (cached.index < lastCachedIndex) {\n requiresSwap = true;\n }\n cached.index = i;\n lastCachedIndex = i;\n }\n }\n // 2. Fragment Batch Insertion (O(1) Live DOM Reflow for Creations)\n if (collectorFrag.childNodes.length > 0) {\n parent.insertBefore(collectorFrag, anchorToken.nextSibling);\n }\n // 3. Bidirectional Swap Sync (O(K) isolated shifts instead of O(N) cascades)\n if (requiresSwap) {\n let currentSibling = anchorToken.nextSibling;\n // We iterate through our guaranteed physical newOrderNodes list\n for (let j = 0; j < newOrderNodes.length; j++) {\n const targetNode = newOrderNodes[j];\n if (targetNode !== currentSibling) {\n // The physical live DOM is out of sync. Move targetNode to where it belongs immediately.\n parent.insertBefore(targetNode, currentSibling);\n }\n else {\n // Node is correctly positioned, simply advance the sliding logical pointer\n currentSibling = currentSibling.nextSibling;\n }\n }\n }\n // 4. Cleanup Phase: Rapidly detach unmounted nodes\n if (cache.size > newKeys.size) {\n for (const [key, cached] of cache.entries()) {\n if (!newKeys.has(key)) {\n // Remove from DOM\n cached.nodes.forEach((node) => {\n if (node.parentNode === parent) {\n parent.removeChild(node);\n }\n });\n // Stop any targeted effects tied to these nodes\n cached.effects.forEach((stop) => stop());\n // Delete from cache tracking\n cache.delete(key);\n }\n }\n }\n }\n /**\n * Reconciles a conditional block (mu-if) to an existing DOM parent segment.\n */\n _reconcileIf(ifId, anchorToken, condition, renderBlock) {\n if (!this._ifCaches.has(ifId)) {\n this._ifCaches.set(ifId, { isMounted: false, nodes: [], effects: [] });\n }\n let cached = this._ifCaches.get(ifId);\n if (condition) {\n // Should be mounted\n if (!cached.isMounted) {\n // We need to render and mount it\n let nodesToMount;\n if (cached.nodes.length === 0) {\n // First time render\n const { fragment, effects } = renderBlock();\n nodesToMount = Array.from(fragment.childNodes);\n cached.nodes = nodesToMount;\n cached.effects = effects;\n }\n else {\n // Re-mounting previously cached nodes\n nodesToMount = cached.nodes;\n }\n cached.isMounted = true;\n const parent = anchorToken.parentNode;\n if (!parent)\n return;\n const targetSibling = anchorToken.nextSibling;\n nodesToMount.forEach(node => {\n parent.insertBefore(node, targetSibling);\n });\n }\n }\n else {\n // Should NOT be mounted\n if (cached.isMounted) {\n // Unmount nodes but keep them in cache\n cached.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n cached.isMounted = false;\n // Note: We deliberately do NOT destroy the effects here, they stay active in memory!\n }\n }\n }\n}\nexports.MuComponent = MuComponent;\n// Helper to create functional components wrapped in the class system\n// Helper to create functional components wrapped in the class system\n// Supports both () => render and { setup() } signatures\nfunction defineComponent(optionsOrSetup) {\n return class UniversalComponent extends MuComponent {\n constructor(container) {\n super(container);\n // setup() is called by super constructor\n }\n setup() {\n let setupResult;\n if (typeof optionsOrSetup === 'function') {\n // It's a setup function returning render fn\n setupResult = optionsOrSetup.call(this);\n }\n else if (typeof optionsOrSetup === 'object' && optionsOrSetup.setup) {\n // It's an options object with setup()\n setupResult = optionsOrSetup.setup.call(this);\n }\n // Handle result\n if (typeof setupResult === 'function') {\n // It's a render function\n this.template = setupResult;\n }\n else if (setupResult && typeof setupResult === 'object') {\n // It's bindings\n Object.assign(this, setupResult);\n // We assume template is assigned to prototype by compiler\n }\n }\n template() {\n return '';\n }\n };\n}\nexports.defineComponent = defineComponent;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuStore = exports.Router = exports.MuRouter = exports.defineComponent = exports.Component = exports.MuComponent = void 0;\n__exportStar(require(\"./core/reactive\"), exports);\nvar component_1 = require(\"./core/component\");\nObject.defineProperty(exports, \"MuComponent\", { enumerable: true, get: function () { return component_1.MuComponent; } });\nObject.defineProperty(exports, \"Component\", { enumerable: true, get: function () { return component_1.MuComponent; } });\nObject.defineProperty(exports, \"defineComponent\", { enumerable: true, get: function () { return component_1.defineComponent; } });\n__exportStar(require(\"./core/renderer\"), exports);\nvar index_1 = require(\"./router/index\");\nObject.defineProperty(exports, \"MuRouter\", { enumerable: true, get: function () { return index_1.MuRouter; } });\nObject.defineProperty(exports, \"Router\", { enumerable: true, get: function () { return index_1.MuRouter; } });\nvar index_2 = require(\"./store/index\");\nObject.defineProperty(exports, \"MuStore\", { enumerable: true, get: function () { return index_2.MuStore; } });\n__exportStar(require(\"./security/sanitizer\"), exports);\n__exportStar(require(\"./core/hooks\"), exports);\n__exportStar(require(\"./core/query\"), exports);\n__exportStar(require(\"./core/vault\"), exports);\n__exportStar(require(\"./core/quantum\"), exports);\n__exportStar(require(\"./core/surge\"), exports);\n__exportStar(require(\"./components/bloch-sphere\"), exports);\n__exportStar(require(\"./components/infinity-list\"), exports);\n__exportStar(require(\"./core/ssr\"), exports);\n// Global Mulan Object for non-module usage\nconst reactive_1 = require(\"./core/reactive\");\nconst component_2 = require(\"./core/component\");\nconst index_3 = require(\"./router/index\");\nconst index_4 = require(\"./store/index\");\nconst sanitizer_1 = require(\"./security/sanitizer\");\nconst Hooks = __importStar(require(\"./core/hooks\"));\nconst Query = __importStar(require(\"./core/query\"));\nconst renderer_1 = require(\"./core/renderer\");\nconst Quantum = __importStar(require(\"./core/quantum\"));\nconst Surge = __importStar(require(\"./core/surge\"));\nconst InfinityList = __importStar(require(\"./components/infinity-list\"));\nconst Mulan = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ reactive: reactive_1.reactive,\n effect: reactive_1.effect, Component: component_2.MuComponent, defineComponent: component_2.defineComponent, Router: index_3.MuRouter, createRouter: index_3.createRouter, Store: index_4.MuStore, SecureStore: sanitizer_1.SecureStore, Security: sanitizer_1.Security }, Hooks), Query), Quantum), Surge), InfinityList), { render: renderer_1.render, \n // MULAN INSIGHT: Branded Logging\n log: (msg, ...args) => {\n console.log(`%c[MulanJS]%c ${msg}`, \"color: #ff3e00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;\", \"\", ...args);\n }, warn: (msg, ...args) => {\n console.warn(`%c[MulanJS]%c ${msg}`, \"color: #ffcc00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;\", \"\", ...args);\n }, error: (msg, ...args) => {\n console.error(`%c[MulanJS]%c ${msg}`, \"color: #ff0000; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;\", \"\", ...args);\n } });\n// Security: Freeze the object to prevent runtime tampering\nObject.freeze(Mulan);\nObject.freeze(Mulan.Security);\n// MULAN INSIGHT: Initialize Global Registry\nif (typeof window !== 'undefined') {\n window.__MULAN_INSIGHT__ = window.__MULAN_INSIGHT__ || { components: new Map() };\n // MULAN INSIGHT: HMR Support\n window.__MULAN_REFRESH__ = () => {\n var _a;\n const components = (_a = window.__MULAN_INSIGHT__) === null || _a === void 0 ? void 0 : _a.components;\n if (components) {\n components.forEach((comp) => {\n if (comp && typeof comp.update === 'function') {\n // Force refresh\n comp.update();\n }\n });\n }\n };\n}\nif (typeof window !== 'undefined') {\n window.Mulan = Mulan;\n}\nexports.default = Mulan;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.muHistory = exports.onMuPanic = exports.muThrottled = exports.muDebounced = exports.onMuVisibility = exports.muSuspense = exports.muVault = exports.muPulse = exports.muGeom = exports.onMuVoice = exports.onMuShake = exports.onMuResume = exports.onMuIdle = exports.onMuDestroy = exports.onMuMount = exports.onMuInit = exports.muEffect = exports.muMemo = exports.muState = exports.getCurrentInstance = exports.setCurrentInstance = void 0;\nconst reactive_1 = require(\"./reactive\");\nconst vault_1 = require(\"./vault\");\n// Global context to track the current component instance\nlet currentInstance = null;\nfunction setCurrentInstance(instance) {\n currentInstance = instance;\n}\nexports.setCurrentInstance = setCurrentInstance;\nfunction getCurrentInstance() {\n return currentInstance;\n}\nexports.getCurrentInstance = getCurrentInstance;\n// --- Mulan Unique Reactivity Hooks ---\nfunction muState(initialValue) {\n if (typeof initialValue === 'object' && initialValue !== null) {\n return (0, reactive_1.reactive)(initialValue);\n }\n // Core reactive state container for primitives\n return (0, reactive_1.reactive)({ value: initialValue });\n}\nexports.muState = muState;\nfunction muMemo(computeFn) {\n const signal = (0, reactive_1.reactive)({ value: undefined });\n const stop = (0, reactive_1.effect)(() => {\n signal.value = computeFn();\n });\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._effects)\n instance._effects = [];\n instance._effects.push(stop);\n }\n return signal;\n}\nexports.muMemo = muMemo;\nfunction muEffect(fn) {\n const stop = (0, reactive_1.effect)(fn);\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._effects)\n instance._effects = [];\n instance._effects.push(stop);\n }\n}\nexports.muEffect = muEffect;\n// --- The \"Mulan Cycle\" (Lifecycle) ---\nfunction onMuInit(fn) {\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._hooks)\n instance._hooks = {};\n if (!instance._hooks.onMuInit)\n instance._hooks.onMuInit = [];\n instance._hooks.onMuInit.push(fn);\n }\n else {\n console.warn('onMuInit called outside of component setup context.');\n }\n}\nexports.onMuInit = onMuInit;\nfunction onMuMount(fn) {\n // New hook for when component is actually in DOM (simulated for now via update)\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._hooks)\n instance._hooks = {};\n if (!instance._hooks.onMuMount)\n instance._hooks.onMuMount = [];\n instance._hooks.onMuMount.push(fn);\n }\n}\nexports.onMuMount = onMuMount;\nfunction onMuDestroy(fn) {\n const instance = getCurrentInstance();\n if (instance) {\n if (!instance._hooks)\n instance._hooks = {};\n if (!instance._hooks.onMuDestroy)\n instance._hooks.onMuDestroy = [];\n instance._hooks.onMuDestroy.push(fn);\n }\n}\nexports.onMuDestroy = onMuDestroy;\n/**\n * onMuIdle - The \"Environment Life\" Hook.\n * Executes heavy logic ONLY when the browser is taking a nap (idle).\n */\nfunction onMuIdle(fn) {\n const instance = getCurrentInstance();\n // Polyfill for Safari/Old Browsers\n const requestIdleCallback = window.requestIdleCallback || function (cb) {\n return setTimeout(() => {\n cb({\n didTimeout: false,\n timeRemaining: function () { return 50; }\n });\n }, 1);\n };\n const cancelIdleCallback = window.cancelIdleCallback || function (id) {\n clearTimeout(id);\n };\n const idleId = requestIdleCallback(() => {\n fn();\n });\n // Auto-cleanup if component dies before idle time\n if (instance) {\n onMuDestroy(() => {\n cancelIdleCallback(idleId);\n });\n }\n}\nexports.onMuIdle = onMuIdle;\n/**\n * onMuResume - The \"Tab Life\" Hook.\n * Executes when the user switches BACK to this tab.\n * Perfect for refreshing data or resuming animations to save battery.\n */\nfunction onMuResume(fn) {\n const handler = () => {\n if (document.visibilityState === 'visible') {\n fn();\n }\n };\n document.addEventListener('visibilitychange', handler);\n onMuDestroy(() => document.removeEventListener('visibilitychange', handler));\n}\nexports.onMuResume = onMuResume;\n/**\n * onMuShake - The \"Physical Life\" Hook.\n * Executes when the device is shaken.\n * Usage: Undo, Refresh, or \"Rage Quit\" easter eggs.\n */\nfunction onMuShake(fn) {\n // Threshold for shake detection\n const threshold = 15;\n let lastX = 0, lastY = 0, lastZ = 0;\n let lastTime = 0;\n const handler = (e) => {\n const current = e.accelerationIncludingGravity;\n if (!current)\n return;\n const time = Date.now();\n if ((time - lastTime) > 100) {\n const diffTime = time - lastTime;\n lastTime = time;\n const x = current.x || 0;\n const y = current.y || 0;\n const z = current.z || 0;\n const speed = Math.abs(x + y + z - lastX - lastY - lastZ) / diffTime * 10000;\n if (speed > threshold) {\n fn();\n }\n lastX = x;\n lastY = y;\n lastZ = z;\n }\n };\n if (window.DeviceMotionEvent) {\n window.addEventListener('devicemotion', handler);\n onMuDestroy(() => window.removeEventListener('devicemotion', handler));\n }\n else {\n console.warn(\"[MulanJS] Device Motion not supported on this device.\");\n }\n}\nexports.onMuShake = onMuShake;\n/**\n * onMuVoice - The \"Sound Life\" Hook.\n * Executes when a specific word is spoken.\n * @param command The word to listen for (e.g., \"save\", \"next\")\n * @param fn The action to take\n */\nfunction onMuVoice(command, fn) {\n const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\n if (!SpeechRecognition) {\n console.warn(\"[MulanJS] Voice Control (Web Speech API) not supported in this browser.\");\n return;\n }\n const recognition = new SpeechRecognition();\n recognition.continuous = true;\n recognition.lang = 'en-US';\n recognition.interimResults = false;\n recognition.onresult = (event) => {\n const last = event.results.length - 1;\n const spoken = event.results[last][0].transcript.trim().toLowerCase();\n console.log(`[Mulan Voice] Heard: \"${spoken}\"`);\n if (spoken.includes(command.toLowerCase())) {\n fn();\n }\n };\n recognition.start();\n // Auto-restart if it stops (Continuous listening)\n recognition.onend = () => {\n // Simple check to see if we should still be listening\n // In a real app we might want more control\n // recognition.start(); \n };\n onMuDestroy(() => {\n recognition.stop();\n });\n}\nexports.onMuVoice = onMuVoice;\n// --- \"Outside The Box\" Hooks (Mulan Exclusives) ---\n/**\n * muGeom - Tracks window or element dimensions reactively.\n */\nfunction muGeom() {\n const dims = muState({ width: window.innerWidth, height: window.innerHeight });\n const handler = () => {\n dims.width = window.innerWidth;\n dims.height = window.innerHeight;\n };\n window.addEventListener('resize', handler);\n // Auto-cleanup\n onMuDestroy(() => {\n window.removeEventListener('resize', handler);\n });\n return dims;\n}\nexports.muGeom = muGeom;\n/**\n * muPulse - Reactive network status.\n */\nfunction muPulse() {\n const status = muState({ online: navigator.onLine });\n const setOnline = () => status.online = true;\n const setOffline = () => status.online = false;\n window.addEventListener('online', setOnline);\n window.addEventListener('offline', setOffline);\n onMuDestroy(() => {\n window.removeEventListener('online', setOnline);\n window.removeEventListener('offline', setOffline);\n });\n return status;\n}\nexports.muPulse = muPulse;\n/**\n * muVault - Secure reactive LocalStorage wrapper.\n * Powered by the Iron Fortress persistent primitive.\n */\nfunction muVault(key, initial, options = {}) {\n return (0, vault_1.persistent)(key, initial, Object.assign(Object.assign({}, options), { onCleanup: (fn) => onMuDestroy(fn) }));\n}\nexports.muVault = muVault;\n// --- Next-Gen MulanJS Hooks ---\n/**\n * muSuspense - The Asynchronous Barrier.\n * Natively handles async state (loading/data/error) without wrapper components.\n */\nfunction muSuspense(promiseFn) {\n const state = muState({\n loading: true,\n data: null,\n error: null\n });\n // Execute immediately safely\n promiseFn()\n .then(res => {\n state.data = res;\n state.loading = false;\n })\n .catch(err => {\n state.error = err;\n state.loading = false;\n });\n return state;\n}\nexports.muSuspense = muSuspense;\n/**\n * onMuVisibility - The Intersection Observer Hook.\n * Triggers when the component enters/leaves the viewport.\n */\nfunction onMuVisibility(callback, options = { threshold: 0.1 }) {\n const instance = getCurrentInstance();\n // We defer observation to mount phase to ensure DOM exists\n onMuMount(() => {\n if (!instance || !instance.container)\n return;\n const observer = new IntersectionObserver((entries) => {\n entries.forEach(entry => {\n callback(entry.isIntersecting);\n });\n }, options);\n observer.observe(instance.container);\n onMuDestroy(() => {\n observer.disconnect();\n });\n });\n}\nexports.onMuVisibility = onMuVisibility;\n/**\n * muDebounced - High-performance debouncing built directly into a reactive signal.\n */\nfunction muDebounced(initialValue, delayMs) {\n const state = muState(initialValue);\n let timeoutId;\n return {\n get value() {\n return state.value;\n },\n set value(newVal) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n state.value = newVal;\n }, delayMs);\n }\n };\n}\nexports.muDebounced = muDebounced;\n/**\n * muThrottled - High-performance throttling built directly into a reactive signal.\n */\nfunction muThrottled(initialValue, delayMs) {\n const state = muState(initialValue);\n let lastRan = 0;\n return {\n get value() {\n return state.value;\n },\n set value(newVal) {\n const now = Date.now();\n if (now - lastRan >= delayMs) {\n state.value = newVal;\n lastRan = now;\n }\n }\n };\n}\nexports.muThrottled = muThrottled;\n/**\n * onMuPanic - The Iron Fortress Error Boundary.\n * Catches unhandled exceptions within the component scope.\n */\nfunction onMuPanic(fallbackFn) {\n const instance = getCurrentInstance();\n const handler = (event) => {\n // Broad catch - in a full implementation, we'd inspect the stack trace \n // to isolate if it originated from `instance` specifically.\n // For Mulan 2.0 MVP, we execute the fallback.\n const error = event instanceof ErrorEvent ? event.error : event.reason;\n console.error(`[Iron Fortress] Component ${(instance === null || instance === void 0 ? void 0 : instance.$uid) || 'Unknown'} Panic:`, error);\n fallbackFn(error);\n // Prevent default browser crash if handled\n event.preventDefault();\n };\n window.addEventListener('error', handler);\n window.addEventListener('unhandledrejection', handler);\n onMuDestroy(() => {\n window.removeEventListener('error', handler);\n window.removeEventListener('unhandledrejection', handler);\n });\n}\nexports.onMuPanic = onMuPanic;\n/**\n * muHistory - State with built-in Undo/Redo tracking.\n */\nfunction muHistory(initialValue) {\n const state = muState(initialValue);\n // Explicit wrapper object because muState treats bare arrays dynamically\n const historyTracker = muState({ log: [initialValue] });\n const pointer = muState(0);\n const updateValue = (newVal) => {\n // If we are back in history and make a NEW change, we drop the 'future'\n if (pointer.value < historyTracker.log.length - 1) {\n historyTracker.log = historyTracker.log.slice(0, pointer.value + 1);\n }\n historyTracker.log.push(newVal);\n pointer.value = historyTracker.log.length - 1;\n state.value = newVal;\n };\n const undo = () => {\n if (pointer.value > 0) {\n pointer.value--;\n state.value = historyTracker.log[pointer.value];\n }\n };\n const redo = () => {\n if (pointer.value < historyTracker.log.length - 1) {\n pointer.value++;\n state.value = historyTracker.log[pointer.value];\n }\n };\n return {\n get value() { return state.value; },\n set value(newVal) { updateValue(newVal); },\n undo,\n redo,\n get past() { return historyTracker.log.slice(0, pointer.value); },\n get future() { return historyTracker.log.slice(pointer.value + 1); }\n };\n}\nexports.muHistory = muHistory;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.muSurge = exports.muBurst = void 0;\n/**\n * muBurst - Adaptive Non-blocking Iterator\n * Processes large arrays in batches within a frame budget (typically 8-16ms)\n * to keep the UI responsive while executing at near-native loop speeds.\n */\nfunction muBurst(array, callback, options = {}) {\n const { chunkSize = 1000, timeout = 8, onProgress } = options;\n return new Promise((resolve) => {\n let index = 0;\n const total = array.length;\n function process() {\n const start = performance.now();\n // Tight loop for high-speed processing\n while (index < total && (performance.now() - start) < timeout) {\n // Process in smaller bursts to allow more frequent time checks if needed\n const endBurst = Math.min(index + chunkSize, total);\n for (; index < endBurst; index++) {\n callback(array[index], index);\n }\n }\n if (onProgress) {\n onProgress((index / total) * 100);\n }\n if (index < total) {\n requestAnimationFrame(process);\n }\n else {\n resolve();\n }\n }\n process();\n });\n}\nexports.muBurst = muBurst;\n/**\n * muSurge - Truly Parallel Execution\n * Distributes work across CPU cores using Web Workers.\n * Logic must be serializable.\n */\nfunction muSurge(array, taskFn, onProgress) {\n const n = navigator.hardwareConcurrency || 4;\n const chunkSize = Math.ceil(array.length / n);\n const results = new Array(array.length);\n let completedChunks = 0;\n let completedItems = 0;\n // Convert function to string if it isn't already\n const fnStr = typeof taskFn === 'function' ? taskFn.toString() : taskFn;\n const workerPart1 = `const taskFn = ${fnStr};`;\n const workerPart2 = `self.onmessage = function(e) {`;\n const workerPart3 = ` const { chunk, startIndex } = e.data;`;\n const workerPart4 = ` try { const results = chunk.map(taskFn); self.postMessage({ results, startIndex }); }`;\n const workerPart5 = ` catch (err) { self.postMessage({ error: err.message, startIndex }); }`;\n const workerPart6 = `};`;\n const workerCode = [workerPart1, workerPart2, workerPart3, workerPart4, workerPart5, workerPart6].join('\\n');\n const blob = new Blob([workerCode], { type: 'application/javascript' });\n const workerUrl = URL.createObjectURL(blob);\n return new Promise((resolve) => {\n if (array.length === 0)\n return resolve([]);\n for (let i = 0; i < n; i++) {\n const start = i * chunkSize;\n const end = Math.min(start + chunkSize, array.length);\n if (start >= end) {\n completedChunks++;\n continue;\n }\n const chunk = array.slice(start, end);\n const worker = new Worker(workerUrl);\n worker.onmessage = (e) => {\n const { results: chunkResults, startIndex } = e.data;\n // Merge results back into main array\n for (let j = 0; j < chunkResults.length; j++) {\n results[startIndex + j] = chunkResults[j];\n }\n completedChunks++;\n completedItems += chunkResults.length;\n if (onProgress)\n onProgress((completedItems / array.length) * 100);\n worker.terminate();\n if (completedChunks === n) {\n URL.revokeObjectURL(workerUrl);\n resolve(results);\n }\n };\n worker.postMessage({ chunk, startIndex: start, fnStr });\n }\n });\n}\nexports.muSurge = muSurge;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.persistent = void 0;\nconst hooks_1 = require(\"./hooks\");\nconst reactive_1 = require(\"./reactive\");\n/**\n * Mulan Vault: The World's First Native Persistent State Primitive.\n */\nfunction persistent(key, initialValue, options = {}) {\n const storage = options.storage || window.localStorage;\n // 1. Load from Storage\n const stored = storage.getItem(key);\n let startVal = initialValue;\n if (stored) {\n try {\n startVal = JSON.parse(stored);\n }\n catch (e) {\n console.warn(`[Mulan Vault] Corrupt persistent data for key \"${key}\", resetting.`);\n }\n }\n // 2. Create Reactive State (Follow muState pattern for consistency)\n const isObject = typeof startVal === 'object' && startVal !== null;\n const state = isObject ? (0, reactive_1.reactive)(startVal) : (0, reactive_1.reactive)({ value: startVal });\n // 3. Auto-Save on Change\n (0, hooks_1.muEffect)(() => {\n try {\n const payload = isObject ? state : state.value;\n const toSave = JSON.stringify(payload);\n // Non-obfuscated persistence to satisfy security audits\n storage.setItem(key, toSave);\n }\n catch (e) {\n console.error(`[Mulan Vault] Failed to save key \"${key}\"`);\n }\n });\n // 4. Sync across Tabs\n const sync = (e) => {\n if (e.key === key && e.newValue) {\n try {\n const newVal = JSON.parse(e.newValue);\n if (isObject) {\n Object.assign(state, newVal);\n }\n else {\n state.value = newVal;\n }\n }\n catch (e) { }\n }\n };\n window.addEventListener('storage', sync);\n // Explicit cleanup if provided by the environment (e.g. Mulan Hooks)\n if (options.onCleanup) {\n options.onCleanup(() => {\n window.removeEventListener('storage', sync);\n });\n }\n return state;\n}\nexports.persistent = persistent;\n","\"use strict\";\n// MulanJS 2.0: Signal-Powered Reactivity Engine\n// \"Compatible Surface, World-Class Engine\"\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ref = exports.reactive = exports.effect = exports.Signal = exports.nextTick = exports.queueEffect = void 0;\nlet activeEffect = null;\nlet activeEffectRunner = null;\nconst targetMap = new WeakMap();\n// --- Mulan Quantum Scheduler (Time-Slicing) ---\n// Assign unique IDs to effects for basic topological sorting (lower IDs run first)\nlet effectIdCounter = 0;\nconst pendingEffects = new Set();\nlet isScheduling = false;\nconst TIME_BUDGET = 8; // 8ms frame budget for 60FPS lock\nfunction runScheduler() {\n if (pendingEffects.size === 0) {\n isScheduling = false;\n return;\n }\n const start = typeof performance !== 'undefined' ? performance.now() : Date.now();\n // Convert to array and sort to ensure parent effects run before children (Topological Push-Pull approximation)\n const sortedEffects = Array.from(pendingEffects).sort((a, b) => {\n return (a._id || 0) - (b._id || 0);\n });\n for (const fn of sortedEffects) {\n pendingEffects.delete(fn);\n fn();\n const now = typeof performance !== 'undefined' ? performance.now() : Date.now();\n if (now - start > TIME_BUDGET) {\n break; // Yield to browser\n }\n }\n if (pendingEffects.size > 0) {\n if (typeof MessageChannel !== 'undefined') {\n const channel = new MessageChannel();\n channel.port1.onmessage = runScheduler;\n channel.port2.postMessage(null);\n }\n else {\n setTimeout(runScheduler, 0);\n }\n }\n else {\n isScheduling = false;\n }\n}\nfunction queueEffect(fn) {\n pendingEffects.add(fn);\n if (!isScheduling) {\n isScheduling = true;\n if (typeof Promise !== 'undefined') {\n Promise.resolve().then(runScheduler);\n }\n else {\n setTimeout(runScheduler, 0);\n }\n }\n}\nexports.queueEffect = queueEffect;\nfunction nextTick() {\n return Promise.resolve();\n}\nexports.nextTick = nextTick;\n// --- Signal Core (The Engine) ---\nclass Signal {\n constructor(initialValue) {\n this._subscribers = new Set();\n this._value = initialValue;\n }\n get value() {\n if (activeEffectRunner) {\n this._subscribers.add(activeEffectRunner.run);\n }\n return this._value;\n }\n set value(newValue) {\n if (newValue !== this._value) {\n this._value = newValue;\n this.notify();\n }\n }\n notify() {\n this._subscribers.forEach(fn => {\n if (fn._sync) {\n fn();\n }\n else {\n queueEffect(fn);\n }\n });\n }\n}\nexports.Signal = Signal;\n// --- Compatibility Layer (The Surface) ---\nfunction effect(fn, targetNode, options = {}) {\n let stopped = false;\n const id = ++effectIdCounter;\n const run = () => {\n if (stopped)\n return;\n const prevRunner = activeEffectRunner;\n activeEffectRunner = { run, node: targetNode, id };\n try {\n fn();\n }\n finally {\n activeEffectRunner = prevRunner;\n }\n };\n // Attach ID for topological sorting\n run._id = id;\n run._sync = options.sync;\n run();\n return () => {\n stopped = true;\n pendingEffects.delete(run);\n };\n}\nexports.effect = effect;\nfunction track(target, key) {\n if (activeEffectRunner) {\n let depsMap = targetMap.get(target);\n if (!depsMap) {\n targetMap.set(target, (depsMap = new Map()));\n }\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, (dep = new Set()));\n }\n dep.add(activeEffectRunner.run);\n }\n}\nfunction trigger(target, key) {\n const depsMap = targetMap.get(target);\n if (!depsMap)\n return;\n const dep = depsMap.get(key);\n if (dep) {\n dep.forEach((fn) => {\n if (fn._sync) {\n fn(); // Run synchronously if explicitly requested (e.g. for muMemo)\n }\n else {\n queueEffect(fn); // Push to Quantum Scheduler\n }\n });\n }\n}\n// Array mutating methods that must trigger reactive updates\nconst ARRAY_MUTATION_METHODS = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse', 'fill'];\n// Proxy cache: ensures the same object always returns the same Proxy\n// This is CRITICAL for array reactivity — mu-for and array mutations must\n// share the same Proxy instance, otherwise triggers reach different subscribers.\nconst proxyCache = new WeakMap();\n/**\n * Creates a reactive proxy object (Vue-compatible).\n * Intercepts array mutation methods to trigger reactive updates,\n * since methods like push() bypass the Proxy 'set' trap.\n */\nfunction reactive(target) {\n // Return cached proxy if it already exists for this target\n if (proxyCache.has(target)) {\n return proxyCache.get(target);\n }\n const proxy = new Proxy(target, {\n get(obj, prop, receiver) {\n // IRON FORTRESS: Prototype Pollution Protection (Read)\n if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {\n return undefined;\n }\n track(obj, prop);\n const val = Reflect.get(obj, prop, receiver);\n // Intercept array mutation methods to trigger length + index updates\n if (Array.isArray(obj) && typeof prop === 'string' && ARRAY_MUTATION_METHODS.includes(prop)) {\n return function (...args) {\n const result = val.apply(obj, args);\n // Trigger on 'length' — this is what mu-for subscribes to\n trigger(obj, 'length');\n // Also trigger on the array itself for any parent effects\n trigger(obj, prop);\n return result;\n };\n }\n if (val !== null && typeof val === 'object') {\n return reactive(val);\n }\n return val;\n },\n set(obj, prop, value, receiver) {\n // IRON FORTRESS: Prototype Pollution Protection\n if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {\n console.warn(`[Iron Fortress] Blocked attempt to modify dangerous property: ${String(prop)}`);\n return false;\n }\n const result = Reflect.set(obj, prop, value, receiver);\n trigger(obj, prop);\n // If array length changed (e.g. index assignment), also trigger length\n if (Array.isArray(obj) && prop !== 'length') {\n trigger(obj, 'length');\n }\n return result;\n },\n });\n proxyCache.set(target, proxy);\n return proxy;\n}\nexports.reactive = reactive;\n/**\n * Creates a standalone reactive reference.\n * Backed by the Mulan Signal Engine.\n */\nfunction ref(value) {\n return new Signal(value);\n}\nexports.ref = ref;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuInfinity = void 0;\nconst MuInfinityBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {\n};\nclass MuInfinity extends MuInfinityBase {\n constructor() {\n super();\n this._items = [];\n this._itemHeight = 50; // Default height\n this._template = '';\n this.attachShadow({ mode: 'open' });\n // Structure:\n // :host { overflow-y: auto; display: block; height: 100%; }\n // .spacer { height: totalHeight; position: relative; }\n // .content { position: absolute; top: padding; width: 100%; }\n this.shadowRoot.innerHTML = `\r\n <style>\r\n :host {\r\n display: block;\r\n overflow-y: auto;\r\n height: 100%;\r\n position: relative;\r\n }\r\n .spacer {\r\n position: relative;\r\n width: 100%;\r\n }\r\n .content {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n }\r\n </style>\r\n <div class=\"spacer\">\r\n <div class=\"content\"></div>\r\n </div>\r\n `;\n this.container = this.shadowRoot.host; // The host itself scrolls\n this.spacer = this.shadowRoot.querySelector('.spacer');\n this.content = this.shadowRoot.querySelector('.content');\n this.onScroll = this.onScroll.bind(this);\n }\n static get observedAttributes() {\n return ['item-height'];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'item-height') {\n this._itemHeight = parseInt(newValue, 10) || 50;\n this.renderVisible();\n }\n }\n connectedCallback() {\n // Find the template provided by the user (Support both standard and branded tags)\n const templateTag = this.querySelector('template') || this.querySelector('mu-template');\n if (templateTag) {\n this._template = templateTag.innerHTML;\n }\n this.addEventListener('scroll', this.onScroll);\n // Wait for next frame to get initial height if not set\n requestAnimationFrame(() => this.renderVisible());\n }\n disconnectedCallback() {\n this.removeEventListener('scroll', this.onScroll);\n }\n set items(value) {\n this._items = value;\n this.renderVisible();\n }\n get items() { return this._items; }\n onScroll() {\n requestAnimationFrame(() => this.renderVisible());\n }\n renderVisible() {\n if (!this._items.length)\n return;\n const scrollTop = this.scrollTop;\n const hostHeight = this.clientHeight || 400; // Default fallback if not sized\n const totalHeight = this._items.length * this._itemHeight;\n this.spacer.style.height = `${totalHeight}px`;\n // Windowing Math\n const startIndex = Math.floor(scrollTop / this._itemHeight);\n const buffer = 5;\n const visibleCount = Math.ceil(hostHeight / this._itemHeight);\n const renderStart = Math.max(0, startIndex - buffer);\n const renderEnd = Math.min(this._items.length, startIndex + visibleCount + buffer);\n const startOffset = renderStart * this._itemHeight;\n this.content.style.transform = `translateY(${startOffset}px)`;\n // Render specific slice\n const visibleItems = this._items.slice(renderStart, renderEnd);\n // Simple string replacement template engine for the demo\n // In a real Mulan compilation, this would be an optimized ASTR render\n let html = '';\n visibleItems.forEach((item, index) => {\n const absoluteIndex = renderStart + index;\n // Basic mustache replacement {{ item.prop }}\n let rowHtml = this._template\n .replace(/{{\\s*item\\s*}}/g, String(item)) // {{ item }}\n .replace(/{{\\s*index\\s*}}/g, String(absoluteIndex)); // {{ index }}\n // Handle object properties: {{ item.name }}\n if (typeof item === 'object' && item !== null) {\n rowHtml = rowHtml.replace(/{{\\s*item\\.(\\w+)\\s*}}/g, (_, prop) => {\n return String(item[prop] || '');\n });\n }\n html += `<div style=\"height: ${this._itemHeight}px; overflow: hidden;\">${rowHtml}</div>`;\n });\n this.content.innerHTML = html;\n }\n}\nexports.MuInfinity = MuInfinity;\n// Register\nif (typeof customElements !== 'undefined' && !customElements.get('mu-infinity')) {\n customElements.define('mu-infinity', MuInfinity);\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuStore = void 0;\nconst reactive_1 = require(\"../core/reactive\");\nclass MuStore {\n constructor(initialState, options) {\n this.subscribers = [];\n // Load from local storage if persist is true\n let loadedState = initialState;\n if (options === null || options === void 0 ? void 0 : options.persist) {\n const key = options.key || 'mulan-store';\n try {\n const stored = localStorage.getItem(key);\n if (stored) {\n loadedState = Object.assign(Object.assign({}, initialState), JSON.parse(stored));\n }\n }\n catch (e) {\n console.error(\"Failed to load state\", e);\n }\n // Auto-save effect\n (0, reactive_1.effect)(() => {\n localStorage.setItem(key, JSON.stringify(this.state));\n });\n }\n this.state = (0, reactive_1.reactive)(loadedState);\n }\n // Subscribe to changes\n subscribe(fn) {\n this.subscribers.push(fn);\n (0, reactive_1.effect)(() => {\n fn(this.state);\n });\n }\n // Action dispatcher pattern\n dispatch(action) {\n const result = action(this.state);\n if (result instanceof Promise) {\n result.then(() => {\n // Optional: Notify subscribers of async completion if needed manually?\n // But reactive() handles updates automatically.\n });\n }\n }\n}\nexports.MuStore = MuStore;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SecureStore = exports.Security = void 0;\nclass Security {\n /**\n * IRON FORTRESS PROTOCOL\n * Strictly escapes all HTML entities to prevent XSS.\n * Use `mu-raw` attribute in templates to bypass this for trusted content.\n */\n static sanitize(input) {\n if (typeof input !== 'string')\n return input;\n // 1. Basic entity encoding\n let secure = input\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n // 2. Remove dangerous events (extra layer if encoding fails)\n const dangerousEvents = ['onload', 'onclick', 'onerror', 'onmouseover', 'onfocus', 'oncontextmenu', 'oncopy', 'oncut', 'onpaste'];\n dangerousEvents.forEach(event => {\n const regex = new RegExp(`\\\\b${event}\\\\s*=`, 'gi');\n secure = secure.replace(regex, 'data-blocked-' + event + '=');\n });\n return secure;\n }\n /**\n * IRON FORTRESS: Attribute Sentinel\n * Validates and cleans attribute values based on their name.\n */\n static validateAttribute(name, value) {\n const lowerName = name.toLowerCase();\n // Block all event handlers if they somehow bypassed the compiler\n if (lowerName.startsWith('on')) {\n return `blocked-event-${lowerName}`;\n }\n // Strict URL validation for src/href\n if (lowerName === 'src' || lowerName === 'href' || lowerName === 'action' || lowerName === 'formaction') {\n const trimmedValue = value.trim().toLowerCase();\n if (trimmedValue.startsWith('javascript:') || trimmedValue.startsWith('data:text/html') || trimmedValue.startsWith('vbscript:')) {\n return 'about:blank#blocked-malicious-scheme';\n }\n }\n return Security.sanitize(value);\n }\n /**\n * Generates a strict Content Security Policy header value.\n * @param options Configuration for allowed sources\n */\n static generateCSP(options = {}) {\n const scriptSrc = [\"'self'\", ...(options.scriptSrc || [])].join(\" \");\n const styleSrc = [\"'self'\", \"'unsafe-inline'\", ...(options.styleSrc || [])].join(\" \");\n return `default-src 'self'; script-src ${scriptSrc}; style-src ${styleSrc}; object-src 'none'; base-uri 'self';`;\n }\n static validateUrl(url) {\n // Basic URL validation\n const pattern = new RegExp('^(https?:\\\\/\\\\/)?' + // protocol\n '((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|' + // domain name\n '((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))' + // OR ip (v4) address\n '(\\\\:\\\\d+)?(\\\\/[-a-z\\\\d%_.~+]*)*' + // port and path\n '(\\\\?[;&a-z\\\\d%_.~+=-]*)?' + // query string\n '(\\\\#[-a-z\\\\d_]*)?$', 'i'); // fragment locator\n return !!pattern.test(url);\n }\n /**\n * Prevents XSS by sanitizing common input fields on blur.\n * Can be used as a utility in forms.\n */\n static preventXSS(inputElement) {\n inputElement.addEventListener('blur', (e) => {\n const target = e.target;\n target.value = Security.sanitize(target.value);\n });\n }\n}\nexports.Security = Security;\n/**\n * IRON FORTRESS: SECURE STORE\n * A version of MuStore that encapsulates state and provides optional encryption hooks.\n */\nconst reactive_1 = require(\"../core/reactive\");\nclass SecureStore {\n constructor(initialState, options) {\n this._key = (options === null || options === void 0 ? void 0 : options.key) || null;\n this._state = (0, reactive_1.reactive)(initialState);\n if ((options === null || options === void 0 ? void 0 : options.encrypt) && this._key) {\n this._loadEncrypted();\n }\n }\n get state() {\n // IRON FORTRESS: Freeze prevents direct mutation outside dispatch\n return Object.freeze(Object.assign({}, this._state));\n }\n dispatch(action) {\n // Only allow state changes via dispatch\n action(this._state);\n this._saveEncrypted();\n }\n _saveEncrypted() {\n if (!this._key || typeof localStorage === 'undefined')\n return;\n const data = JSON.stringify(this._state);\n // Base64 + Scramble for basic security\n const encrypted = btoa(unescape(encodeURIComponent(data)));\n localStorage.setItem(`secure-${this._key}`, encrypted);\n }\n _loadEncrypted() {\n if (!this._key || typeof localStorage === 'undefined')\n return;\n try {\n const encrypted = localStorage.getItem(`secure-${this._key}`);\n if (encrypted) {\n const decrypted = decodeURIComponent(escape(atob(encrypted)));\n const data = JSON.parse(decrypted);\n Object.assign(this._state, data);\n }\n }\n catch (e) {\n console.warn(\"[Mulan Security] Failed to load secure state\");\n }\n }\n}\nexports.SecureStore = SecureStore;\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createRouter = exports.MuRouter = void 0;\nconst renderer_1 = require(\"../core/renderer\");\nconst sanitizer_1 = require(\"../security/sanitizer\");\nclass MuRouter {\n constructor(routes, rootContainer = null) {\n this.currentPath = '';\n this.currentComponent = null;\n this.lastRouteId = 0;\n this.routes = routes;\n this.rootContainer = rootContainer;\n this.isServer = rootContainer === null; // If no container, assume server/headless mode\n if (!this.isServer) {\n window.addEventListener('hashchange', this.handleRoute.bind(this));\n this.handleRoute(); // Initial load\n }\n }\n // SSR Method: Simulate a route visit on the server\n serverLookup(path) {\n return __awaiter(this, void 0, void 0, function* () {\n this.currentPath = path;\n const { route, params } = this.matchRoute(path);\n if (route) {\n // Run guards/resolvers here if needed\n let componentToRender = route.component;\n // Support Lazy Loading\n if (typeof componentToRender === 'function' && !componentToRender.prototype) {\n const module = yield componentToRender();\n componentToRender = module.default || module;\n }\n if (typeof componentToRender === 'function') {\n // Class component SSR\n // We need a dummy container for the component to \"render\" into its own buffer\n // For simplicity in this string-based framework, we mock the container\n const mockContainer = { innerHTML: '' };\n const instance = new componentToRender(mockContainer);\n if (instance.setParams)\n instance.setParams(params);\n // Manually trigger mount logic without DOM effects if possible, or just template()\n // Ideally, we just want the template string.\n return instance.template();\n }\n else {\n return componentToRender;\n }\n }\n return '<!-- 404 -->';\n });\n }\n matchRoute(hash) {\n // Simple exact match first\n let route = this.routes.find((r) => r.path === hash);\n if (route)\n return { route, params: {} };\n // Regex match for params e.g. /user/:id\n for (const r of this.routes) {\n const paramNames = [];\n const regexPath = r.path.replace(/:([^/]+)/g, (_, key) => {\n paramNames.push(key);\n return '([^/]+)';\n });\n const match = new RegExp(`^${regexPath}$`).exec(hash);\n if (match) {\n const params = {};\n paramNames.forEach((name, i) => {\n // SECURE: Automatically sanitize all route parameters\n params[name] = sanitizer_1.Security.sanitize(match[i + 1]);\n });\n return { route: r, params };\n }\n }\n return { route: undefined, params: {} };\n }\n handleRoute() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.isServer)\n return;\n const currentRouteId = ++this.lastRouteId;\n const hash = window.location.hash.slice(1) || '/';\n const { route, params } = this.matchRoute(hash);\n // Security Check: Validate URL to prevent malicious hash injection\n if (hash !== '/' && !sanitizer_1.Security.validateUrl('http://dummy.com' + hash)) {\n console.error(\"Security Alert: Malformed URL detected.\");\n return;\n }\n // Navigation Guard (Middleware)\n if (route === null || route === void 0 ? void 0 : route.beforeEnter) {\n yield new Promise((resolve) => {\n route.beforeEnter(hash, this.currentPath, (allow) => {\n if (allow)\n resolve();\n else {\n console.warn(`Navigation to ${hash} blocked by guard.`);\n // Ideally redirect or stay, here we just stop processing\n throw new Error('Navigation Blocked');\n }\n });\n }).catch(() => { return; }); // Stop execution if blocked\n }\n this.currentPath = hash;\n if (route) {\n if (route.title) {\n document.title = route.title;\n }\n else if (route.meta && route.meta.title) {\n // Fallback to meta.title if used\n document.title = route.meta.title;\n }\n if (this.rootContainer) {\n // Mulan Cycle: Destroy previous component before rendering new one\n if (this.currentComponent) {\n console.log(`[Router] Navigation from ${this.currentPath} to ${hash}. Destroying previous component.`);\n if (this.currentComponent.onDestroy) {\n this.currentComponent.onDestroy();\n }\n }\n this.rootContainer.innerHTML = ''; // Clear previous content\n }\n let componentToRender = route.component;\n // Support Lazy Loading\n if (typeof componentToRender === 'function' && !componentToRender.prototype) {\n try {\n const module = yield componentToRender();\n if (currentRouteId !== this.lastRouteId) {\n console.log(`[Router] Navigation to ${hash} interrupted by newer navigation. Abandoning.`);\n return;\n }\n componentToRender = module.default || module;\n }\n catch (e) {\n console.error(\"Failed to lazy load component\", e);\n return;\n }\n }\n if (typeof componentToRender === 'function') {\n // It's a class component\n if (this.rootContainer) {\n const instance = new componentToRender(this.rootContainer);\n this.currentComponent = instance;\n // Inject params if the component accepts them\n if (instance.setParams) {\n instance.setParams(params);\n }\n instance.mount();\n }\n }\n else if (typeof componentToRender === 'object' && componentToRender.template) {\n // Object Component (Simple SFC without script or Options API)\n const html = componentToRender.template();\n if (this.rootContainer)\n (0, renderer_1.render)(html, this.rootContainer);\n this.currentComponent = null;\n }\n else {\n // Simple HTML string/template\n if (this.rootContainer)\n (0, renderer_1.render)(componentToRender, this.rootContainer);\n this.currentComponent = null; // String templates don't have lifecycle instances\n }\n }\n else {\n if (this.rootContainer)\n (0, renderer_1.render)('<div style=\"text-align:center; padding:50px;\"><h1>404</h1><p>Page Not Found</p></div>', this.rootContainer);\n }\n });\n }\n // [Chronos] Prefetch a route's component code in the background\n prefetch(path) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.isServer)\n return;\n const { route } = this.matchRoute(path);\n if (route) {\n let componentToRender = route.component;\n // Check if it's a lazy-loaded function that hasn't been resolved yet\n if (typeof componentToRender === 'function' && !componentToRender.prototype) {\n // If it's already a resolved module (from previous prefetch), componentToRender might be the result.\n // But typically in our simple implementation, route.component stays as the function until we replace it.\n // To avoid double-fetching, we can check if it has a specific flag or property. \n // For this implementation, we'll just run it and let the browser cache the module request (standard ES Module behavior).\n try {\n // console.log(`[Chronos] Prefetching ${path}...`);\n yield componentToRender();\n // We don't need to do anything with the result here. \n // The browser's module cache will handle the speedup when the user actually navigates.\n }\n catch (e) {\n console.warn(`[Chronos] Failed to prefetch ${path}`, e);\n }\n }\n }\n });\n }\n navigate(path) {\n if (this.isServer) {\n this.currentPath = path;\n }\n else {\n window.location.hash = path;\n }\n }\n}\nexports.MuRouter = MuRouter;\n// --- Factory for Easy Usage ---\nconst createRouter = (options) => {\n // Expose the router instance globally for <mu-link> to access\n const router = new MuRouter(options.routes, options.rootContainer);\n if (typeof window !== 'undefined') {\n window.__MULAN_ROUTER__ = router;\n }\n return router;\n};\nexports.createRouter = createRouter;\n// --- Web Component: <mu-link> ---\n// Usage: <mu-link to=\"/about\">About Us</mu-link>\nconst MuLinkBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {\n};\nif (typeof window !== 'undefined' && !customElements.get('mu-link')) {\n class MuLink extends MuLinkBase {\n constructor() {\n super();\n this.addEventListener('click', (e) => {\n e.preventDefault();\n const to = this.getAttribute('to');\n if (to) {\n // Update Hash for SPA Navigation\n window.location.hash = to;\n }\n });\n // [Chronos] Intelligent Pre-fetching\n this.addEventListener('mouseenter', () => {\n const to = this.getAttribute('to');\n if (to) {\n const router = window.__MULAN_ROUTER__;\n if (router && typeof router.prefetch === 'function') {\n router.prefetch(to);\n }\n }\n });\n // [Chronos] Also prefetch on focus for keyboard users\n this.addEventListener('focus', () => {\n const to = this.getAttribute('to');\n if (to) {\n const router = window.__MULAN_ROUTER__;\n if (router && typeof router.prefetch === 'function') {\n router.prefetch(to);\n }\n }\n });\n }\n connectedCallback() {\n this.style.cursor = 'pointer';\n this.style.color = 'var(--primary, #9C27B0)'; // Default to brand color if available\n this.style.textDecoration = 'none';\n }\n static get observedAttributes() { return ['to']; }\n }\n customElements.define('mu-link', MuLink);\n}\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.useMutation = exports.useQuery = void 0;\nconst reactive_1 = require(\"./reactive\");\nfunction useQuery(queryFn, options = { enabled: true }) {\n const state = (0, reactive_1.reactive)({\n data: null,\n isLoading: false,\n error: null\n });\n const execute = () => __awaiter(this, void 0, void 0, function* () {\n state.isLoading = true;\n state.error = null;\n try {\n const result = yield queryFn();\n state.data = result;\n }\n catch (err) {\n state.error = err;\n }\n finally {\n state.isLoading = false;\n }\n });\n if (options.enabled) {\n // Run automatically\n (0, reactive_1.effect)(() => {\n // Basic effect wrapper to allow reactivity if queryFn relies on signals\n execute();\n });\n }\n return {\n get data() { return state.data; },\n get isLoading() { return state.isLoading; },\n get error() { return state.error; },\n refetch: execute\n };\n}\nexports.useQuery = useQuery;\nfunction useMutation(mutationFn) {\n const state = (0, reactive_1.reactive)({\n data: null,\n isLoading: false,\n error: null\n });\n const mutate = (args) => __awaiter(this, void 0, void 0, function* () {\n state.isLoading = true;\n state.error = null;\n try {\n const result = yield mutationFn(args);\n state.data = result;\n return result;\n }\n catch (err) {\n state.error = err;\n throw err;\n }\n finally {\n state.isLoading = false;\n }\n });\n return {\n get data() { return state.data; },\n get isLoading() { return state.isLoading; },\n get error() { return state.error; },\n mutate\n };\n}\nexports.useMutation = useMutation;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MuBlochSphereElement = void 0;\nconst reactive_1 = require(\"../core/reactive\");\nconst MuBlochBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {\n};\nclass MuBlochSphereElement extends MuBlochBase {\n static get observedAttributes() {\n return ['size'];\n }\n constructor() {\n super();\n this._arrow = null;\n this._container = null;\n this._disposeEffect = null;\n this.attachShadow({ mode: 'open' });\n }\n connectedCallback() {\n this.render();\n }\n disconnectedCallback() {\n if (this._disposeEffect) {\n this._disposeEffect();\n this._disposeEffect = null;\n }\n }\n // Property setter for 'qubit' (passed as .qubit=\"${q}\" in Mulan)\n set qubit(val) {\n this._qubit = val;\n this.initReactivity();\n }\n get qubit() {\n return this._qubit;\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'size' && this._container) {\n this._container.style.width = newValue + 'px';\n this._container.style.height = newValue + 'px';\n }\n }\n initReactivity() {\n if (this._disposeEffect)\n this._disposeEffect();\n if (!this._qubit)\n return;\n // MulanJS Effect: Run whenever the qubit state changes\n this._disposeEffect = (0, reactive_1.effect)(() => {\n const state = this._qubit.value; // Access reactive proxy\n if (!state || !state.amplitudes)\n return;\n // Assume Single Qubit for Visualizer (Index 0 if passed a register)\n // If passed a register, we visualize the first qubit's logical projection (partial trace simplified)\n // Or assume input IS a specific qubit projection?\n // For simplified demo, we assume the register is size 1 OR we visualize Q0 of the register.\n const amps = state.amplitudes;\n // Support 1-qubit visualization from N-qubit register requires partial trace.\n // For now, let's assume the user passes a 1-qubit register OR we visualize index 0.\n // |psi> = a|0> + b|1>\n // a = amps[0] (re, im)\n // b = amps[1] (re, im)\n // Dealing with multi-qubit registers (naive projection for visualization):\n // We sum up probabilities for 0xxxx vs 1xxxx to get Z-axis.\n // This is \"marginal probability\".\n let p0 = 0;\n let p1 = 0;\n // Calculate Probabilities\n for (let i = 0; i < amps.length; i++) {\n const mag = amps[i].re * amps[i].re + amps[i].im * amps[i].im;\n if ((i & 1) === 0)\n p0 += mag;\n else\n p1 += mag;\n }\n // Theta from Z-projection\n // P0 = cos^2(theta/2) -> theta = 2 * acos(sqrt(P0))\n const theta = 2 * Math.acos(Math.min(1, Math.sqrt(p0)));\n // Phi?\n // Phase is relative phase between |0> and |1>.\n // We can look at the phase of the '1' component relative to '0'.\n // Simple approach: Look at amps[1] phase vs amps[0] phase.\n // But with entanglement, pure state phase is tricky.\n // Let's implement full density matrix if needed, but for now:\n // naive: atan2(amps[1].im, amps[1].re) - atan2(amps[0].im, amps[0].re)\n // We use the first pair (0 and 1) as proxy if multiple.\n const a0 = amps[0];\n const a1 = amps[1]; // Valid for N>=1\n const phase0 = Math.atan2(a0.im, a0.re);\n const phase1 = Math.atan2(a1.im, a1.re);\n let phi = phase1 - phase0;\n // Update Arrow\n this.updateArrow(theta, phi);\n });\n }\n updateArrow(theta, phi) {\n if (!this._arrow)\n return;\n // Convert Quantum Coords (Theta, Phi) to CSS Transforms\n // Theta 0 = Top (|0>)\n // Theta PI = Bottom (|1>)\n // Theta PI/2 = Equator\n // CSS Rotate sequence:\n // 1. Start pointing UP (Y or Z axis in CSS?)\n // Let's say Arrow starts pointing UP (Y-).\n // Rotate Z by Phi (Azimuth)\n // Rotate X by Theta (Polar) - No, that's not standard Euler.\n // Standard Physics:\n // Z is Up (in Bloch), but CSS 3D Y is usually 'Down' or 'Up'.\n // Let's Map:\n // Bloch Z+ (|0>) -> CSS Y- (Top)\n // Bloch Z- (|1>) -> CSS Y+ (Bottom)\n // Bloch X+ (|+>) -> CSS Z+ (Front)\n // Transform:\n // rotateY(phi) ? No, phi rotates around Z-axis (Vertical).\n // theta rotates from Z-axis down.\n // CSS:\n // rotateY(phi) -> Rotates around Vertical axis.\n // rotateZ(theta) -> Rotates \"down\" from up?\n // Let's simplify:\n // transform: rotateY(${phi}rad) rotateZ(${theta}rad)\n // Note: CSS rotations order matters.\n const degTheta = theta * (180 / Math.PI);\n const degPhi = phi * (180 / Math.PI);\n // Adjustment for visual alignment\n this._arrow.style.transform = `rotateY(${degPhi}deg) rotateZ(${degTheta}deg)`;\n // Color based on state\n const isSuperposition = Math.abs(theta - Math.PI / 2) < 0.1;\n this._arrow.style.backgroundColor = isSuperposition ? '#00ffff' : '#ff00ff';\n }\n render() {\n if (!this.shadowRoot)\n return;\n const size = this.getAttribute('size') || '200';\n this.shadowRoot.innerHTML = `\r\n <style>\r\n :host {\r\n display: inline-block;\r\n perspective: 1000px;\r\n }\r\n .sphere-container {\r\n width: ${size}px;\r\n height: ${size}px;\r\n position: relative;\r\n transform-style: preserve-3d;\r\n margin: 0 auto;\r\n }\r\n .sphere {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n border: 1px solid rgba(255, 255, 255, 0.2);\r\n position: absolute;\r\n background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.8));\r\n box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);\r\n transform: rotateX(15deg) rotateY(15deg); /* Initial tilt for view */\r\n }\r\n /* Equator Ring */\r\n .equator {\r\n position: absolute;\r\n top: 50%;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n border: 1px dashed rgba(255, 255, 255, 0.3);\r\n border-radius: 50%;\r\n transform: rotateX(90deg);\r\n pointer-events: none;\r\n }\r\n /* Axis Lines */\r\n .axis {\r\n position: absolute;\r\n background: rgba(255, 255, 255, 0.1);\r\n }\r\n .z-axis { width: 2px; height: 100%; left: 50%; top: 0; }\r\n \r\n /* The Quantum Arrow */\r\n .arrow-container {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n width: 0;\r\n height: 0;\r\n transform-style: preserve-3d;\r\n transform: rotateX(15deg) rotateY(15deg); /* Match sphere tilt */\r\n }\r\n \r\n .arrow-pivot {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 4px;\r\n height: 50%; /* Length of radius */\r\n /* Pivot logic: we want to rotate around the center point */\r\n /* CSS Default transform-origin is 50% 50% */\r\n /* We construct the arrow such that it points UP from center */\r\n }\r\n \r\n .arrow-rod {\r\n width: 4px;\r\n height: ${parseInt(size) / 2 - 10}px;\r\n background: #ff00ff;\r\n position: absolute;\r\n bottom: 0;\r\n left: -2px;\r\n transform-origin: bottom center;\r\n transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;\r\n border-radius: 2px;\r\n box-shadow: 0 0 10px currentColor;\r\n }\r\n \r\n .arrow-head {\r\n width: 0; \r\n height: 0; \r\n border-left: 6px solid transparent;\r\n border-right: 6px solid transparent;\r\n border-bottom: 12px solid #ff00ff;\r\n position: absolute;\r\n top: -10px;\r\n left: -6px;\r\n }\r\n \r\n .label {\r\n position: absolute;\r\n color: #aaa;\r\n font-family: monospace;\r\n font-size: 10px;\r\n }\r\n .label-0 { top: 5px; left: 50%; transform: translateX(-50%); }\r\n .label-1 { bottom: 5px; left: 50%; transform: translateX(-50%); }\r\n </style>\r\n \r\n <div class=\"sphere-container\">\r\n <div class=\"sphere\">\r\n <div class=\"equator\"></div>\r\n <div class=\"axis z-axis\"></div>\r\n <div class=\"label label-0\">|0></div>\r\n <div class=\"label label-1\">|1></div>\r\n </div>\r\n \r\n <div class=\"arrow-container\">\r\n <!-- The rod is the actual rotating element -->\r\n <div class=\"arrow-rod\">\r\n <div class=\"arrow-head\"></div>\r\n </div>\r\n </div>\r\n </div>\r\n `;\n this._container = this.shadowRoot.querySelector('.sphere-container');\n this._arrow = this.shadowRoot.querySelector('.arrow-rod');\n // Re-init reactivity if qubit was set before render\n if (this._qubit)\n this.initReactivity();\n }\n}\nexports.MuBlochSphereElement = MuBlochSphereElement;\n// Register the custom element\nif (typeof customElements !== 'undefined' && !customElements.get('mu-bloch-sphere')) {\n customElements.define('mu-bloch-sphere', MuBlochSphereElement);\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.sanitize = exports.hydrate = exports.render = void 0;\nfunction render(template, container) {\n // Focus Preservation (The \"Mulan Glance\" Technique)\n let focusedId = null;\n let selectionStart = null;\n let selectionEnd = null;\n let preservedValue = null;\n if (document.activeElement && container.contains(document.activeElement)) {\n const el = document.activeElement;\n if (el.hasAttribute('data-mu-id')) {\n focusedId = el.getAttribute('data-mu-id');\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n selectionStart = el.selectionStart;\n selectionEnd = el.selectionEnd;\n preservedValue = el.value;\n }\n }\n }\n // [Anima] 1. Pre-Update: Snapshot positions of animated elements\n const animationSnapshots = new Map();\n // Only query if we might have animations to save perf\n if (typeof template === 'string' && template.includes('mu-animate')) {\n const animatedEls = container.querySelectorAll('[mu-animate]');\n animatedEls.forEach(el => {\n const key = el.getAttribute('mu-key') || el.id;\n if (key) {\n animationSnapshots.set(key, el.getBoundingClientRect());\n }\n });\n }\n if (typeof template === 'string') {\n container.innerHTML = template;\n }\n else {\n container.innerHTML = '';\n container.appendChild(template);\n }\n // Restore Focus and Value\n if (focusedId) {\n const el = container.querySelector(`[data-mu-id=\"${focusedId}\"]`);\n if (el) {\n // Restore value first to ensure cursor positioning works correctly\n if (preservedValue !== null && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement)) {\n el.value = preservedValue;\n }\n el.focus();\n if ((el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) && selectionStart !== null) {\n try {\n el.setSelectionRange(selectionStart, selectionEnd);\n }\n catch (e) {\n // input types that don't support selection (e.g. number/email) might throw\n }\n }\n }\n }\n // [Anima] 2. Post-Update: FLIP (First, Last, Invert, Play)\n if (animationSnapshots.size > 0) {\n const newAnimatedEls = container.querySelectorAll('[mu-animate]');\n newAnimatedEls.forEach(el => {\n const key = el.getAttribute('mu-key') || el.id;\n if (key && animationSnapshots.has(key)) {\n const oldRect = animationSnapshots.get(key);\n const newRect = el.getBoundingClientRect();\n const dx = oldRect.left - newRect.left;\n const dy = oldRect.top - newRect.top;\n // Only animate if moved\n if (dx !== 0 || dy !== 0) {\n const htmlEl = el;\n // INVERT: Move it back to where it was instantly\n htmlEl.style.transform = `translate(${dx}px, ${dy}px)`;\n htmlEl.style.transition = 'none';\n // PLAY: Animate to zero (new position)\n requestAnimationFrame(() => {\n // Force reflow\n // void htmlEl.offsetWidth; \n htmlEl.style.transition = 'transform 500ms cubic-bezier(0.25, 0.8, 0.25, 1)';\n htmlEl.style.transform = '';\n });\n }\n }\n });\n }\n}\nexports.render = render;\nfunction hydrate(template, container) {\n // In a string-based framework, hydration is often just \"take over\".\n // For now, we'll verify if the server content matches (simple check)\n // and then assume control. In a more advanced version, we'd attach listeners without re-rendering.\n if (typeof template === 'string') {\n if (container.innerHTML.trim() !== template.trim()) {\n console.warn('Hydration Mismatch: Server rendered content differs from Client.');\n container.innerHTML = template; // Fallback to full render\n }\n else {\n // console.log('Hydration Successful.');\n }\n }\n else {\n container.innerHTML = '';\n container.appendChild(template);\n }\n // Future: Attach event listeners here if we had a mechanism for it.\n}\nexports.hydrate = hydrate;\nfunction sanitize(str) {\n // Check if we are in a browser environment\n if (typeof document !== 'undefined') {\n const temp = document.createElement('div');\n temp.textContent = str;\n return temp.innerHTML;\n }\n // Simple SSR fallback sanitizer (rudimentary)\n return str.replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\nexports.sanitize = sanitize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.renderToString = void 0;\n/**\n * Renders a Mulan component to a static HTML string with a resumability envelope.\n */\nfunction renderToString(ComponentClass, props = {}) {\n // 1. Initialize component in a virtual container (not used for DOM)\n // On server, we mock the container or just pass a dummy object\n const dummyContainer = {\n querySelector: () => null,\n querySelectorAll: () => [],\n appendChild: () => { },\n removeChild: () => { },\n getAttribute: () => null\n };\n const instance = new ComponentClass(dummyContainer);\n // Pass props\n Object.assign(instance, props);\n // 2. Render to HTML\n if (typeof instance.renderToString !== 'function') {\n throw new Error(`Component ${ComponentClass.name} was not compiled for SSR.`);\n }\n const html = instance.renderToString();\n // 3. Extract State for Resumability\n // We only want to serialize data that was exposed in setup()\n // For now, we'll serialize any property on the instance that isn't internal\n const state = {};\n for (const key in instance) {\n if (key.startsWith('_') || key === 'container' || key === 'state' || typeof instance[key] === 'function')\n continue;\n const value = instance[key];\n // Handle signals specifically\n if (value && typeof value === 'object' && 'value' in value) {\n state[key] = value.value;\n }\n else {\n state[key] = value;\n }\n }\n // 4. Construct Resumability Envelope\n const stateScript = `<script type=\"mulan/state\" data-mu-uid=\"${instance.$uid}\">${JSON.stringify(state)}</script>`;\n const envelope = `<div data-mu-root=\"${instance.$uid}\">${html}${stateScript}</div>`;\n return {\n html,\n state,\n envelope\n };\n}\nexports.renderToString = renderToString;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.muSwitch = exports.muControl = exports.muParallel = exports.muMeasure = exports.muTeleport = exports.muEntangle = exports.muSearch = exports.muGate = exports.muQubit = exports.muRegister = exports.activeControls = void 0;\nconst hooks_1 = require(\"./hooks\");\n/**\n * Mulan Quantum (ASTR-Q+) Core\n * Advanced Simulation Engine for multi-qubit registers and entanglement.\n */\n// -- GLOBAL CONTEXT FOR QUANTUM CONTROL --\n// Defined at top to ensure visibility for muGate\nexports.activeControls = [];\n/**\n * Creates a quantum register of size n.\n * State vector will have 2^n amplitudes.\n */\nfunction muRegister(n) {\n const numStates = Math.pow(2, n);\n const amplitudes = new Array(numStates).fill(0).map((_, i) => ({\n re: i === 0 ? 1 : 0,\n im: 0\n }));\n return (0, hooks_1.muState)({\n value: {\n size: n,\n amplitudes\n }\n });\n}\nexports.muRegister = muRegister;\n/**\n * Backward compatible muQubit (Single Qubit Register)\n */\nfunction muQubit(initial = 0) {\n const q = muRegister(1);\n if (initial === 1) {\n muGate(q, 'X', 0);\n }\n // Add compatibility properties for Phase 1 components\n // These properties are getters that dynamically access the amplitudes array\n Object.defineProperty(q.value, 'alpha', { get: () => q.value.amplitudes[0] });\n Object.defineProperty(q.value, 'beta', { get: () => q.value.amplitudes[1] });\n return q;\n}\nexports.muQubit = muQubit;\n/**\n * Internal helper to update register state while maintaining compatibility\n */\nfunction updateState(reg, newState) {\n if (newState.size === 1) {\n // Re-inject compatibility getters for muQubit users\n Object.defineProperty(newState, 'alpha', {\n get: () => newState.amplitudes[0],\n configurable: true,\n enumerable: true\n });\n Object.defineProperty(newState, 'beta', {\n get: () => newState.amplitudes[1],\n configurable: true,\n enumerable: true\n });\n }\n reg.value = newState;\n}\nfunction muGate(reg, type, target = 0, control) {\n const state = reg.value;\n const n = state.size;\n const amplitudes = state.amplitudes;\n const newAmps = amplitudes.map(a => (Object.assign({}, a)));\n // Prepare Effective Control (Explicit Arguments + Global Context)\n const effectiveControl = [...(control === undefined ? [] : (Array.isArray(control) ? control : [control])), ...exports.activeControls];\n // Helper: Check if all control bits are 1\n const checkControl = (index, ctrl) => {\n if (ctrl === undefined || (Array.isArray(ctrl) && ctrl.length === 0))\n return true;\n const ctrls = Array.isArray(ctrl) ? ctrl : [ctrl];\n return ctrls.every(c => ((index >> c) & 1) === 1);\n };\n // SWAP Gate (Unique case: affects 2 targets)\n if (type === 'SWAP') {\n const t1 = target;\n const t2 = control; // SWAP uses control arg as second target \n // Iterate only half to avoid double swapping\n for (let i = 0; i < amplitudes.length; i++) {\n // Check active controls for SWAP too\n if (exports.activeControls.length > 0 && !checkControl(i, exports.activeControls))\n continue;\n const bit1 = (i >> t1) & 1;\n const bit2 = (i >> t2) & 1;\n if (bit1 !== bit2) {\n // Determine the swap partner index\n // If i has (0,1), partner has (1,0) at those positions\n const partner = i ^ (1 << t1) ^ (1 << t2);\n if (i < partner) {\n const temp = newAmps[i];\n newAmps[i] = newAmps[partner];\n newAmps[partner] = temp;\n }\n }\n }\n updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));\n return;\n }\n // Standard Single-Qubit & Controlled Gates\n if (type === 'H') {\n const s = 1 / Math.sqrt(2);\n const processed = new Set();\n for (let i = 0; i < state.amplitudes.length; i++) {\n if (processed.has(i))\n continue;\n // Check Controls first\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));\n const a = state.amplitudes[i];\n const b = state.amplitudes[pairedIndex];\n if (targetBit === 0) {\n newAmps[i] = { re: s * (a.re + b.re), im: s * (a.im + b.im) };\n newAmps[pairedIndex] = { re: s * (a.re - b.re), im: s * (a.im - b.im) };\n }\n else {\n newAmps[pairedIndex] = { re: s * (b.re + a.re), im: s * (b.im + a.im) };\n newAmps[i] = { re: s * (b.re - a.re), im: s * (b.im - a.im) };\n }\n processed.add(i);\n processed.add(pairedIndex);\n }\n }\n else if (type === 'X' || type === 'CNOT') {\n // CNOT is just Controlled-X\n for (let i = 0; i < amplitudes.length; i++) {\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));\n if (i < pairedIndex) {\n const temp = newAmps[i];\n newAmps[i] = newAmps[pairedIndex];\n newAmps[pairedIndex] = temp;\n }\n }\n }\n else if (type === 'Z' || type === 'CZ') {\n // Z and CZ are Phase Flips\n for (let i = 0; i < amplitudes.length; i++) {\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n // Z Gate acts on |1>\n if (targetBit === 1) {\n newAmps[i] = { re: -amplitudes[i].re, im: -amplitudes[i].im };\n }\n }\n }\n else if (type === 'Y') {\n // Y: |0> -> i|1>, |1> -> -i|0>\n for (let i = 0; i < amplitudes.length; i++) {\n if (!checkControl(i, effectiveControl))\n continue;\n const targetBit = (i >> target) & 1;\n const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));\n if (i < pairedIndex) {\n // We process pairs (i, pairedIndex) where i has 0 at target, paired has 1\n const a = newAmps[i]; // Coeff of |0>\n const b = newAmps[pairedIndex]; // Coeff of |1>\n // New |0> = -i * Old |1>\n newAmps[i] = { re: b.im, im: -b.re };\n // New |1> = i * Old |0>\n newAmps[pairedIndex] = { re: -a.im, im: a.re };\n }\n }\n }\n updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));\n}\nexports.muGate = muGate;\n/**\n * Mulan Search Logic (Grover's Operator)\n * Automatically constructs a multi-controlled Phase Flip (Z) for a specific target state.\n * This is the core of the \"Quantum Switch\" or \"Quantum Search\" capability.\n * @param reg Quantum Register\n * @param targetState The integer state to \"search\" and mark (e.g. 2 for |10>)\n */\nfunction muSearch(reg, targetState) {\n const n = reg.value.size;\n const controls = [];\n // 1. Identify which bits are 0 and need wrapping with X gates\n // Logic: To mark |010>, we want C-C-Z to trigger on 111.\n // So we apply X to bits that are 0, then C-C-Z, then X again.\n // We treat the last bit as the 'target' for the Z gate, rest as controls\n const targetQubit = n - 1;\n for (let i = 0; i < n; i++) {\n const bit = (targetState >> i) & 1;\n if (i === targetQubit) {\n // If target bit logic requires 0, we flip it to 1 for the Z gate to work\n if (bit === 0)\n muGate(reg, 'X', i);\n }\n else {\n controls.push(i);\n if (bit === 0)\n muGate(reg, 'X', i);\n }\n }\n // 2. Apply Multi-Controlled Z\n muGate(reg, 'Z', targetQubit, controls);\n // 3. Uncompute (Restore 0s)\n for (let i = 0; i < n; i++) {\n const bit = (targetState >> i) & 1;\n if (bit === 0)\n muGate(reg, 'X', i);\n }\n // --- GROVER DIFFUSER (Amplification) ---\n // This flips the probability amplitudes around the mean, boosting the target state.\n // 1. Apply H to all\n for (let i = 0; i < n; i++)\n muGate(reg, 'H', i);\n // 2. Apply X to all\n for (let i = 0; i < n; i++)\n muGate(reg, 'X', i);\n // 3. Multi-Controlled Z (Reflection about |0...0>)\n // We want to flip phase of |11...1> state after X transformation (which corresponds to |00...0> original)\n // Target is last qubit, controls are 0 to n-2\n const diffControls = [];\n for (let i = 0; i < n - 1; i++)\n diffControls.push(i);\n muGate(reg, 'Z', n - 1, diffControls);\n // 4. Uncompute X\n for (let i = 0; i < n; i++)\n muGate(reg, 'X', i);\n // 5. Uncompute H\n for (let i = 0; i < n; i++)\n muGate(reg, 'H', i);\n}\nexports.muSearch = muSearch;\nfunction muEntangle(reg, i, j) {\n muGate(reg, 'H', i);\n muGate(reg, 'CNOT', j, i);\n}\nexports.muEntangle = muEntangle;\n/**\n * Quantum Teleportation Protocol\n * Transfers the state of `msgIdx` to `targetIdx` using `ancillaIdx` as a resource.\n * @param reg Register\n * @param msgIdx The qubit containing the state to teleport (Alice)\n * @param ancillaIdx The helper qubit (Alice's half of entanglement)\n * @param targetIdx The destination qubit (Bob)\n */\nfunction muTeleport(reg, msgIdx, ancillaIdx, targetIdx) {\n // 1. Create Bell Pair (Entanglement) between Ancilla and Target\n // Represents the shared link between Alice and Bob\n muEntangle(reg, ancillaIdx, targetIdx);\n // 2. Bell Measurement on Message + Ancilla (Alice's side)\n muGate(reg, 'CNOT', ancillaIdx, msgIdx); // Control: msg, Target: ancilla\n muGate(reg, 'H', msgIdx);\n // 3. Measure Alice's qubits (This collapses them)\n const m1 = muMeasure(reg, msgIdx); // Measures \"Z\" component\n const m2 = muMeasure(reg, ancillaIdx); // Measures \"X\" component\n // 4. Classical Communication & Correction (Bob's side)\n // Apply corrections to Target based on measurements\n if (m2 === 1)\n muGate(reg, 'X', targetIdx);\n if (m1 === 1)\n muGate(reg, 'Z', targetIdx);\n}\nexports.muTeleport = muTeleport;\n/**\n * Measures a specific qubit in the register, collapsing the superposition.\n * @param reg Quantum Register\n * @param target Index of qubit to measure\n * @returns 0 or 1\n */\nfunction muMeasure(reg, target = 0) {\n const state = reg.value;\n const amplitudes = state.amplitudes;\n let prob0 = 0;\n // 1. Calculate Probability of |0>\n for (let i = 0; i < amplitudes.length; i++) {\n if (((i >> target) & 1) === 0) {\n const a = amplitudes[i];\n prob0 += (a.re * a.re) + (a.im * a.im);\n }\n }\n // 2. Determine Outcome\n const result = Math.random() < prob0 ? 0 : 1;\n const resultProb = result === 0 ? prob0 : (1 - prob0);\n const normFactor = resultProb > 0 ? (1 / Math.sqrt(resultProb)) : 0;\n // 3. Collapse the State (Wavefunction Collapse)\n const newAmps = amplitudes.map((a, i) => {\n const bit = (i >> target) & 1;\n if (bit !== result) {\n return { re: 0, im: 0 };\n }\n else {\n return { re: a.re * normFactor, im: a.im * normFactor };\n }\n });\n // We need to call updateState to ensure reactivity if specialized getters exist\n // But since this file has updateState internal, we can just call it.\n // However, the internal updateState function needs to be in scope. \n // It is defined at line 60. So we are good.\n updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));\n return result;\n}\nexports.muMeasure = muMeasure;\n/**\n * Quantum Loop: Parallel Execution\n * Applies a gate to multiple qubits \"simultaneously\" (in simulation steps).\n * Ideal for initialization (Hadamard Transform) or global operations.\n * @param reg Quantum Register\n * @param qubits Array of qubit indices\n * @param gate Gate type to apply (e.g. 'H', 'X')\n */\nfunction muParallel(reg, qubits, gate) {\n if (gate === 'SWAP') {\n throw new Error(\"SWAP cannot be applied in parallel (requires pairs).\");\n }\n // In a real quantum computer, these happen at t=0.\n // Here, we loop, but logical time is constant.\n qubits.forEach(q => muGate(reg, gate, q));\n}\nexports.muParallel = muParallel;\n/**\n * Applies a block of operations controlled by specific qubits.\n * Enables \"Quantum If/Else\".\n */\nfunction muControl(reg, controlQubit, inverse, block) {\n // 1. Setup Context\n if (inverse) {\n muGate(reg, 'X', controlQubit); // Flip 0 to 1 to activate\n }\n exports.activeControls.push(controlQubit);\n try {\n block();\n }\n finally {\n exports.activeControls.pop();\n // Uncompute (Restore 0)\n if (inverse) {\n muGate(reg, 'X', controlQubit);\n }\n }\n}\nexports.muControl = muControl;\n/**\n * Quantum Switch: conditional Logic on Superposition\n * Executes different logic branches based on the state of control qubits.\n * Because the register can be in a superposition of states (e.g. |0> + |1>),\n * MULTIPLE branches can execute effectively simultaneously on different subspaces.\n *\n * @param reg Quantum Register\n * @param controlQubit The qubit controlling the switch (Single control for v1)\n * @param cases Object mapping state (0 or 1) to a function executing quantum operations\n */\nfunction muSwitch(reg, controlQubit, cases) {\n if (cases[0]) {\n muControl(reg, controlQubit, true, cases[0]);\n }\n if (cases[1]) {\n muControl(reg, controlQubit, false, cases[1]);\n }\n}\nexports.muSwitch = muSwitch;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(156);\n",""],"names":[],"ignoreList":[],"sourceRoot":""}
|