System.register(["cc"], function (_export, _context) {
  "use strict";

  var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, find, _cc, _dec, _class, _crd, cc, ccclass, property, NewComponent;

  return {
    setters: [function (_cc2) {
      _cclegacy = _cc2.cclegacy;
      __checkObsolete__ = _cc2.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc2.__checkObsoleteInNamespace__;
      _decorator = _cc2._decorator;
      Component = _cc2.Component;
      find = _cc2.find;
      _cc = _cc2;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "2f85a7khA9MfKrRo7JB5b2Y", "NewComponent", undefined);

      __checkObsolete__(['_decorator', 'Component', 'find', 'Node']);

      cc = __checkObsoleteInNamespace__(_cc);
      ({
        ccclass,
        property
      } = _decorator);

      _export("NewComponent", NewComponent = (_dec = ccclass('NewComponent'), _dec(_class = class NewComponent extends Component {
        onLoad() {
          let sp = this.node.getChildByName("sp");
          let a = this.node.getChildByName("a");
          let b = this.node.getChildByName("b");
          let tt = sp.getComponent(cc.Sprite).spriteFrame;
          let x = 168,
              y = 250,
              width = 84,
              height = 50; // tt.rect = new cc.Rect(x, y - Math.round(Math.random()*100), width, height);

          tt.rect = new cc.Rect(x, y, width, height); // let vv = cc.Texture2D.WrapMode.CLAMP_TO_EDGE;
          // let vv = cc.Texture2D.WrapMode.REPEAT;
          // tt.texture.setWrapMode(vv, vv, vv);

          console.log(tt.texture);
          let content = find('Canvas/ScrollView/view/content/Node');

          for (var i = 0; i < 40; i++) {
            for (var j = 0; j < 200; j++) {
              var node = new cc.Node();
              var Sprite = node.addComponent(cc.Sprite);
              var wh = node.getComponent(cc.UITransform);
              wh.anchorX = 0;
              wh.anchorY = 1;
              wh.width = width;
              wh.height = height;
              Sprite.spriteFrame = tt;

              if (j % 2 == 0) {
                node.setPosition(i * width, -j * height / 2);
              } else {
                node.setPosition(i * width + width / 2, -Math.floor(j / 2) * height - height / 2);
              }

              content.addChild(node);
            }
          }

          a.on(cc.Node.EventType.TOUCH_END, () => {
            for (var i = 0; i < content.children.length; i++) {
              var node = content.children[i];
              var Sprite = node.getComponent(cc.Sprite);
              Sprite.spriteFrame = null;
            }
          }, this);
          b.on(cc.Node.EventType.TOUCH_END, () => {
            let arr = [];

            for (var i = 0; i < content.children.length; i++) {
              var node = content.children[i];
              arr.push(node);
            }

            content.removeAllChildren();
            this.shuffle(arr);

            for (var i = 0; i < arr.length; i++) {
              var node = arr[i];
              var Sprite = node.getComponent(cc.Sprite);
              Sprite.spriteFrame = tt;
              content.addChild(node);
            }
          }, this);
        }

        shuffle(arr, deep = 5) {
          function sortFun(a, b) {
            return Math.random() < .5 ? 1 : -1;
          }

          while (deep > 0) {
            arr.sort(sortFun);
            deep--;
          }

          return arr;
        }

        start() {}

        update(deltaTime) {}

      }) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=7b3f7650d174f03385fec397f701c794e4d01a8c.js.map