index-54482e53.js 8.2 KB

1
  1. import{d as C,g as I,P as N}from"./index-247d3e24.js";const F="%[a-f0-9]{2}",m=new RegExp("("+F+")|([^%]+?)","gi"),y=new RegExp("("+F+")+","gi");function d(e,r){try{return[decodeURIComponent(e.join(""))]}catch(s){}if(e.length===1)return e;r=r||1;const t=e.slice(0,r),n=e.slice(r);return Array.prototype.concat.call([],d(t),d(n))}function D(e){try{return decodeURIComponent(e)}catch(r){let t=e.match(m)||[];for(let n=1;n<t.length;n++)e=d(t,n).join(""),t=e.match(m)||[];return e}}function P(e){const r={"%FE%FF":"��","%FF%FE":"��"};let t=y.exec(e);for(;t;){try{r[t[0]]=decodeURIComponent(t[0])}catch(s){const i=D(t[0]);i!==t[0]&&(r[t[0]]=i)}t=y.exec(e)}r["%C2"]="�";const n=Object.keys(r);for(const s of n)e=e.replace(new RegExp(s,"g"),r[s]);return e}function U(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch(r){return P(e)}}function w(e,r){if(!(typeof e=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||r==="")return[];const t=e.indexOf(r);return t===-1?[]:[e.slice(0,t),e.slice(t+r.length)]}function V(e,r){const t={};if(Array.isArray(r))for(const n of r){const s=Object.getOwnPropertyDescriptor(e,n);s!=null&&s.enumerable&&Object.defineProperty(t,n,s)}else for(const n of Reflect.ownKeys(e)){const s=Object.getOwnPropertyDescriptor(e,n);if(s.enumerable){const i=e[n];r(n,i,e)&&Object.defineProperty(t,n,s)}}return t}const R=e=>e==null,q=e=>encodeURIComponent(e).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),l=Symbol("encodeFragmentIdentifier");function L(e){switch(e.arrayFormat){case"index":return r=>(t,n)=>{const s=t.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[o(r,e),"[",s,"]"].join("")]:[...t,[o(r,e),"[",o(s,e),"]=",o(n,e)].join("")]};case"bracket":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[o(r,e),"[]"].join("")]:[...t,[o(r,e),"[]=",o(n,e)].join("")];case"colon-list-separator":return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,[o(r,e),":list="].join("")]:[...t,[o(r,e),":list=",o(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const r=e.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,s)=>s===void 0||e.skipNull&&s===null||e.skipEmptyString&&s===""?n:(s=s===null?"":s,n.length===0?[[o(t,e),r,o(s,e)].join("")]:[[n,o(s,e)].join(e.arrayFormatSeparator)])}default:return r=>(t,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?t:n===null?[...t,o(r,e)]:[...t,[o(r,e),"=",o(n,e)].join("")]}}function M(e){let r;switch(e.arrayFormat){case"index":return(t,n,s)=>{if(r=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!r){s[t]=n;return}s[t]===void 0&&(s[t]={}),s[t][r[1]]=n};case"bracket":return(t,n,s)=>{if(r=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!r){s[t]=n;return}if(s[t]===void 0){s[t]=[n];return}s[t]=[...s[t],n]};case"colon-list-separator":return(t,n,s)=>{if(r=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!r){s[t]=n;return}if(s[t]===void 0){s[t]=[n];return}s[t]=[...s[t],n]};case"comma":case"separator":return(t,n,s)=>{const i=typeof n=="string"&&n.includes(e.arrayFormatSeparator),a=typeof n=="string"&&!i&&c(n,e).includes(e.arrayFormatSeparator);n=a?c(n,e):n;const f=i||a?n.split(e.arrayFormatSeparator).map(A=>c(A,e)):n===null?n:c(n,e);s[t]=f};case"bracket-separator":return(t,n,s)=>{const i=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!i){s[t]=n&&c(n,e);return}const a=n===null?[]:n.split(e.arrayFormatSeparator).map(f=>c(f,e));if(s[t]===void 0){s[t]=a;return}s[t]=[...s[t],...a]};default:return(t,n,s)=>{if(s[t]===void 0){s[t]=n;return}s[t]=[...[s[t]].flat(),n]}}}function S(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,r){return r.encode?r.strict?q(e):encodeURIComponent(e):e}function c(e,r){return r.decode?U(e):e}function b(e){return Array.isArray(e)?e.sort():typeof e=="object"?b(Object.keys(e)).sort((r,t)=>Number(r)-Number(t)).map(r=>e[r]):e}function x(e){const r=e.indexOf("#");return r!==-1&&(e=e.slice(0,r)),e}function B(e){let r="";const t=e.indexOf("#");return t!==-1&&(r=e.slice(t)),r}function p(e,r){return r.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):r.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function u(e){e=x(e);const r=e.indexOf("?");return r===-1?"":e.slice(r+1)}function h(e,r){r={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...r},S(r.arrayFormatSeparator);const t=M(r),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const s of e.split("&")){if(s==="")continue;const i=r.decode?s.replace(/\+/g," "):s;let[a,f]=w(i,"=");a===void 0&&(a=i),f=f===void 0?null:["comma","separator","bracket-separator"].includes(r.arrayFormat)?f:c(f,r),t(c(a,r),f,n)}for(const[s,i]of Object.entries(n))if(typeof i=="object"&&i!==null)for(const[a,f]of Object.entries(i))i[a]=p(f,r);else n[s]=p(i,r);return r.sort===!1?n:(r.sort===!0?Object.keys(n).sort():Object.keys(n).sort(r.sort)).reduce((s,i)=>{const a=n[i];return a&&typeof a=="object"&&!Array.isArray(a)?s[i]=b(a):s[i]=a,s},Object.create(null))}function O(e,r){if(!e)return"";r={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...r},S(r.arrayFormatSeparator);const t=a=>r.skipNull&&R(e[a])||r.skipEmptyString&&e[a]==="",n=L(r),s={};for(const[a,f]of Object.entries(e))t(a)||(s[a]=f);const i=Object.keys(s);return r.sort!==!1&&i.sort(r.sort),i.map(a=>{const f=e[a];return f===void 0?"":f===null?o(a,r):Array.isArray(f)?f.length===0&&r.arrayFormat==="bracket-separator"?o(a,r)+"[]":f.reduce(n(a),[]).join("&"):o(a,r)+"="+o(f,r)}).filter(a=>a.length>0).join("&")}function $(e,r){var s,i;r={decode:!0,...r};let[t,n]=w(e,"#");return t===void 0&&(t=e),{url:(i=(s=t==null?void 0:t.split("?"))==null?void 0:s[0])!=null?i:"",query:h(u(e),r),...r&&r.parseFragmentIdentifier&&n?{fragmentIdentifier:c(n,r)}:{}}}function E(e,r){r={encode:!0,strict:!0,[l]:!0,...r};const t=x(e.url).split("?")[0]||"",n=u(e.url),s={...h(n,{sort:!1}),...e.query};let i=O(s,r);i&&(i=`?${i}`);let a=B(e.url);if(e.fragmentIdentifier){const f=new URL(t);f.hash=e.fragmentIdentifier,a=r[l]?f.hash:`#${e.fragmentIdentifier}`}return`${t}${i}${a}`}function j(e,r,t){t={parseFragmentIdentifier:!0,[l]:!1,...t};const{url:n,query:s,fragmentIdentifier:i}=$(e,t);return E({url:n,query:V(s,r),fragmentIdentifier:i},t)}function H(e,r,t){const n=Array.isArray(r)?s=>!r.includes(s):(s,i)=>!r(s,i);return j(e,n,t)}const g=Object.freeze(Object.defineProperty({__proto__:null,exclude:H,extract:u,parse:h,parseUrl:$,pick:j,stringify:O,stringifyUrl:E},Symbol.toStringTag,{value:"Module"})),z=C({name:"col-popup",props:{height:{type:String,default:"100%"},width:{type:String,default:"100%"},teleport:{type:String,default:""},destroy:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},position:{type:String,default:"bottom"},zIndex:{type:Number,default:2018}},emits:["close","update:modelValue"],data(){return{popupShow:!1,isDestroy:!1}},watch:{modelValue(){this.hashState()}},mounted(){this.destroy&&(this.isDestroy=!1),window.addEventListener("hashchange",this.onHash,!1)},unmounted(){window.removeEventListener("hashchange",this.onHash,!1)},methods:{onHash(){this.$emit("update:modelValue",!1),this.isDestroy=!1,this.$emit("close")},onPopupClose(e){this.$emit("update:modelValue",e),this.hashState()},hashState(){if(this.modelValue){this.isDestroy=!1;const e=window.location.hash.slice(1).split("?"),r=g.parse(e[1]);let t=0;for(const i in r)t++;const n=window.location.href,s=t>0?"&sPop="+ +new Date:"?sPop="+ +new Date;history.pushState("","",`${n}${s}`)}else{const e=window.location.hash.slice(1).split("?");g.parse(e[1]).sPop&&window.history.go(-1)}this.$refs.protocolPopup&&(this.$refs.protocolPopup.scrollTop=0)}},render(){return I(N,{ref:"protocolPopup",show:this.modelValue,transitionAppear:!0,position:this.position,teleport:this.teleport,style:{height:this.height,width:this.width},zIndex:this.zIndex,onClosed:()=>{this.destroy&&(this.isDestroy=!0)}},{default:()=>[this.$slots.default&&!this.isDestroy&&this.$slots.default()]})}});export{z as M};