13 lines
75 KiB
JavaScript
13 lines
75 KiB
JavaScript
|
var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var check=function(t){return t&&t.Math==Math&&t},e=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},r=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i={f:o&&!n.call({1:2},1)?function propertyIsEnumerable(t){var e=o(this,t);return!!e&&e.enumerable}:n},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},a={}.toString,classofRaw=function(t){return a.call(t).slice(8,-1)},c="".split,u=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?c.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return u(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},s={}.hasOwnProperty,has=function(t,e){return s.call(t,e)},f=e.document,l=isObject(f)&&isObject(f.createElement),documentCreateElement=function(t){return l?f.createElement(t):{}},h=!r&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),p=Object.getOwnPropertyDescriptor,v={f:r?p:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),h)try{return p(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!i.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},d=Object.defineProperty,g={f:r?d:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),h)try{return d(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},y=r?function(t,e,r){return g.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,r){try{y(e,t,r)}catch(n){e[t]=r}return r},m=e["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),b=Function.toString;"function"!=typeof m.inspectSource&&(m.inspectSource=function(t){return b.call(t)});var w,S,x,E=m.inspectSource,O=e.WeakMap,P="function"==typeof O&&/native code/.test(E(O)),A=createCommonjsModule((function(t){(t.exports=function(t,e){return m[t]||(m[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),j=0,L=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++j+L).toString(36)},k=A("keys"),sharedKey=function(t){return k[t]||(k[t]=uid(t))},R={},I=e.WeakMap;if(P){var T=new I,_=T.get,C=T.has,U=T.set;w=function(t,e){return U.call(T,t,e),e},S=function(t){return _.call(T,t)||{}},x=function(t){return C.call(T,t)}}else{var M=sharedKey("state");R[M]=!0,w=function(t,e){return y(t,M,e),e},S=function(t){return has(t,M)?t[M]:{}},x=function(t){return has(t,M)}}var G={set:w,get:S,has:x,enforce:function(t){return x(t)?S(t):w(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=S(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},N=createCommonjsModule((function(t){var r=G.get,n=G.enforce,o=
|
||
|
/**
|
||
|
* Localizing script for SVG-edit UI.
|
||
|
* @module locale
|
||
|
* @license MIT
|
||
|
*
|
||
|
* @copyright 2010 Narendra Sisodya
|
||
|
* @copyright 2010 Alexis Deveria
|
||
|
*
|
||
|
*/
|
||
|
jQuery;var ca=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee2(t,e){var r;return regeneratorRuntime.wrap((function _callee2$(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,import("./extensions/ext-".concat(t,"/locale/").concat(e,".js"));case 3:r=n.sent,n.next=12;break;case 6:return n.prev=6,n.t0=n.catch(0),console.error("Missing translation (".concat(e,") for extension ").concat(t," - using 'en'")),n.next=11,import("./extensions/ext-".concat(t,"/locale/en.js"));case 11:r=n.sent;case 12:return n.abrupt("return",r.default);case 13:case"end":return n.stop()}}),_callee2,null,[[0,6]])})));return function loadExtensionTranslation(e,r){return t.apply(this,arguments)}}(),ua={name:"storage",init:function init(t){var e=t.$,r=this,n=r.canvas,o=r.curConfig,i=o.emptyStorageOnDecline,a=o.noStorageOnLoad,c=o.forceStorage,u=r.storage,s=r.updateCanvas;function replaceStoragePrompt(t){t=t?"storagePrompt="+t:"";var e=top.location;e.href.includes("storagePrompt=")?e.href=e.href.replace(/([&?])storagePrompt=[^&]*(&?)/,(function(e,r,n){return(t?r:"")+t+(!t&&n?r:n||"")})):e.href+=(e.href.includes("?")?"&":"?")+t}function setSVGContentStorage(t){if(u){var e="svgedit-"+r.curConfig.canvasName;t?u.setItem(e,t):u.removeItem(e)}}function expireCookie(t){document.cookie=encodeURIComponent(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"}function setupBeforeUnloadListener(){window.addEventListener("beforeunload",(function(t){if(document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/)){document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/)&&setSVGContentStorage(n.getSvgString()),r.setConfig({no_save_warning:!0});var e=r.curPrefs;Object.entries(e).forEach((function(t){var e=_slicedToArray(t,2),r=e[0],n=e[1];r="svg-edit-"+r,void 0!==n&&(u?u.setItem(r,n):window.widget?window.widget.setPreferenceForKey(n,r):(n=encodeURIComponent(n),document.cookie=encodeURIComponent(r)+"="+n+"; expires=Fri, 31 Dec 9999 23:59:59 GMT"))}))}}))}var f=!1;return{name:"storage",langReady:function langReady(t){return _asyncToGenerator(regeneratorRuntime.mark((function _callee(){var n,o,l,h,p,v,d,g,y,m,b,w,S,x,E,O,P,A;return regeneratorRuntime.wrap((function _callee$(j){for(;;)switch(j.prev=j.next){case 0:return t.lang,n=new URL(top.location).searchParams.get("storagePrompt"),j.next=4,ca("storage",r.curPrefs.lang);case 4:if(o=j.sent,l=o.message,h=o.storagePrefsAndContent,p=o.storagePrefsOnly,v=o.storagePrefs,d=o.storageNoPrefsOrContent,g=o.storageNoPrefs,y=o.rememberLabel,m=o.rememberTooltip,!f){j.next=8;break}return j.abrupt("return");case 8:if(f=!0,c||"true"!==n&&("false"===n||document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/))){j.next=44;break}return b=[],u?b.unshift({value:"prefsAndContent",text:h},{value:"prefsOnly",text:p},{value:"noPrefsOrContent",text:d}):b.unshift({value:"prefsOnly",text:v},{value:"noPrefsOrContent",text:g}),w=e("#dialog_container")[0].style.width,S=e("#dialog_container")[0].style.marginLeft,x=e("#dialog_content")[0].style.height,E=e("#dialog_container")[0].style.height,e("#dialog_content")[0].style.height="120px",e("#dialog_container")[0].style.height="170px",e("#dialog_container")[0].style.width="800px",e("#dialog_container")[0].style.marginLeft="-400px",r.storagePromptState="waiting",j.next=20,e.select(l,b,null,null,{label:y,checked:!0,tooltip:m});case 20:if(O=j.sent,P=O.response,A=O.checked,!P||"noPrefsOrContent"===P){j.next=30;break}if(document.cookie="svgeditstore="+encodeURIComponent(P)+"; expires=Fri, 31 Dec 9999 23:59:59 GMT","true"!==n||!A){j.next=28;break}return replaceStoragePrompt(),j.abrupt("return");case 28:j.next=35;break;case 30:if(expireCookie("svgeditstore"),P&&i&&(setSVGContentStorage(""),Object.keys(r.curPrefs).forEach((function(t){t="svg-edit-"+t,u&&u.removeItem(t),expireCookie(t)}))),!P||!A){j.next=35;break}return replaceStoragePrompt("false"),j.abrupt("return");case 35:e("#dialog_container")[0].style.width=w,e("#dialog_container")[0].style.marginLeft=S,e("#dialog_content")[0].style.height=x,e("#dialog_container")[0].style.height=E,s
|
||
|
//# sourceMappingURL=ext-storage.js.map
|