@innovastudio/contentbuilder 1.4.83 → 1.4.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innovastudio/contentbuilder",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.84",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "public/contentbuilder/contentbuilder.esm.js",
|
|
7
7
|
"files": [
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"cropperjs": "^1.5.12",
|
|
56
56
|
"js-beautify": "^1.14.0",
|
|
57
57
|
"moveable": "^0.30.0",
|
|
58
|
-
"opus-recorder": "^8.0.5",
|
|
59
58
|
"rangy": "^1.3.0",
|
|
60
59
|
"socket.io-client": "^4.7.1",
|
|
61
60
|
"sortablejs": "^1.14.0",
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
2
|
|
|
3
|
-
function getDefaultExportFromCjs (x) {
|
|
4
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
var rangyCore = {exports: {}};
|
|
8
4
|
|
|
9
5
|
/**
|
|
@@ -77398,14 +77394,8 @@ class Lib {
|
|
|
77398
77394
|
}
|
|
77399
77395
|
}
|
|
77400
77396
|
|
|
77401
|
-
|
|
77402
|
-
|
|
77403
|
-
(function (module, exports) {
|
|
77404
|
-
!function(e,t){module.exports=t();}("undefined"!=typeof self?self:commonjsGlobal,(function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n});},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){(function(t){function o(e,t){if(null==e)return {};var o,n,i=function(e,t){if(null==e)return {};var o,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i}var n=t.AudioContext||t.webkitAudioContext,i=function e(){var t=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.isRecordingSupported())throw new Error("Recording is not supported in this browser");this.state="inactive",this.config=Object.assign({bufferLength:4096,encoderApplication:2049,encoderFrameSize:20,encoderPath:"encoderWorker.min.js",encoderSampleRate:48e3,maxFramesPerPage:40,mediaTrackConstraints:!0,monitorGain:0,numberOfChannels:1,recordingGain:1,resampleQuality:3,streamPages:!1,wavBitDepth:16,sourceNode:{context:null}},o),this.encodedSamplePosition=0,this.initAudioContext(),this.initialize=this.initWorklet().then((function(){return t.initEncoder()}));};i.isRecordingSupported=function(){var e=t.navigator&&t.navigator.mediaDevices&&t.navigator.mediaDevices.getUserMedia;return n&&e&&t.WebAssembly},i.version="8.0.5",i.prototype.clearStream=function(){this.stream&&(this.stream.getTracks?this.stream.getTracks().forEach((function(e){return e.stop()})):this.stream.stop());},i.prototype.close=function(){return this.monitorGainNode.disconnect(),this.recordingGainNode.disconnect(),this.sourceNode&&this.sourceNode.disconnect(),this.clearStream(),this.encoder&&(this.encoderNode.disconnect(),this.encoder.postMessage({command:"close"})),this.config.sourceNode.context?Promise.resolve():this.audioContext.close()},i.prototype.encodeBuffers=function(e){if("recording"===this.state){for(var t=[],o=0;o<e.numberOfChannels;o++)t[o]=e.getChannelData(o);this.encoder.postMessage({command:"encode",buffers:t});}},i.prototype.initAudioContext=function(){this.audioContext=this.config.sourceNode.context?this.config.sourceNode.context:new n,this.monitorGainNode=this.audioContext.createGain(),this.setMonitorGain(this.config.monitorGain),this.recordingGainNode=this.audioContext.createGain(),this.setRecordingGain(this.config.recordingGain);},i.prototype.initEncoder=function(){var e=this;this.audioContext.audioWorklet?(this.encoderNode=new AudioWorkletNode(this.audioContext,"encoder-worklet",{numberOfOutputs:0}),this.encoder=this.encoderNode.port):(console.log("audioWorklet support not detected. Falling back to scriptProcessor"),this.encodeBuffers=function(){return delete e.encodeBuffers},this.encoderNode=this.audioContext.createScriptProcessor(this.config.bufferLength,this.config.numberOfChannels,this.config.numberOfChannels),this.encoderNode.onaudioprocess=function(t){var o=t.inputBuffer;return e.encodeBuffers(o)},this.encoderNode.connect(this.audioContext.destination),this.encoder=new t.Worker(this.config.encoderPath));},i.prototype.initSourceNode=function(){var e=this;return this.config.sourceNode.context?(this.sourceNode=this.config.sourceNode,Promise.resolve()):t.navigator.mediaDevices.getUserMedia({audio:this.config.mediaTrackConstraints}).then((function(t){e.stream=t,e.sourceNode=e.audioContext.createMediaStreamSource(t);}))},i.prototype.initWorker=function(){var e=this,t=(this.config.streamPages?this.streamPage:this.storePage).bind(this);return this.recordedPages=[],this.totalLength=0,new Promise((function(n){e.encoder.addEventListener("message",(function o(i){var r=i.data;switch(r.message){case"ready":n();break;case"page":e.encodedSamplePosition=r.samplePosition,t(r.page);break;case"done":e.encoder.removeEventListener("message",o),e.finish();}})),e.encoder.start&&e.encoder.start();var i=e.config,r=(i.sourceNode,o(i,["sourceNode"]));e.encoder.postMessage(Object.assign({command:"init",originalSampleRate:e.audioContext.sampleRate,wavSampleRate:e.audioContext.sampleRate},r));}))},i.prototype.initWorklet=function(){return this.audioContext.audioWorklet?this.audioContext.audioWorklet.addModule(this.config.encoderPath):Promise.resolve()},i.prototype.pause=function(e){var t=this;if("recording"===this.state)return this.state="paused",this.recordingGainNode.disconnect(),e&&this.config.streamPages?new Promise((function(e){t.encoder.addEventListener("message",(function o(n){"flushed"===n.data.message&&(t.encoder.removeEventListener("message",o),t.onpause(),e());})),t.encoder.start&&t.encoder.start(),t.encoder.postMessage({command:"flush"});})):(this.onpause(),Promise.resolve())},i.prototype.resume=function(){"paused"===this.state&&(this.state="recording",this.recordingGainNode.connect(this.encoderNode),this.onresume());},i.prototype.setRecordingGain=function(e){this.config.recordingGain=e,this.recordingGainNode&&this.audioContext&&this.recordingGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01);},i.prototype.setMonitorGain=function(e){this.config.monitorGain=e,this.monitorGainNode&&this.audioContext&&this.monitorGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01);},i.prototype.start=function(){var e=this;return "inactive"===this.state?(this.state="loading",this.encodedSamplePosition=0,this.audioContext.resume().then((function(){return e.initialize})).then((function(){return Promise.all([e.initSourceNode(),e.initWorker()])})).then((function(){e.state="recording",e.encoder.postMessage({command:"getHeaderPages"}),e.sourceNode.connect(e.monitorGainNode),e.sourceNode.connect(e.recordingGainNode),e.monitorGainNode.connect(e.audioContext.destination),e.recordingGainNode.connect(e.encoderNode),e.onstart();})).catch((function(t){throw e.state="inactive",t}))):Promise.resolve()},i.prototype.stop=function(){var e=this;return "paused"===this.state||"recording"===this.state?(this.state="inactive",this.recordingGainNode.connect(this.encoderNode),this.monitorGainNode.disconnect(),this.clearStream(),new Promise((function(t){e.encoder.addEventListener("message",(function o(n){"done"===n.data.message&&(e.encoder.removeEventListener("message",o),t());})),e.encoder.start&&e.encoder.start(),e.encoder.postMessage({command:"done"});}))):Promise.resolve()},i.prototype.storePage=function(e){this.recordedPages.push(e),this.totalLength+=e.length;},i.prototype.streamPage=function(e){this.ondataavailable(e);},i.prototype.finish=function(){if(!this.config.streamPages){var e=new Uint8Array(this.totalLength);this.recordedPages.reduce((function(t,o){return e.set(o,t),t+o.length}),0),this.ondataavailable(e);}this.onstop();},i.prototype.ondataavailable=function(){},i.prototype.onpause=function(){},i.prototype.onresume=function(){},i.prototype.onstart=function(){},i.prototype.onstop=function(){},e.exports=i;}).call(this,o(1));},function(e,t){var o;o=function(){return this}();try{o=o||new Function("return this")();}catch(e){"object"==typeof window&&(o=window);}e.exports=o;}])}));
|
|
77405
|
-
}(recorder_min));
|
|
77406
|
-
|
|
77407
|
-
var Recorder = /*@__PURE__*/getDefaultExportFromCjs(recorder_min.exports);
|
|
77408
|
-
|
|
77397
|
+
// import RecordRTC from 'recordrtc';
|
|
77398
|
+
// import Recorder from 'opus-recorder'; // Using Recorder
|
|
77409
77399
|
const dom = new Dom();
|
|
77410
77400
|
class Dictation {
|
|
77411
77401
|
constructor(opts = {}, builder) {
|
|
@@ -77845,11 +77835,11 @@ class Dictation {
|
|
|
77845
77835
|
this.mediaRecorder.stop();
|
|
77846
77836
|
this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
|
|
77847
77837
|
}
|
|
77848
|
-
} else {
|
|
77849
|
-
|
|
77850
|
-
|
|
77851
|
-
|
|
77852
|
-
|
|
77838
|
+
} /* else {
|
|
77839
|
+
// Using Recorder
|
|
77840
|
+
if(this.recorder) this.recorder.stop();
|
|
77841
|
+
if(this.localStream) this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
|
|
77842
|
+
} */
|
|
77853
77843
|
|
|
77854
77844
|
if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
|
|
77855
77845
|
this.websocket.close();
|
|
@@ -77922,22 +77912,23 @@ class Dictation {
|
|
|
77922
77912
|
}).catch(error => {
|
|
77923
77913
|
console.log(error);
|
|
77924
77914
|
});
|
|
77925
|
-
} else {
|
|
77926
|
-
|
|
77927
|
-
|
|
77928
|
-
|
|
77929
|
-
|
|
77930
|
-
|
|
77931
|
-
|
|
77932
|
-
|
|
77933
|
-
|
|
77934
|
-
|
|
77935
|
-
|
|
77936
|
-
|
|
77937
|
-
|
|
77938
|
-
|
|
77939
|
-
|
|
77940
|
-
|
|
77915
|
+
} /* else {
|
|
77916
|
+
// Using Recorder
|
|
77917
|
+
this.recorder = new Recorder({
|
|
77918
|
+
encoderPath: this.builder.encoderPath||
|
|
77919
|
+
'https://cdnjs.cloudflare.com/ajax/libs/opus-recorder/8.0.5/encoderWorker.min.js',
|
|
77920
|
+
leaveStreamOpen: true,
|
|
77921
|
+
numberOfChannels: 1,
|
|
77922
|
+
// OPUS options
|
|
77923
|
+
encoderSampleRate: sampleRate,
|
|
77924
|
+
streamPages: true,
|
|
77925
|
+
maxBuffersPerPage: 1,
|
|
77926
|
+
});
|
|
77927
|
+
this.recorder.ondataavailable = (e) => {
|
|
77928
|
+
if(this.aborted) return;
|
|
77929
|
+
this.websocket.send(e.buffer);
|
|
77930
|
+
};
|
|
77931
|
+
} */
|
|
77941
77932
|
|
|
77942
77933
|
/*
|
|
77943
77934
|
// Using RecordRTC
|
|
@@ -77966,6 +77957,7 @@ class Dictation {
|
|
|
77966
77957
|
}, 2000);
|
|
77967
77958
|
}
|
|
77968
77959
|
let finalTranscripts = '';
|
|
77960
|
+
let speechTimeout;
|
|
77969
77961
|
this.websocket.onmessage = event => {
|
|
77970
77962
|
const message = JSON.parse(event.data);
|
|
77971
77963
|
if (message.event === 'can-open-mic') {
|
|
@@ -77973,22 +77965,24 @@ class Dictation {
|
|
|
77973
77965
|
|
|
77974
77966
|
if (this.builder.useMediaRecorder) {
|
|
77975
77967
|
this.mediaRecorder.start(1000); // Using mediaRecorder
|
|
77976
|
-
} else {
|
|
77977
|
-
|
|
77978
|
-
|
|
77968
|
+
} /* else {
|
|
77969
|
+
this.recorder.start(); // Using Recorder
|
|
77970
|
+
} */
|
|
77979
77971
|
|
|
77980
77972
|
// console.log('Start Dictation');
|
|
77981
77973
|
this.aborted = false;
|
|
77982
77974
|
}
|
|
77983
77975
|
if (message.event === 'transcript-result') {
|
|
77984
|
-
const transcripts = message.data;
|
|
77985
77976
|
if (this.builder.isInProgress || this.aborted) {
|
|
77986
77977
|
return;
|
|
77987
77978
|
}
|
|
77988
|
-
|
|
77979
|
+
const transcript = message.data.channel.alternatives[0].transcript;
|
|
77980
|
+
if (transcript && message.data.is_final) {
|
|
77981
|
+
finalTranscripts += ' ' + transcript;
|
|
77982
|
+
}
|
|
77989
77983
|
inpCommand.value = finalTranscripts;
|
|
77990
|
-
clearTimeout(
|
|
77991
|
-
|
|
77984
|
+
clearTimeout(speechTimeout);
|
|
77985
|
+
speechTimeout = setTimeout(() => {
|
|
77992
77986
|
this.builder.commandText = '';
|
|
77993
77987
|
finalTranscripts = '';
|
|
77994
77988
|
if (this.builder.autoSendCommand) {
|
|
@@ -78809,7 +78803,7 @@ class ContentBuilder {
|
|
|
78809
78803
|
enableDragResize: true,
|
|
78810
78804
|
simpleTextSettings: false,
|
|
78811
78805
|
enableColumnsPerLine: true,
|
|
78812
|
-
/* Prompt/Command Stuff */
|
|
78806
|
+
/* Prompt/Command Stuff for AI Assistant */
|
|
78813
78807
|
isContentBox: false,
|
|
78814
78808
|
sendCommandUrl: 'http://localhost:8081/answer',
|
|
78815
78809
|
// speechTranscribeUrl: 'http://192.168.1.7:8081',
|
|
@@ -78818,7 +78812,9 @@ class ContentBuilder {
|
|
|
78818
78812
|
commandPlaceholderText: '',
|
|
78819
78813
|
enableShortCommands: true,
|
|
78820
78814
|
speechRecognitionLang: 'en-US',
|
|
78821
|
-
useMediaRecorder:
|
|
78815
|
+
useMediaRecorder: true,
|
|
78816
|
+
// do not change
|
|
78817
|
+
encoderPath: '',
|
|
78822
78818
|
headlineList: ['We create simple and effective designs.', 'Ultimate Experiences With Story, Emotion, And Purpose.', 'Build Anything Beautifully', 'With Less Stuff and More Compassion', 'We\'re [CompanyName]. Full stack development with a spark of creativity.', 'Transforming your digital experience with [CompanyName]. Achieve your online goals with our customized solutions.', 'Revolutionizing web development with [CompanyName]. Unleash your digital potential with our high-performance solutions.', 'Creative and Inspiring'],
|
|
78823
78819
|
shortCommandList: {
|
|
78824
78820
|
undo: ['undo'],
|