the editable site (validation-lab)

This commit is contained in:
kpgarrod committed 2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 files changed
+2227005

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2024 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
/**
* pdfjsVersion = 6.5.438
* pdfjsBuild = 0a4153349
*/
class SandboxSupportBase{constructor(t){this.win=t;this.timeoutIds=new Map;this.commFun=null}destroy(){this.commFun=null;for(const t of this.timeoutIds.values())this.win.clearTimeout(t);this.timeoutIds=null}exportValueToSandbox(t){throw new Error("Not implemented")}importValueFromSandbox(t){throw new Error("Not implemented")}createErrorForSandbox(t){throw new Error("Not implemented")}callSandboxFunction(t,e){if(this.commFun)try{e=this.exportValueToSandbox(e);this.commFun(t,e)}catch(t){this.win.console.error(t)}}createSandboxExternals(){const t={setTimeout:(t,e)=>{if("number"!=typeof t||"number"!=typeof e)return;0===t&&this.win.clearTimeout(this.timeoutIds.get(t));const r=this.win.setTimeout(()=>{this.timeoutIds.delete(t);this.callSandboxFunction("timeoutCb",{callbackId:t,interval:!1})},e);this.timeoutIds.set(t,r)},clearTimeout:t=>{this.win.clearTimeout(this.timeoutIds.get(t));this.timeoutIds.delete(t)},setInterval:(t,e)=>{if("number"!=typeof t||"number"!=typeof e)return;const r=this.win.setInterval(()=>{this.callSandboxFunction("timeoutCb",{callbackId:t,interval:!0})},e);this.timeoutIds.set(t,r)},clearInterval:t=>{this.win.clearInterval(this.timeoutIds.get(t));this.timeoutIds.delete(t)},alert:t=>{"string"==typeof t&&this.win.alert(t)},confirm:t=>"string"==typeof t&&this.win.confirm(t),prompt:(t,e)=>"string"!=typeof t||"string"!=typeof e?null:this.win.prompt(t,e),parseURL:t=>{const e=new this.win.URL(t);return Object.fromEntries(["hash","host","hostname","href","origin","password","pathname","port","protocol","search","searchParams","username"].map(t=>[t,e[t].toString()]))},send:t=>{if(!t)return;const e=new this.win.CustomEvent("updatefromsandbox",{detail:this.importValueFromSandbox(t)});this.win.dispatchEvent(e)}};Object.setPrototypeOf(t,null);return(e,r)=>{try{const i=t[e](...r);return this.exportValueToSandbox(i)}catch(t){throw this.createErrorForSandbox(t?.toString()??"")}}}}class SandboxSupport extends SandboxSupportBase{exportValueToSandbox(t){return JSON.stringify(t,(t,e)=>e instanceof Map?Object.fromEntries(e):e)}importValueFromSandbox(t){return t}createErrorForSandbox(t){return new Error(t)}}class Sandbox{constructor(t,e){this.support=new SandboxSupport(t,this);e.externalCall=this.support.createSandboxExternals();this._module=e;this._alertOnError=0}create(t){const e=['(()=>{"use strict";const{apply:t}=Reflect;function uncurryThis(e){return(r,...i)=>t(e,r,i)}function serializeError(t,e=""){let r,i;try{r=String(t)}catch{r="Unknown error"}try{i=t?.stack}catch{}return{command:"error",value:`${e}${"string"==typeof i?`${r}\\n${i}`:r}`}}const makeArr=()=>[],makeMap=()=>new Map,e=new Map,r=new WeakSet;function addPublicFunctions(...t){for(const e of t)"function"==typeof e&&r.add(e)}function exposeObject(t,r=!1){const i=Object.getPrototypeOf(t);let s=!r&&e.get(i);if(!s){const n=Object.getOwnPropertyDescriptors(i);delete n.constructor;for(const e of Object.values(n)){const{value:i,get:s,set:n}=e;addPublicFunctions(i,s,n);r&&"function"==typeof i&&(e.value=i.bind(t))}s=Object.create(Object.prototype,n);r||e.set(i,s)}return Object.setPrototypeOf(t,s)}const i=Object.freeze({s:"solid",d:"dashed",b:"beveled",i:"inset",u:"underline"}),s=Object.freeze({visible:0,hidden:1,delay:2}),n=Object.freeze({visible:0,hidden:1,noPrint:2,noView:3}),a=Object.freeze({Times:"Times-Roman",TimesB:"Times-Bold",TimesI:"Times-Italic",TimesBI:"Times-BoldItalic",Helv:"Helvetica",HelvB:"Helvetica-Bold",HelvI:"Helvetica-Oblique",HelvBI:"Helvetica-BoldOblique",Cour:"Courier",CourB:"Courier-Bold",CourI:"Courier-Oblique",CourBI:"Courier-BoldOblique",Symbol:"Symbol",ZapfD:"ZapfDingbats",KaGo:"HeiseiKakuGo-W5-UniJIS-UCS2-H",KaMi:"HeiseiMin-W3-UniJIS-UCS2-H"}),o=Object.freeze({n:"none",i:"invert",p:"push",o:"outline"}),l=Object.freeze({textOnly:0,iconOnly:1,iconTextV:2,textIconV:3,iconTextH:4,textIconH:5,overlay:6}),c=Object.freeze({proportional:0,anamorphic:1}),u=Object.freeze({always:0,never:1,tooBig:2,tooSmall:3}),h=Object.freeze({ch:"check",cr:"cross",di:"diamond",ci:"circle",st:"star",sq:"square"}),d=Object.freeze({blindsH:"BlindsHorizontal",blindsV:"BlindsVertical",boxI:"BoxIn",boxO:"BoxOut",dissolve:"Dissolve",glitterD:"GlitterDown",glitterR:"GlitterRight",glitterRD:"GlitterRightDown",random:"Random",replace:"Replace",splitHI:"SplitHorizontalIn",splitHO:"SplitHorizontalOut",splitVI:"SplitVerticalIn",splitVO:"SplitVerticalOut",wipeD:"WipeDown",wipeL:"WipeLeft",wipeR:"WipeRight",wipeU:"WipeUp"}),g=Object.freeze({none:"NoVary",fitP:"FitPage",fitW:"FitWidth",fitH:"FitHeight",fitV:"FitVisibleWidth",pref:"Preferred",refW:"ReflowWidth"}),p=Object.freeze({IDS_GREATER_THAN:"Invalid value: must be greater than or equal to % s.",IDS_GT_AND_LT:"Invalid value: must be greater than or equal to % s and less than or equal to % s.",IDS_LESS_THAN:"Invalid value: must be less than or equal to % s.",IDS_INVALID_MONTH:"** Invalid **",IDS_INVALID_DATE:"Invalid date / time: please ensure that the date / time exists. Field",IDS_INVALID_DATE2:" should match formaLine truncated
/*webpackIgnore: true*/
/*@vite-ignore*/
`${t}quickjs-eval.js`)),r=await e();return new Sandbox(window,r)}globalThis.pdfjsSandbox={QuickJSSandbox};export{QuickJSSandbox};