if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
  Promise.prototype.finally = function(callback) {
    const promise = this.constructor;
    return this.then(
      (value) => promise.resolve(callback()).then(() => value),
      (reason) => promise.resolve(callback()).then(() => {
        throw reason;
      })
    );
  };
}
;
if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
  const global = uni.requireGlobal();
  ArrayBuffer = global.ArrayBuffer;
  Int8Array = global.Int8Array;
  Uint8Array = global.Uint8Array;
  Uint8ClampedArray = global.Uint8ClampedArray;
  Int16Array = global.Int16Array;
  Uint16Array = global.Uint16Array;
  Int32Array = global.Int32Array;
  Uint32Array = global.Uint32Array;
  Float32Array = global.Float32Array;
  Float64Array = global.Float64Array;
  BigInt64Array = global.BigInt64Array;
  BigUint64Array = global.BigUint64Array;
}
;
if (uni.restoreGlobal) {
  uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
}
(function(vue) {
  "use strict";
  function formatAppLog(type, filename, ...args) {
    if (uni.__log__) {
      uni.__log__(type, filename, ...args);
    } else {
      console[type].apply(console, [...args, filename]);
    }
  }
  const RJAppAuthnCenter_utsProxy = uni.requireUTSPlugin("uni_modules/RJ-AppAuthnCenter");
  const _export_sfc = (sfc, props) => {
    const target = sfc.__vccOpts || sfc;
    for (const [key, val] of props) {
      target[key] = val;
    }
    return target;
  };
  const _sfc_main$1 = {
    onLoad() {
    },
    data() {
      return {
        APPID: "",
        Output: "",
        multilineText: "",
        formData: {
          clientId: "OC4wNS4wNS4wNy4wMC4wMy4wMS4wMS4w",
          redirectUrl: "https://s10sso.ruishan.cc/gate/public/sdkAuth/index.html",
          endSessionRedirectUrl: "https://s10sso.ruishan.cc/gate/public/sdkAuth/index.html",
          authorizationScope: "openid",
          authorizationEndpointUrl: "https://s10sso.ruishan.cc/cas/oidc/authorize",
          authorizationTokenEndpointUrl: "https://s10sso.ruishan.cc/cas/oidc/accessToken",
          userInfoEndpointUri: "https://s10sso.ruishan.cc/cas/oidc/profile",
          endSessionEndpoint: "https://s10sso.ruishan.cc/cas/logout",
          launchSheme: "net.rj.appauth",
          defaultbrowser: '{"packagename":"","useCustomTab":false }',
          discoveryUri: "https://s10sso.ruishan.cc/cas/oidc/.well-known",
          authorizationScene: 0
          //0系统浏览器 ,1是webview
        }
      };
    },
    methods: {
      getAuthenticationIntent() {
        let options = {
          paramA: false,
          fail: (errCode, errMsg) => {
            formatAppLog("log", "at pages/index/index.vue:73", "getAuthenticationIntent error:" + errMsg + errCode);
            this.Output = "Error:";
            this.multilineText = "errCode:" + errCode + "   errMsg:" + errMsg;
          },
          success: (res) => {
            formatAppLog("log", "at pages/index/index.vue:78", "getAuthenticationIntent success:" + res);
            this.Output = "Success:";
            this.multilineText = res;
          }
        };
        formatAppLog("log", "at pages/index/index.vue:84", "getAuthenticationIntent !!!!...data=" + JSON.stringify(this.formData));
        RJAppAuthnCenter_utsProxy.innerGetAuthorizationIntent(
          this.formData.clientId,
          this.formData.redirectUrl,
          this.formData.discoveryUri,
          this.formData.launchSheme,
          "com.example.webauth",
          options
        );
      },
      endSession() {
        formatAppLog("log", "at pages/index/index.vue:94", "endSession !!!!...data=" + JSON.stringify(this.formData));
        let options = {
          paramA: false,
          fail: (errCode, errMsg) => {
            formatAppLog("log", "at pages/index/index.vue:100", "endSession error:" + errMsg + errCode);
            this.Output = "Error:";
            this.multilineText = "errCode:" + errCode + "   errMsg:" + errMsg;
          },
          success: (res) => {
            formatAppLog("log", "at pages/index/index.vue:105", "endSession success:" + res);
            this.Output = "Success:";
            this.multilineText = res;
          }
        };
        RJAppAuthnCenter_utsProxy.innerEndSession(
          this.formData.endSessionEndpoint,
          this.formData.redirectUrl,
          this.formData.launchSheme,
          "com.example.webauth",
          options
        );
        this.Output = "";
        this.multilineText = "";
      }
    }
  };
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
    return vue.openBlock(), vue.createElementBlock(
      vue.Fragment,
      null,
      [
        vue.createElementVNode("view", null, [
          vue.createElementVNode("p", { style: { "margin-top": "5px", "margin-left": "10px" } }, "APPID："),
          vue.withDirectives(vue.createElementVNode(
            "input",
            {
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.formData.clientId = $event),
              style: { "background-color": "#E4E1E1", "margin-top": "10px", "margin-left": "10px", "margin-right": "5px", "height": "35px" }
            },
            null,
            512
            /* NEED_PATCH */
          ), [
            [vue.vModelText, $data.formData.clientId]
          ])
        ]),
        vue.createElementVNode("view", { style: { "margin-top": "10px" } }, [
          vue.createElementVNode("p", { style: { "margin-top": "5px", "margin-left": "10px" } }, "Redirect Url："),
          vue.withDirectives(vue.createElementVNode(
            "input",
            {
              "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.formData.redirectUrl = $event),
              style: { "background-color": "#E4E1E1", "margin-left": "10px", "margin-right": "10px", "margin-top": "5px", "height": "35px" }
            },
            null,
            512
            /* NEED_PATCH */
          ), [
            [vue.vModelText, $data.formData.redirectUrl]
          ])
        ]),
        vue.createElementVNode("view", { style: { "margin-top": "10px" } }, [
          vue.createElementVNode("p", { style: { "margin-top": "5px", "margin-left": "10px" } }, "Discovery Url："),
          vue.withDirectives(vue.createElementVNode(
            "input",
            {
              "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.formData.discoveryUri = $event),
              style: { "background-color": "#E4E1E1", "margin-top": "10px", "margin-left": "10px", "margin-right": "5px", "height": "35px" }
            },
            null,
            512
            /* NEED_PATCH */
          ), [
            [vue.vModelText, $data.formData.discoveryUri]
          ])
        ]),
        vue.createElementVNode("view", { style: { "margin-top": "10px" } }, [
          vue.createElementVNode("p", { style: { "margin-top": "5px", "margin-left": "10px" } }, "endsession_endpoint_uri："),
          vue.withDirectives(vue.createElementVNode(
            "input",
            {
              "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.formData.endSessionEndpoint = $event),
              style: { "background-color": "#E4E1E1", "margin-left": "10px", "margin-right": "10px", "height": "35px" }
            },
            null,
            512
            /* NEED_PATCH */
          ), [
            [vue.vModelText, $data.formData.endSessionEndpoint]
          ])
        ]),
        vue.createElementVNode("div", { style: { "margin-top": "40px" } }, [
          vue.createElementVNode("button", {
            type: "primary",
            onClick: _cache[4] || (_cache[4] = (...args) => $options.getAuthenticationIntent && $options.getAuthenticationIntent(...args))
          }, "认证")
        ]),
        vue.createElementVNode("div", { style: { "margin-top": "5px" } }, [
          vue.createElementVNode("button", {
            type: "primary",
            onClick: _cache[5] || (_cache[5] = (...args) => $options.endSession && $options.endSession(...args))
          }, "清空登录态")
        ]),
        vue.createElementVNode(
          "p",
          { style: { "margin-top": "20px" } },
          vue.toDisplayString($data.Output),
          1
          /* TEXT */
        ),
        vue.createElementVNode("div", { style: { "margin-top": "10px" } }, [
          vue.createElementVNode(
            "p",
            { class: "multilineText" },
            vue.toDisplayString($data.multilineText),
            1
            /* TEXT */
          )
        ])
      ],
      64
      /* STABLE_FRAGMENT */
    );
  }
  const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/Users/zhangjiejun/Documents/HBuilderProjects/uniAppAuthSample/pages/index/index.vue"]]);
  __definePage("pages/index/index", PagesIndexIndex);
  const _sfc_main = {
    onLaunch: function() {
      formatAppLog("log", "at App.vue:4", "App Launch");
    },
    onShow: function() {
      formatAppLog("log", "at App.vue:7", "App Show");
    },
    onHide: function() {
      formatAppLog("log", "at App.vue:10", "App Hide");
    }
  };
  const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/zhangjiejun/Documents/HBuilderProjects/uniAppAuthSample/App.vue"]]);
  function createApp() {
    const app = vue.createVueApp(App);
    return {
      app
    };
  }
  const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  uni.Vuex = __Vuex__;
  uni.Pinia = __Pinia__;
  __app__.provide("__globalStyles", __uniConfig.styles);
  __app__._component.mpType = "app";
  __app__._component.render = () => {
  };
  __app__.mount("#app");
})(Vue);
