pocketbase/ui/dist/assets/autocomplete.worker-8hFaOFL...

5 lines
89 KiB
JavaScript
Raw Normal View History

2024-02-24 19:46:16 +08:00
(function(){"use strict";class P extends Error{}class $n extends P{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Zn extends P{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Un extends P{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class j extends P{}class at extends P{constructor(e){super(`Invalid unit ${e}`)}}class D extends P{}class Z extends P{constructor(){super("Zone is an abstract class")}}const c="numeric",C="short",M="long",ge={year:c,month:c,day:c},ot={year:c,month:C,day:c},qn={year:c,month:C,day:c,weekday:C},ut={year:c,month:M,day:c},lt={year:c,month:M,day:c,weekday:M},ct={hour:c,minute:c},ft={hour:c,minute:c,second:c},dt={hour:c,minute:c,second:c,timeZoneName:C},ht={hour:c,minute:c,second:c,timeZoneName:M},mt={hour:c,minute:c,hourCycle:"h23"},yt={hour:c,minute:c,second:c,hourCycle:"h23"},gt={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:C},pt={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:M},wt={year:c,month:c,day:c,hour:c,minute:c},St={year:c,month:c,day:c,hour:c,minute:c,second:c},kt={year:c,month:C,day:c,hour:c,minute:c},Tt={year:c,month:C,day:c,hour:c,minute:c,second:c},zn={year:c,month:C,day:c,weekday:C,hour:c,minute:c},Ot={year:c,month:M,day:c,hour:c,minute:c,timeZoneName:C},Nt={year:c,month:M,day:c,hour:c,minute:c,second:c,timeZoneName:C},Et={year:c,month:M,day:c,weekday:M,hour:c,minute:c,timeZoneName:M},xt={year:c,month:M,day:c,weekday:M,hour:c,minute:c,second:c,timeZoneName:M};class ie{get type(){throw new Z}get name(){throw new Z}get ianaName(){return this.name}get isUniversal(){throw new Z}offsetName(e,t){throw new Z}formatOffset(e,t){throw new Z}offset(e){throw new Z}equals(e){throw new Z}get isValid(){throw new Z}}let Ce=null;class pe extends ie{static get instance(){return Ce===null&&(Ce=new pe),Ce}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Kt(e,t,n)}formatOffset(e,t){return le(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let we={};function Pn(s){return we[s]||(we[s]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),we[s]}const Yn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Jn(s,e){const t=s.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,r,i,a,o,u,l,f]=n;return[a,r,i,o,u,l,f]}function Bn(s,e){const t=s.formatToParts(e),n=[];for(let r=0;r<t.length;r++){const{type:i,value:a}=t[r],o=Yn[i];i==="era"?n[o]=a:y(o)||(n[o]=parseInt(a,10))}return n}let Se={};class $ extends ie{static create(e){return Se[e]||(Se[e]=new $(e)),Se[e]}static resetCache(){Se={},we={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=$.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Kt(e,t,n,this.name)}formatOffset(e,t){return le(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const n=Pn(this.name);let[r,i,a,o,u,l,f]=n.formatToParts?Bn(n,t):Jn(n,t);o==="BC"&&(r=-Math.abs(r)+1);const p=Ee({year:r,month:i,day:a,hour:u===24?0:u,minute:l,second:f,millisecond:0});let m=+t;const O=m%1e3;return m-=O>=0?O:1e3+O,(p-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let bt={};function Gn(s,e={}){const t=JSON.stringify([s,e]);let n=bt[t];return n||(n=new Intl.ListFormat(s,e),bt[t]=n),n}let We={};function Le(s,e={}){const t=JSON.stringify([s,e]);let n=We[t];return n||(n=new Intl.DateTimeFormat(s,e),We[t]=n),n}let Re={};function jn(s,e={}){const t=JSON.stringify([s,e]);let n=Re[t];return n||(n=new Intl.NumberFormat(s,e),Re[t]=n),n}let $e={};function Kn(s,e={}){const{b
`),t+=n.map(r=>{let i="";return r.name.includes("(")||r.name.includes(" ")?i+=r.name:i+="`"+r.name+"`",r.collate&&(i+=" COLLATE "+r.collate),r.sort&&(i+=" "+r.sort.toUpperCase()),i}).join(`,
`),n.length>1&&(t+=`
`),t+=")",e.where&&(t+=` WHERE ${e.where}`),t}static replaceIndexTableName(e,t){const n=h.parseIndex(e);return n.tableName=t,h.buildIndex(n)}static replaceIndexColumn(e,t,n){if(t===n)return e;const r=h.parseIndex(e);let i=!1;for(let a of r.columns)a.name===t&&(a.name=n,i=!0);return i?h.buildIndex(r):e}static normalizeSearchFilter(e,t){if(e=(e||"").trim(),!e||!t.length)return e;const n=["=","!=","~","!~",">",">=","<","<="];for(const r of n)if(e.includes(r))return e;return e=isNaN(e)&&e!="true"&&e!="false"?`"${e.replace(/^[\"\'\`]|[\"\'\`]$/gm,"")}"`:e,t.map(r=>`${r}~${e}`).join("||")}static normalizeLogsFilter(e,t=[]){return h.normalizeSearchFilter(e,["level","message","data"].concat(t))}static initCollection(e){return Object.assign({id:"",created:"",updated:"",name:"",type:"base",system:!1,listRule:null,viewRule:null,createRule:null,updateRule:null,deleteRule:null,schema:[],indexes:[],options:{}},e)}static initSchemaField(e){return Object.assign({id:"",name:"",type:"text",system:!1,required:!1,options:{}},e)}static triggerResize(){window.dispatchEvent(new Event("resize"))}static getHashQueryParams(){let e="";const t=window.location.hash.indexOf("?");return t>-1&&(e=window.location.hash.substring(t+1)),Object.fromEntries(new URLSearchParams(e))}static replaceHashQueryParams(e){e=e||{};let t="",n=window.location.hash;const r=n.indexOf("?");r>-1&&(t=n.substring(r+1),n=n.substring(0,r));const i=new URLSearchParams(t);for(let u in e){const l=e[u];l===null?i.delete(u):i.set(u,l)}t=i.toString(),t!=""&&(n+="?"+t);let a=window.location.href;const o=a.indexOf("#");o>-1&&(a=a.substring(0,o)),window.location.replace(a+n)}}const nt=11e3;onmessage=s=>{var t,n;if(!s.data.collections)return;const e={};e.baseKeys=h.getCollectionAutocompleteKeys(s.data.collections,(t=s.data.baseCollection)==null?void 0:t.name),e.baseKeys=rt(e.baseKeys.sort(st),nt),s.data.disableRequestKeys||(e.requestKeys=h.getRequestAutocompleteKeys(s.data.collections,(n=s.data.baseCollection)==null?void 0:n.name),e.requestKeys=rt(e.requestKeys.sort(st),nt)),s.data.disableCollectionJoinKeys||(e.collectionJoinKeys=h.getCollectionJoinAutocompleteKeys(s.data.collections),e.collectionJoinKeys=rt(e.collectionJoinKeys.sort(st),nt)),postMessage(e)};function st(s,e){return s.length-e.length}function rt(s,e){return s.length>e?s.slice(0,e):s}})();